RDK Resources
[*RDK Preferred*]
Code Management Facility
RDK Forums
[RDK Conferences]
RDK Support
Archives
Papers & Presentations Archive
...
Dependencies for sdcard flashing.
1)bootloader Bootloader:
Bananapi r4 follows a atf(arm-trusted firmware) flow for device bootup, by default flash memory is present in the device (BL1), and bl1 is depended on bl2 address which flow is mentiond below.
draw.io Diagram | ||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
1a)BL1: Bootloader one which will be part of flash memory of bpir4 , it will be holding address for bl2.
2b)BL2: Bootloader two need to be generated and loaded in a specified sector so that bl1 can load bl2.
3c)fip: Firmware image Package which contains firmware components eg bl31.
4d)Kernel: Layer which will be acting between hardware and OS.
5e)RDKB : RDKB stack or RDKB OS for user interaction.
"Kernel and rdkb rootfs will be generated as part BPIR4 build instructions"
Bootloader file generation
For generated bl2.img and fip.bin i used below mentioned git repo.
1) https://github.com/frank-w/u-boot/tree/2024-04-bpi → for generating uboot.bin files .
2) https://github.com/frank-w/u-boot/tree/mtk-atf → for generating atf flow bootloader files (bl2.img and fip.bin)
At initial i cloned mentioned git code https://github.com/frank-w/u-boot/tree/2024-04-bpi , and made below mentioned changes in uboot env file to make bootloader to load kernel and rdkb rootfs at initial bootup itself.
...
Code Block | ||||||
---|---|---|---|---|---|---|
| ||||||
#!/bin/bash
board="bpi-r4"
device="sdmmc"
OS="rdk-broadband-image"
IMGDIR=.
IMGNAME=${board}_${device}_${OS} --> Image name format
LDEV=`sudo losetup -f` --> Command to find available loob device in pc.
REALSIZE=7456
echo "create $IMGNAME.img"
dd if=/dev/zero of=$IMGDIR/$IMGNAME.img bs=1M count=$REALSIZE 1> /dev/null 2>&1
LDEV=`sudo losetup -f`
DEV=`echo $LDEV | cut -d "/" -f 3` #mount image to loop device
echo "run losetup to assign image $IMGNAME.img to loopdev $LDEV ($DEV)"
sudo losetup $LDEV $IMGDIR/$IMGNAME.img 1> /dev/null #2>&1
bootstart=17408
bootsize=100
rootsize=6600
bootend=$(( ${bootstart}+(${bootsize}*1024*2)-1 ))
rootstart=$(( ${bootend}+1 ))
rootend=$(( ${rootstart} + (${rootsize}*1024*2) ))
sudo sgdisk -o ${LDEV}
sudo sgdisk -a 1 -n 1:34:8191 -A 1:set:2 -t 1:8300 -c 1:"bl2" ${LDEV}
sudo sgdisk -a 1 -n 2:13312:17407 -A 2:set:63 -t 2:8300 -c 2:"fip" ${LDEV}
sudo sgdisk -a 1024 -n 3:17408:${bootend} -t 3:8300 -c 3:"boot" ${LDEV}
sudo sgdisk -a 1024 -n 4:${rootstart}:${rootend} -t 4:8300 -c 4:"rootfs" ${LDEV}
sudo losetup -d $LDEV
sudo losetup -P $LDEV $IMGDIR/$IMGNAME.img 1> /dev/null #2>&1
sudo dd if=atf/bpi-r4_sdmmc_bl2.img of=${LDEV}p1 conv=notrunc,fsync #1> /dev/null 2>&1
sudo dd if=atf/bpi-r4_sdmmc_fip.bin of=${LDEV}p2 conv=notrunc,fsync #1> /dev/null 2>&1
sudo mkfs.vfat "${LDEV}p3" -n BPI-BOOT #1> /dev/null 2>&1
sudo mkfs.ext4 -O ^metadata_csum,^64bit "${LDEV}p4" -L BPI-ROOT #1> /dev/null 2>&1
sudo mount "${LDEV}p3" /mnt/
sudo cp fitImage /mnt/
sudo cp mt7988a-bananapi-bpi-r4-sd.dtb /mnt/
sudo umount "${LDEV}p3"
sudo dd if=rdk-generic-broadband-image-bananapi4-rdk-broadband.ext4 of=${LDEV}p4
sudo losetup -d $LDEV
echo "packing image..."
gzip $IMGDIR/$IMGNAME.img
|