Build and Boot Kernel For Beaglebone Black

Download as pptx, pdf, or txt
Download as pptx, pdf, or txt
You are on page 1of 25

BUILD AND BOOT KERNEL

FOR BEAGLEBONE BLACK

PRESENTER: NGUYEN TIEN VIET DUNG – 21161235


TRAN QUOC THIEN – 21161267
LERTURER: ASSOC.PROF VO MINH HUAN, PHD
CONTENTS

• 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

 Expansion Interfaces: via 2x46 pin headers LCD,


UART,eMMC ADC, I2C, SPI,PWM.
Overall, The architecture of an embedded
systems consists of three layers:
• User space
• Kernel space
• Hardware
For the user space to communicate with the
hardware, They must go through Kernel space.
A new BeagleBone board doesn’t include
Kernel space and device drivers

Building Kernel is a significant action we have to do in


order for the Beagle board to run and work with.
4
PREREQUISITE

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-

Remember, you should use the cd command


to return then continue with the next steps 8
2. Setup and compile kernel
• git clone https://github.com/RobertCNelson/bb-kernel
• cd bb-kernel/
• git checkout origin/am33x-v6.5 -b tmp
• ./build_kernel.sh

When show the configuration, don’t change 9

anythings, press save and exit.


Next we will setup to rootfs file system.
• wget -c https://rcn-ee.com/rootfs/eewiki/minfs/debian-12.1-
minimal-armhf-2023-08-22.tar.xz
• tar xf debian-12.1-minimal-armhf-2023-08-22.tar.xz

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/

sudo mount ${DISK}1/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"

5. Copy kernel image


• sudo cp -v ./bb-kernel/deploy/${kernel_version}.zImage/media/rootfs/boot/vmlinuz-$
{kernel_version}

6. Copy kernel device tree binaries


• sudo mkdir -p /media/rootfs/boot/dtbs/${kernel_version}/
• sudo tar xfv ./bb-kernel/deploy/${kernel_version}-dtbs.tar.gz -C/media/rootfs/boot/dtbs/$
{kernel_version}/

18
7. Copy kernel modules
• sudo tar xfv ./bb-kernel/deploy/${kernel_version}-modules.tar.gz -C /media/rootfs/

8. File systems table (/etc/fstab)


• sudo sh -c "echo '/dev/mmcblk0p1 / auto errors=remount-ro 01' >> /media/rootfs/etc/fstab

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

Now, I have completed building the Kernel on the


virtual machine, the next step is to log into the
board and run

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

[2] RobertCNelson,” Debian: Getting Started with the BeagleBone Black”,


https://forum.digikey.com/t/debian-getting-started-with-the-beaglebone-black/12967/1, Nov 21 2023.
[3] Luu An Phu, “tranning_ embedded_linux_v3”,
https://github.com/phuthodien/training_embedded_linux_v3/blob/main/Bai_1_build_image_cho_beaglebone/
steps_load_image.txt?fbclid=IwAR19hTvJeTtsvb04Iwuw9zSmrmV3dKVtvekiLZdWrcEMiOTCIv11bKdyu54

24
THANK
YOU
25

You might also like