Select Page

BeagleBone Black – Deploying the kernel

Deploying the kernel

Setup microSD card

We need to access the External Drive to be utilized by the target device. Run lsblk to help figure out what linux device has been reserved for your External Drive.

lsblk

Thus you would use:

export DISK=/dev/sdb

Erase partition table/labels on microSD card:

sudo dd if=/dev/zero of=${DISK} bs=1M count=10

Install Bootloader

cd ~/bbb_linux
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

Create Partition Layout

sudo sfdisk ${DISK} <<-__EOF__
4M,,L,*
__EOF__

Format Partition

With mkfs.ext4 1.43, we need to make sure metadata_csum and 64bit are disabled. As the version of U-Boot needed for this target CAN NOT correctly handle reading files with these newer ext4 options.

sudo mkfs.ext4 -L rootfs -O ^metadata_csum,^64bit ${DISK}1

Mount Partition

On most systems these partitions may will be auto-mounted…

sudo mkdir -p /media/rootfs/
sudo mount ${DISK}1 /media/rootfs/

Create an environment variable to be used later.

export kernel_version=4.9.147-ti-rt-r121

Copy Kernel Image

cd ~/bbb_linux
sudo mkdir /media/rootfs/boot
sudo cp -v ./linux/arch/arm/boot/zImage /media/rootfs/boot/vmlinuz-${kernel_version}

Copy Root File System

~/bbb_linux
sudo tar xfvp ./debian-9.8-minimal-armhf-2019-02-16/armhf-rootfs-debian-stretch.tar -C /media/rootfs/
sync

Copy Kernel Device Tree Binaries

cd ~/bbb_linux
sudo mkdir -p /media/rootfs/boot/dtbs/${kernel_version}/
sudo cp -v ./linux/arch/arm/boot/dts/*.dtb /media/rootfs/boot/dtbs/${kernel_version}/

Copy Kernel Modules

cd ~/bbb_linux/linux
sudo make -j4 ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- INSTALL_MOD_STRIP=1 INSTALL_MOD_PATH=/media/rootfs/ modules_install

Set uname_r in /boot/uEnv.txt

cd ~/bbb_linux
sudo sh -c "echo 'uname_r=${kernel_version}' >> /media/rootfs/boot/uEnv.txt"

File Systems Table (/etc/fstab)

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

Networking

Edit: /etc/network/interfaces

sudo nano /media/rootfs/etc/network/interfaces

Add:

auto lo
iface lo inet loopback

auto eth0
iface eth0 inet dhcp

Networking: Using a shared SD card with Multiple BeagleBone

To always enable the Ethernet interface as eth0.
Edit: /etc/udev/rules.d/70-persistent-net.rules

sudo nano /media/rootfs/etc/udev/rules.d/70-persistent-net.rules

Add:

# BeagleBone: net device ()
SUBSYSTEM==”net”, ACTION==”add”, DRIVERS==”?*”, ATTR{dev_id}==”0x0″, ATTR{type}==”1″, KERNEL==”eth*”, NAME=”eth0″

Remove microSD/SD card

sync
sudo umount /media/rootfs

Plug the microSD card in to beaglebone black and press hold “Boot Switch” button and power it up.