I mentioned the
objcopy command earlier, but I had recently put it into effect myself by shaving off quite a bit of bulk from Linux kernel modules targeted towards an embedded system and I wanted to share my steps and commands with you.
- Step 1: Compile your kernel and install the modules
- Step 2: Change to the directory in which you installed your kernel modules
- Step 3: Run the following command which will find all files ending in .ko and pipe it to run the
objcopycommand (note, the following shows an example of using cross compile tools targeted towards ARM)
make; make modules_install
find . -type f -name '*.ko' | xargs -n 1 /myfiles/tscrosstool/crosstool-linux-arm-uclibc-3.4.6/arm-uclibc-3.4.6/bin/arm-linux-objcopy --strip-unneeded
That’s it. You’ll notice that your kernel module sizes are now very small compared to what they used to be, and this allows you to squeeze in more features in your embedded system and possibly leave even more free space for your programs or files.