YMMV

* your mileage may vary

Sunday, 8 June 2014

Beaglebone Black (BBB) Compile Kernel Locally


Steps I follow to compile BBB Kernel locally.  It takes about 5 hours to compile (make) on the BBB.  Use at your own risk (make a backup!).  Run as root to avoid disappointment.
Before:
root@beaglebone:/lib/modules/3.8.13-bone50/build# uname -a
3.8.13-bone50 #1 SMP Tue May 13 13:24:52 UTC 2014 armv7l GNU/Linux

Install headers/source (see this link for instructions)
http://dumb-looks-free.blogspot.fr/2014/06/beaglebone-black-bbb-kernal-headers.html

Reboot and login as root
Copy am335x-pm-firmware.bin into firmware build directory otherwise an error like this will appear.
  CC [M]  sound/usb/midi.o
  LD [M]  sound/usb/snd-usb-audio.o
  LD [M]  sound/usb/snd-usbmidi-lib.o
  CC      sound/last.o
  LD      sound/built-in.o
  CC [M]  sound/ac97_bus.o
  MK_FW   firmware/am335x-pm-firmware.bin.gen.S
make[1]: *** No rule to make target `firmware/am335x-pm-firmware.bin', needed by `firmware/am335x-pm-firmware.bin.gen.o'.  Stop.
make: *** [firmware] Error 2

copy the file
cp /lib/firmware/am335x-pm-firmware.bin /usr/src/linux-3.8.13-bone50/firmware/

begin the build
cd /lib/modules/3.8.13-bone50/build
make mrproper
zcat /proc/config.gz > .config
make oldconfig

Update the .config file to specify a LOCALVERSION for the build
nano .config
CONFIG_LOCALVERSION="-bone50-GL"

This step takes about 5 hours so when you are ready, aim, .....fire
make -j1 zImage modules

Install the modules
make modules_install

Copy the new zImage over to the boot directory
cp arch/arm/boot/zImage /boot/uboot/zImage-GL

Update Env.txt to point to the new zImage-GL.  (This can be changed back if needed to revert to old configuration/setup).
nano /boot/uboot/uEnv.txt
kernel_file=zImage-GL

Reboot and check that all is ok
root@beaglebone:~# uname -a
Linux beaglebone 3.8.13bone50-GL #1 SMP Sun Jun 8 11:57:17 UTC 2014 armv7l GNU/Linux


Test compiling a driver
touch /usr/src/linux-3.8.13-bone50/drivers/net/wireless/rtlwifi/rtl8192cu/rtl8192cu.mod.c
cd /usr/src/linux-3.8.13-bone50
make modules SUBDIRS=drivers/net/wireless/rtlwifi/rtl8192cu
make modules_install SUBDIR=drivers/net/wireless/rtlwifi/rtl8192cu

Verify
modprobe rtl8192cu
lsmod
modinfo rtl8192cu

No comments:

Post a Comment