Build and Boot Kernel For Beaglebone Black
Build and Boot Kernel For Beaglebone Black
Build and Boot Kernel For Beaglebone Black
• Introduction
• Overview of BeagleBone Black
• Prerequisite
• Steps to build kernel for BeagleBone Black
• Videos related to building Kernel
• Conclusion
• References
2
INTRODUCTION
• Beaglebone black is a low-cost, high expansion,
community-supported development platform for
developers.
• Specification:
Processor: Texas Instruments Sitara AM3358 1GHz
ARM Cortex-A8.
Memory: 512MB DDR3L 800MHZ.
Onboard Flash: 4GB, 8bit Embedded MMC
(eMMC).
Connectivity: High-speed USB-2.0 port,10/100M
Ethernet(RJ45).
User I/O: Reset Button, Boot Button, Power
Button, LED power indicator, 4 user configurable
LEDs.
Videi/Audio Interfaces: HDMI D type interface,
LCD interface, Stereo audio over HDMI interface. 3
SDcard
Beagle bone
Black
CP2102
Laptop/PC
5
SDcrad
Reader
STEPS TO BUILD KERNEL FOR
BEAGLE BONE BLACK
The first step we have setup environment for Kernel
1. Install essential tools
• sudo apt install git bc bison flex libssl-dev make libc6-dev libncurses5-dev build-essential lzop swig lzma
lz4 gettext pkgconfig libmpc-dev u-boot-tools -y
6
2. Install cross toolchain (arm)
sudo apt install crossbuild-essential-armhf -y
7
Then, we have to get all components and compile.
1. Setup and compile u-boot
• git clone -b v2023.10 https://github.com/u-boot/u-boot --depth=1
• cd u-boot
• git pull --no-edit https://github.com/beagleboard/u-boot.git v2023.10
• make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- distclean
• make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihfam335x_evm_defconfig
• make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf-
10
After that, I will setup to microSD card.
1. Connect microSD card to VMware
11
2. Detect microSD card and erase
• lsblk
• export DISK=/dev/sdb
• sudo dd if=/dev/zero of=${DISK} bs=1M count=10
12
3. Install Uboot to microSD card
• sudo dd if=./u-boot/MLO of=${DISK} count=1 seek=1 bs=128k
• sudo dd if=./u-boot/u-boot.img of=${DISK} count=2 seek=1 bs=384k
13
4. Format partition
. sync
. sudo mkfs.ext4 -L rootfs -O^metadata_csum,^64bit ${DISK}1
14
5. Create partition layout
• sudo sfdisk ${DISK} <<-__EOF__
4M,,L,*
__EOF__
If any error occur, replace 4M -> 2M -> 1M
6. Mount partition
sudo mkdir -p /media/rootfs/
15
At the later time, I have write data into SDcard
1. Backup bootloader
• sudo mkdir -p /media/rootfs/opt/backup/uboot/
• sudo cp -v ./u-boot/MLO /media/rootfs/opt/backup/uboot/
• sudo cp -v ./u-boot/u-boot.img /media/rootfs/opt/backup/uboot/
16
2. Install kernel and rootfs
Attention: Kernel version search in bb-kernel/deploy
Example: 6.2.16-bone14-modules.tar.gz -> kernel_version=6.2.16-bone14
• export kernel_version=6.2.16-bone14
3. Copy rootfs
• sudo tar xfvp ./debian-*-*-armhf-*/armhf-rootfs-*.tar -C/media/rootfs/
• sync
• sudo chown root:root /media/rootfs/
• sudo chmod 755 /media/rootfs/
17
4. Set uname_r in /boot/uEnv.txt
• sudo sh -c "echo 'uname_r=${kernel_version}' >>/media/rootfs/boot/uEnv.txt"
18
7. Copy kernel modules
• sudo tar xfv ./bb-kernel/deploy/${kernel_version}-modules.tar.gz -C /media/rootfs/
19
9. Networking
• sudo nano /media/rootfs/etc/network/interfaces
• Add these and save
#/etc/network/interfaces
auto lo
iface lo inet loopback
auto eth0
iface eth0 inet dhcp
20
10.Eject microSD/SD card
• sync
• sudo umount /media/rootfs
21
VIDEOS RELATED TO BUILDING KERNEL
https://drive.google.com/file/d/
1AVv5SgzxpFUzSwY_H_Yqu3SSlQvO-n5s/view?
usp=sharing
22
CONCLUSION
In conclusion, building and booting a kernel for the BeagleBone Black involves a
series of steps, from obtaining the kernel source to configuring and compiling the code.
Careful consideration of the target architecture, cross-compilation tools, and device-
specific configurations is crucial for success. Once compiled, the generated kernel
image and device tree binary are transferred to the boot partition of a microSD card.
For those using U-Boot, the U-Boot image must also be included. The final steps
include inserting the microSD card into the BeagleBone Black, connecting optional
peripherals such as a serial console for debugging, and powering on the device.
Troubleshooting may be necessary, and consulting official documentation and
community forums is recommended for resolving any issues. By following these
procedures, users can customize and deploy a kernel tailored to their BeagleBone
Black, enabling a more optimized and tailored operating environment for their specific
needs. 23
REFERENCES
[1] Frank Vasquez, Chris Simmonds, “Mastering Embedded Linux Programming” , Third Edition, March 2021
24
THANK
YOU
25