Building VIBE2 Boot Image
Note : All steps are executed on the Ubuntu 16.04.2 LTS and as a root user. Most of the steps are similar Robert C Nelson BBB Wiki.
Contents
Basic Requirements
- Running a recent release of Debian, Fedora or Ubuntu; without OS Virtualization Software.
- ARM Cross Compiler – Linaro: http://www.linaro.org
- Linaro Toolchain Binaries: http://www.linaro.org/downloads/
- Bootloader
- Das U-Boot – the Universal Boot Loader: http://www.denx.de/wiki/U-Boot
- Source: http://git.denx.de/?p=u-boot.git;a=summary
- Linux Kernel
- Linus's Mainline tree: https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git
- ARM based rootfs
- Debian : http://www.debian.org/
- Ubuntu: http://www.ubuntu.com
ARM Cross Compiler: GCC
Download and extract the ARM Cross compiler linaro gcc. From now on consider ~/ is the root directory of compilation setup.
~/
wget -c https://releases.linaro.org/components/toolchain/binaries/5.4-2017.01/arm-linux-gnueabihf/gcc-linaro-5.4.1-2017.01-x86_64_arm-linux-gnueabihf.tar.xz tar xf gcc-linaro-5.4.1-2017.01-x86_64_arm-linux-gnueabihf.tar.xz export CC=`pwd`/gcc-linaro-5.4.1-2017.01-x86_64_arm-linux-gnueabihf/bin/arm-linux-gnueabihf-
Test:
~/
${CC}gcc --version arm-linux-gnueabihf-gcc (Linaro GCC 5.4-2017.01) 5.4.1 20161213 Copyright (C) 2015 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
Bootloader: U-Boot
Download :
~/
git clone https://github.com/u-boot/u-boot cd u-boot/ git checkout v2017.03 -b tmp
Patches :
wget -c https://rcn-ee.com/repos/git/u-boot-patches/v2017.03/0001-am335x_evm-uEnv.txt-bootz-n-fixes.patch wget -c https://rcn-ee.com/repos/git/u-boot-patches/v2017.03/0002-U-Boot-BeagleBone-Cape-Manager.patch patch -p1 < 0001-am335x_evm-uEnv.txt-bootz-n-fixes.patch patch -p1 < 0002-U-Boot-BeagleBone-Cape-Manager.patch
Configure and Build :
~/u-boot
make ARCH=arm CROSS_COMPILE=${CC} distclean make ARCH=arm CROSS_COMPILE=${CC} am335x_evm_defconfig make ARCH=arm CROSS_COMPILE=${CC}
Linux Kernel
TI BSP
Download
~/
git clone https://github.com/RobertCNelson/ti-linux-kernel-dev.git cd ti-linux-kernel-dev/
For TI v4.4.x:
~/ti-linux-kernel-dev
git checkout origin/ti-linux-4.4.y -b ti-linux-4.4.y
Update GCC cross compiler path in system.sh
cp system.sh.sample system.sh
Update CC variable with path with GCC compiler path set above
nano system.sh CC=/home/yantrr/gcc-linaro-5.4.1-2017.01-x86_64_arm-linux-gnueabihf/bin/arm-linux-gnueabihf-
Build
~/ti-linux-kernel-dev/
./build_kernel.sh
Update LINUX_GIT variable in system.sh
nano system.sh LINUX_GIT=/home/yantrr/ti-linux-kernel-dev/ignore/linux-src/
Change USB0 Mode :
For VIBE/VIBE2, very first you need to change the USB0 dr_mode from peripheral to host in Beaglebone Black kernel source file KERNEL/arch/arm/boot/dts/am335x-bone-common.dtsi while rebuilding the kernel
&usb0 { status = "okay"; dr_mode = "host"; };
ZTE and Telit modems driver are already in Beaglebone Black kernel source version 4.4, so no need of any patch for it.
USB Driver configuration for SEW modems:
|
Only needed for SEW modems. |
nano KERNEL/drivers/usb/serial/option.c /* Yantrr Strongrising products */ #define YANTRR_VENDOR_ID 0x21f5 #define YANTRR_PRODUCT_VAYU3GH 0x2012 #define YANTRR_PRODUCT_VAYU3GC 0x2009 #define YANTRR_DONGLE_ID 0x20a6 #define YANTRR_DONGLE_PRODUCT 0x1105
/*Also, add entries in struct usb_device_id option_ids[]*/ { USB_DEVICE(YANTRR_VENDOR_ID, YANTRR_PRODUCT_VAYU3GH) }, { USB_DEVICE(YANTRR_VENDOR_ID, YANTRR_PRODUCT_VAYU3GC) }, { USB_DEVICE(YANTRR_DONGLE_ID, YANTRR_DONGLE_PRODUCT) },
Rebuild Kernel
~/ti-linux-kernel-dev
./tools/rebuild.sh
Check for PPS support under Device Drivers ---> PPS Support
Final output on terminal :
----------------------------- 'arch/arm/boot/zImage' -> '/home/yantrr/ti-linux-kernel-dev/deploy/4.4.62-ti-r99.zImage' '.config' -> '/home/yantrr/ti-linux-kernel-dev/deploy/config-4.4.62-ti-r99' -rwxr-xr-x 1 root root 8.3M May 2 14:58 /home/yantrr/ti-linux-kernel-dev/deploy/4.4.62-ti-r99.zImage ----------------------------- Building modules archive... Compressing 4.4.62-ti-r99-modules.tar.gz... -rw-r--r-- 1 root root 22M May 2 14:58 /home/yantrr/ti-linux-kernel-dev/deploy/4.4.62-ti-r99-modules.tar.gz ----------------------------- Building firmware archive... Compressing 4.4.62-ti-r99-firmware.tar.gz... -rw-r--r-- 1 root root 1.2M May 2 14:58 /home/yantrr/ti-linux-kernel-dev/deploy/4.4.62-ti-r99-firmware.tar.gz ----------------------------- Building dtbs archive... Compressing 4.4.62-ti-r99-dtbs.tar.gz... -rw-r--r-- 1 root root 1.4M May 2 14:58 /home/yantrr/ti-linux-kernel-dev/deploy/4.4.62-ti-r99-dtbs.tar.gz ----------------------------- Script Complete eewiki.net: [user@localhost:~$ export kernel_version=4.4.62-ti-r99] -----------------------------
Setup microSD card
We are assuming the DISK=/dev/sdc, Please check the device id of SD-Card with lsblk
export DISK=/dev/sdc
Erase partition table/labels on microSD card:
dd if=/dev/zero of=${DISK} bs=1M
Install Bootloader:
~/
dd if=./u-boot/MLO of=${DISK} count=1 seek=1 bs=128k dd if=./u-boot/u-boot.img of=${DISK} count=2 seek=1 bs=384k
Create Partition Layout:
With util-linux v2.26, sfdisk was rewritten and is now based on libfdisk.
sfdisk --version sfdisk from util-linux 2.27.1
For sfdisk >= 2.26.x
sfdisk ${DISK} <<-__EOF__ 4M,,L,* __EOF__
For sfdisk <= 2.25.x
sfdisk --unit M ${DISK} <<-__EOF__ 4,,L,* __EOF__
Format Partition:
With mkfs.ext4 1.43, we need to make sure metadata_csum and 64bit are disabled.
As U-Boot CAN NOT currently handle reading files with these newer ext4 options and so Debian 8 (armel/armhf) and Ubuntu 16.04 (armhf) fsck tools will operate correctly.
mkfs.ext4 -V mke2fs 1.42.13 (17-May-2015) Using EXT2FS Library version 1.42.13
For mkfs.ext4 >= 1.43
for: DISK=/dev/mmcblk0 mkfs.ext4 -L rootfs -O ^metadata_csum,^64bit ${DISK}p1 for: DISK=/dev/sdX mkfs.ext4 -L rootfs -O ^metadata_csum,^64bit ${DISK}1
For mkfs.ext4 <= 1.42
for: DISK=/dev/mmcblk0 mkfs.ext4 -L rootfs ${DISK}p1 for: DISK=/dev/sdX mkfs.ext4 -L rootfs ${DISK}1
Mount Partition:
Normally these partitions will be auto-mounted.
mkdir -p /media/rootfs/ for: DISK=/dev/mmcblk0 mount ${DISK}p1 /media/rootfs/ for: DISK=/dev/sdX mount ${DISK}1 /media/rootfs/
Backup Bootloader
This version of MLO/u-boot.img will be used on the "eMMC" flasher script on this page.
~/
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/
Dealing with old Bootloader in eMMC
If you don't want to clear out the old Bootloader in eMMC add this uEnv.txt to /media/rootfs/
~/uEnv.txt
##This will work with: Angstrom's 2013.06.20 u-boot. loadaddr=0x82000000 fdtaddr=0x88000000 rdaddr=0x88080000 initrd_high=0xffffffff fdt_high=0xffffffff #for single partitions: mmcroot=/dev/mmcblk0p1 loadximage=load mmc 0:1 ${loadaddr} /boot/vmlinuz-${uname_r} loadxfdt=load mmc 0:1 ${fdtaddr} /boot/dtbs/${uname_r}/${fdtfile} loadxrd=load mmc 0:1 ${rdaddr} /boot/initrd.img-${uname_r}; setenv rdsize ${filesize} loaduEnvtxt=load mmc 0:1 ${loadaddr} /boot/uEnv.txt ; env import -t ${loadaddr} ${filesize}; loadall=run loaduEnvtxt; run loadximage; run loadxfdt; mmcargs=setenv bootargs console=tty0 console=${console} ${optargs} ${cape_disable} ${cape_enable} root=${mmcroot} rootfstype=${mmcrootfstype} ${cmdline} uenvcmd=run loadall; run mmcargs; bootz ${loadaddr} - ${fdtaddr};
~/
sudo cp -v ./uEnv.txt /media/rootfs/
Root File System
Debian 8
User | Password |
---|---|
debian | temppwd |
root | root |
Download:
~/
wget -c https://rcn-ee.com/rootfs/eewiki/minfs/debian-8.7-minimal-armhf-2017-03-02.tar.xz
Verify:
~/
sha256sum debian-8.7-minimal-armhf-2017-03-02.tar.xz 1ef9c2620ff3f26f7fab839e0a430426110de7dbc7a818d6d89d9abb239d4d23 debian-8.7-minimal-armhf-2017-03-02.tar.xz
Extract:
~/
tar xf debian-8.7-minimal-armhf-2017-03-02.tar.xz
Ubuntu 16.04 LTS
User | Password |
---|---|
ubuntu | temppwd |
Download:
~/
wget -c https://rcn-ee.com/rootfs/eewiki/minfs/ubuntu-16.04.2-minimal-armhf-2017-03-02.tar.xz
Verify:
~/
sha256sum ubuntu-16.04.2-minimal-armhf-2017-03-02.tar.xz 294b2156f71f03a7a297cfaa3edcb6e63b6ad95d46969210e0af231e4e5dd098 ubuntu-16.04.2-minimal-armhf-2017-03-02.tar.xz
Extract:
~/
tar xf ubuntu-16.04.2-minimal-armhf-2017-03-02.tar.xz
Copy Root File System
~/
tar xfvp ./*-*-*-armhf-*/armhf-rootfs-*.tar -C /media/rootfs/ sync chown root:root /media/rootfs/ chmod 755 /media/rootfs/
Install Kernel
The kernel building/rebuilding scripts listed on this page will give you a hint of what kernel version was built.
----------------------------- Script Complete eewiki.net: [user@localhost:~$ export kernel_version=4.4.62-ti-r99] -----------------------------
|
4.4.62-ti-r99 is built kernel version, change according to your built version . |
Copy and paste that "export kernel_version=4.4.62-ti-r99" exactly as shown in your own build/desktop environment and hit enter to create an environment variable to be used later.
export kernel_version=4.4.62-ti-r99
Set uname_r in /boot/uEnv.txt
~/
sh -c "echo 'uname_r=${kernel_version}' >> /media/rootfs/boot/uEnv.txt"
Copy Kernel Image
~/
cp -v ./ti-linux-kernel-dev/deploy/${kernel_version}.zImage /media/rootfs/boot/vmlinuz-${kernel_version}
Copy Kernel Device Tree Binaries
~/
mkdir -p /media/rootfs/boot/dtbs/${kernel_version}/ tar xfv ./ti-linux-kernel-dev/deploy/${kernel_version}-dtbs.tar.gz -C /media/rootfs/boot/dtbs/${kernel_version}/
Copy Kernel Modules
~/
tar xfv ./ti-linux-kernel-dev/deploy/${kernel_version}-modules.tar.gz -C /media/rootfs/
Networking
Edit: /etc/network/interfaces
sudo nano /media/rootfs/etc/network/interfaces
Add: /etc/network/interfaces
auto lo iface lo inet loopback auto eth0 allow-hotplug eth0 #iface eth0 inet dhcp iface eth0 inet static address 192.168.1.150 netmask 255.255.255.0 network 192.168.1.0 gateway 192.168.1.1
Networking: Using a shared SD card with Multiple VIBE2 boards
|
To always enable the Ethernet interface as eth0 and WiFi interface as wlan0. |
Edit: /etc/udev/rules.d/70-persistent-net.rules
sudo nano /media/rootfs/etc/udev/rules.d/70-persistent-net.rules
Add: /etc/udev/rules.d/70-persistent-net.rules
# VIBE2: net device () SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{dev_id}=="0x0", ATTR{type}=="1", KERNEL=="eth*", NAME="eth0" # Wifi Device SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{dev_id}=="0x0", ATTR{type}=="1", KERNEL=="wlan*", NAME="wlan0"
Remove microSD/SD card
Check the device id of SD card using lsblk and use below steps for safely removal of microSD/SD card
sync umount /dev/sdc1 eject /dev/sdc
Boot with microSD card
Now after safely removal of microSD card from Desktop/Laptop, insert it in VIBE2's microSD card slot.
Connect Ethernet cable to VIBE2 board.
Additionally you can connect USB-To-UART connector (supplied with VIBE2-RevA) with UART0 of VIBE2-RevA or microUSB cable with Diagnostic Port of VIBE2-RevB, for monitoring the boot up activities.
Hold down the Boot Switch S2 (which is on top of microSD card slot) and while holding S2 switch connect the power adapter. Keep holding S2 switch until Blue User LEDs starts glowing.
Device Tree Overlays
|
This is just to ensure that all the correct overlays should in rebuild image. |
Installation Steps
- Clone the repo
cd /root/ git clone https://github.com/beagleboard/bb.org-overlays.git cd ./bb.org-overlays
- Verify the dtc version should be latest one
dtc --version Version: DTC 1.4.1-gXYZXYZXYZ
- Upgrade the dtc
./dtc-overlay.sh
- Install *.dtbo
cd /root/bb.org-overlays ./install.sh
Note: This will copies all the dtbo files after compilation automatically in directory /lib/firmware/
capemgr: enable/disable capes on kernel cmdline
Comma delimited list of PART-NUMBER[:REV] of [enabled/disabled] capes
bone_capemgr.enable_partno= bone_capemgr.disable_partno=
capemgr: enable/disable capes with slots
- Slots :
root@beaglebone:~# cat /sys/devices/platform/bone_capemgr/slots 0: PF---- -1 1: PF---- -1 2: PF---- -1 3: PF---- -1
- Add Device :
root@beaglebone:~# sh -c "echo 'BB-UART4' > /sys/devices/platform/bone_capemgr/slots" root@beaglebone:~# cat /sys/devices/platform/bone_capemgr/slots 0: PF---- -1 1: PF---- -1 2: PF---- -1 3: PF---- -1 4: P-O-L- 0 Override Board Name,00A0,Override Manuf,BB-UART4
- Remove Device:
root@beaglebone:~# sh -c "echo '-4' > /sys/devices/platform/bone_capemgr/slots" root@beaglebone:~# cat /sys/devices/platform/bone_capemgr/slots 0: PF---- -1 1: PF---- -1 2: PF---- -1 3: PF---- -1
Install Basic Packages
apt-get update apt-get -y install usbutils wvdial minicom ntp ntpdate i2c-tools git
WiFi Driver
VIBE2-RevB
VIBE2-RevB has Realtek RTL8723BU chipset for WiFi+BLE.
Hardware ID 0bda:b720
Driver Link : https://github.com/lwfinger/rtl8723bu
- Install Dependency Packages
apt-get install --reinstall linux-headers-$(uname -r) build-essential git
- Clone Driver Repository
cd /root/ git clone https://github.com/lwfinger/rtl8723bu.git
- Set Non-Concurrent Mode for WiFi
cd rtl8723bu nano Makefile
Find the line that contains EXTRA_CFLAGS += -DCONFIG_CONCURRENT_MODE and insert a # symbol at the beginning of that line. This comments that line and disables concurrent mode.
cd /root/rtl8723bu make make install modprobe -v 8723bu
- For Bluetooth tools/utilities
apt-get install bluetooth
|
Now configure WiFi network as per needed. |
Flash eMMC
- Login into VIBE2
ssh root@192.168.1.150 password: root
- Execute eMMC Flashing script
cd /opt/scripts/tools/eMMC/ ./init-eMMC-flasher-v3.sh
|
On successful eMMC flashing, the VIBE2's User LEDs glow fully and board gets power down afterwards. |