Beagle Bone Black (BBB) Building a Custom Kernel – Deprecated – git://github.com/beagleboard/kernel.git

Last Modified 2015.04.09

Ubuntu 14.04.2 – Beagle Bone Black (BBB) Building a Custom Kernel – Deprecated – git://github.com/beagleboard/kernel.git

01. Install prerequisite software on BBB Ubuntu build system (Virtualbox VM install of Ubuntu 14.04.2 32bit Desktop):
$ sudo apt-get update
$ sudo apt-get install aptitude ssh
$ sudo aptitude full-upgrade –full-resolver
$ sudo aptitude install automake autoconf binfmt-support bridge-utils build-essential cpu-checker curl debootstrap fakeroot fuseext2 gawk gcc-arm-linux-gnueabi genext2fs gettext gnome-shell ubuntu-gnome-desktop gnome-tweak-tool elementary-icon-theme gnome-system-tools gobjc++-arm-linux-gnueabi hwdata kvm-ipxe libaio1 libfdt1 libglib2.0-dev libltdl-dev libncurses5-dev librados2 librbd1 libsdl1.2debian libssl-dev libtool libvde0 libvdeplug2 libwrap0-dev lzop make module-assistant msr-tools pkg-config python python-software-properties qemu-common qemu-keymaps qemu-kvm qemu-system qemu-user qemu-user-static qemu-utils seabios sshfs software-properties-common subversion sysfsutils u-boot-tools vde2 vgabios xmlto xmltoman
$ reboot
$ sudo apt-get install –install-recommends linux-generic-lts-utopic xserver-xorg-lts-utopic libgl1-mesa-glx-lts-utopic libegl1-mesa-drivers-lts-utopic
$ reboot

After reboot install virtualbox guest additions.

02. Install latest GIT:
$ sudo add-apt-repository ppa:git-core/ppa
$ sudo apt-get update
$ sudo apt-get install git git-core
$ git config –global user.email “rbianchi@kuttatech.com”

03. U-Boot:
$ cd /root
$ mkdir /root/beaglebone/ && mkdir /root/beaglebone/u-boot/
$ cd /root/beaglebone/u-boot/
$ wget ftp://ftp.denx.de/pub/u-boot/u-boot-latest.tar.bz2
$ tar -xjf u-boot-latest.tar.bz2
$ cd /root/beaglebone/u-boot/u-boot-2015.01
$ make sandbox_defconfig tools-only
$ sudo install tools/mkimage /usr/local/bin
$ make ARCH=arm CROSS_COMPILE=arm-linux-gnueabi- am335x_boneblack_defconfig
$ make ARCH=arm CROSS_COMPILE=arm-linux-gnueabi-

04. Compiling the BeagleBone Black Kernel:
$ cd /root/beaglebone/
$ git clone git://github.com/beagleboard/kernel.git
$ cd kernel
$ git checkout 3.14
$ ./patch.sh
$ cp configs/beaglebone kernel/arch/arm/configs/beaglebone_defconfig
$ wget http://arago-project.org/git/projects/?p=am33x-cm3.git\;a=blob_plain\;f=bin/am335x-pm-firmware.bin\;hb=HEAD -O kernel/firmware/am335x-pm-firmware.bin
$ cd kernel

BBB Kernel 3.14 .config file:
$ make ARCH=arm CROSS_COMPILE=arm-linux-gnueabi- beaglebone_defconfig -j4

Edit the .config file to reflect your changes, if any:
$ nano /root/beaglebone/kernel/kernel/.config

You could also use menuconfig to edit the .config file:
$ cd /root/beaglebone/kernel/kernel
$ make ARCH=arm CROSS_COMPILE=arm-linux-gnueabi- menuconfig

This step builds the kernel and may take 15-20 minutes or longer:
$ make ARCH=arm CROSS_COMPILE=arm-linux-gnueabi- uImage dtbs LOADADDR=0x80008000 -j4

This step builds the kernel for the BBB:
$ make ARCH=arm CROSS_COMPILE=arm-linux-gnueabi- uImage am335x-boneblack.dtb LOADADDR=0x80008000 -j4

This builds the kernel modules and may take 20 minutes or longer:
$ make ARCH=arm CROSS_COMPILE=arm-linux-gnueabi- modules -j4

The following steps assume you already have a working Ubuntu 14.04.2 MicroSD with boot and rootfs partitions.
http://www.armhf.com/boards/beaglebone-black/bbb-sd-install/

05. Update u-boot:
$ su
$ cd /root
$ mkdir boot
$ fdisk -l
$ mount /dev/sdX1 boot
$ cp /root/beaglebone/u-boot/u-boot-2015.01/MLO /root/boot
$ cp /root/beaglebone/u-boot/u-boot-2015.01/u-boot.img /root/boot
$ sync
$ cd /root
$ umount boot

06a. Update rootfs and zImage (kernel):
$ su
$ cd /root
$ mkdir rootfs
$ fdisk -l
$ mount /dev/sdX2 rootfs
$ cd /root/beaglebone/kernel/kernel
$ make ARCH=arm CROSS_COMPILE=arm-linux-gnueabi- INSTALL_MOD_PATH=/root/rootfs modules_install
$ cp /root/beaglebone/kernel/kernel/arch/arm/boot/zImage /root/rootfs/boot/vmlinuz-3.14.4.1-bone-armhf.com
$ cp /root/beaglebone/kernel/kernel/.config /root/rootfs/boot/config-3.14.4.1-bone-armhf.com
$ sync
$ cd /root
$ umount rootfs

Remove the MicroSD card from your adapter and boot into your custom kernel.

06b. Update rootfs and zImage (kernel) via SSH:
$ cd /root
$ mkdir sftpBBB
$ sshfs root@192.168.1.111:/ /root/sftpBBB
$ cd /root/beaglebone/kernel/kernel
$ make ARCH=arm CROSS_COMPILE=arm-linux-gnueabi- INSTALL_MOD_PATH=/root/sftpBBB modules_install
$ cp /root/beaglebone/kernel/kernel/arch/arm/boot/zImage /root/sftpBBB/boot/vmlinuz-3.14.4.1-bone-armhf.com
$ cp /root/beaglebone/kernel/kernel/.config /root/sftpBBB/boot/config-3.14.4.1-bone-armhf.com

Notes:
N01. Check current running kernel .config:
$ cat /proc/config.gz | gunzip > running.config

N02. Check UARTs:
$ ls -l /dev/ttyO*
N03. References:
https://github.com/beagleboard/kernel
http://dev.ardupilot.com/wiki/building-the-code/building-for-beaglebone-black-on-linux/#making_the_rt_kernel
http://wiki.beyondlogic.org/index.php/BeagleBoneBlack_Building_Kernel
http://elinux.org/Building_BBB_Kernel

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s