From 7389ef1d01ec875455e65caf5cd9600a5a36e62e Mon Sep 17 00:00:00 2001 From: Dale Whinham Date: Mon, 1 Mar 2021 18:19:07 +0000 Subject: [PATCH] Apply Circle patch to disable unneeded USB drivers --- CHANGELOG.md | 1 + Makefile | 4 ++ patches/circle-43.3-minimal-usb-drivers.patch | 52 +++++++++++++++++++ 3 files changed, 57 insertions(+) create mode 100644 patches/circle-43.3-minimal-usb-drivers.patch diff --git a/CHANGELOG.md b/CHANGELOG.md index a84003b..c17e72e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -21,6 +21,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Removed - Old ROM loading behavior now removed. If you have `MT32_CONTROL.ROM`/`MT32_PCM.ROM` files in the root of your SD card, please move them to the `roms` subdirectory otherwise they will fail to load. +- Unused USB drivers removed (kernel size reduced). ## [0.8.5] - 2021-02-10 diff --git a/Makefile b/Makefile index 59d40d9..bc7c71c 100644 --- a/Makefile +++ b/Makefile @@ -15,6 +15,9 @@ $(CIRCLE_STDLIB_CONFIG) $(CIRCLE_CONFIG)&: @echo "Configuring for Raspberry Pi $(RASPBERRYPI) ($(BITS) bit)" $(CIRCLESTDLIBHOME)/configure --raspberrypi=$(RASPBERRYPI) --prefix=$(PREFIX) + # Apply patches + @patch -N -p1 --no-backup-if-mismatch -r - -d $(CIRCLEHOME) < patches/circle-43.3-minimal-usb-drivers.patch + # Enable multi-core echo "DEFINE += -DARM_ALLOW_MULTI_CORE" >> $(CIRCLE_CONFIG) @@ -108,6 +111,7 @@ clean: # veryclean: clean # Reverse patches + @patch -R -N -p1 --no-backup-if-mismatch -r - -d $(CIRCLEHOME) < patches/circle-43.3-minimal-usb-drivers.patch @patch -R -N -p1 --no-backup-if-mismatch -r - -d $(FLUIDSYNTHHOME) < patches/fluidsynth-2.1.7-circle.patch @patch -R -N -p1 --no-backup-if-mismatch -r - -d $(FLUIDSYNTHHOME) < patches/fluidsynth-2.1.7-pan-fix-2.patch @patch -R -N -p1 --no-backup-if-mismatch -r - -d $(FLUIDSYNTHHOME) < patches/fluidsynth-2.1.7-pan-fix-1.patch diff --git a/patches/circle-43.3-minimal-usb-drivers.patch b/patches/circle-43.3-minimal-usb-drivers.patch new file mode 100644 index 0000000..3f3ed9e --- /dev/null +++ b/patches/circle-43.3-minimal-usb-drivers.patch @@ -0,0 +1,52 @@ +diff --git a/lib/usb/Makefile b/lib/usb/Makefile +index 88c33b4..35c9be0 100644 +--- a/lib/usb/Makefile ++++ b/lib/usb/Makefile +@@ -26,11 +26,8 @@ include $(CIRCLEHOME)/Rules.mk + + OBJS = lan7800.o smsc951x.o usbbluetooth.o usbcdcethernet.o \ + usbconfigparser.o usbdevice.o usbdevicefactory.o usbendpoint.o usbfunction.o \ +- usbgamepad.o usbgamepadps3.o usbgamepadps4.o usbgamepadstandard.o usbgamepadswitchpro.o \ +- usbgamepadxbox360.o usbgamepadxboxone.o usbhiddevice.o usbhostcontroller.o \ +- usbkeyboard.o usbmassdevice.o usbmidi.o usbmouse.o usbprinter.o usbrequest.o \ +- usbstandardhub.o usbstring.o usbserial.o usbserialch341.o usbserialcp2102.o \ +- usbserialpl2303.o usbserialft231x.o usbserialcdc.o ++ usbhiddevice.o usbhostcontroller.o usbkeyboard.o usbmassdevice.o usbmidi.o \ ++ usbrequest.o usbstandardhub.o usbstring.o + + ifneq ($(strip $(RASPPI)),4) + OBJS += dwhcidevice.o dwhciframeschednper.o dwhciframeschednsplit.o dwhciframeschedper.o \ +diff --git a/lib/usb/usbdevicefactory.cpp b/lib/usb/usbdevicefactory.cpp +index c67f36f..21c725e 100644 +--- a/lib/usb/usbdevicefactory.cpp ++++ b/lib/usb/usbdevicefactory.cpp +@@ -59,6 +59,7 @@ CUSBFunction *CUSBDeviceFactory::GetDevice (CUSBFunction *pParent, CString *pNam + { + pResult = new CUSBBulkOnlyMassStorageDevice (pParent); + } ++#if 0 + else if (pName->Compare ("int3-1-1") == 0) + { + pResult = new CUSBKeyboardDevice (pParent); +@@ -114,11 +115,13 @@ CUSBFunction *CUSBDeviceFactory::GetDevice (CUSBFunction *pParent, CString *pNam + { + pResult = new CUSBBluetoothDevice (pParent); + } ++#endif + else if ( pName->Compare ("int1-3-0") == 0 + || pName->Compare ("ven582-12a") == 0) // Roland UM-ONE MIDI interface + { + pResult = new CUSBMIDIDevice (pParent); + } ++#if 0 + else if (pName->Compare ("int2-6-0") == 0) + { + pResult = new CUSBCDCEthernetDevice (pParent); +@@ -144,6 +147,7 @@ CUSBFunction *CUSBDeviceFactory::GetDevice (CUSBFunction *pParent, CString *pNam + pResult = new CUSBSerialFT231XDevice (pParent); + } + // new devices follow ++#endif + + if (pResult != 0) + {