Skip to content

Commit

Permalink
DTB Overlay Support and extlinux.conf (#43)
Browse files Browse the repository at this point in the history
  • Loading branch information
Fishwaldo authored Mar 6, 2023
1 parent 18496d9 commit a964f6e
Show file tree
Hide file tree
Showing 8 changed files with 58 additions and 16 deletions.
7 changes: 2 additions & 5 deletions .github/workflows/buildroot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,7 @@ jobs:
echo "DTB=${{ github.workspace }}/buildroot/output/images/bl808-*.dtb" >> $GITHUB_ENV
echo "OPENSBI=${{ github.workspace }}/buildroot/output/images/fw_jump.bin" >> $GITHUB_ENV
echo "LOWLOAD=${{ github.workspace }}/buildroot/output/images/*_lowload_bl808_*.bin" >> $GITHUB_ENV
echo "WHOLEBINOX=${{ github.workspace }}/buildroot/output/images/pine64-ox64-firmware.bin" >> $GITHUB_ENV
echo "WHOLEBINM1=${{ github.workspace }}/buildroot/output/images/sispeed-m1s-firmware.bin" >> $GITHUB_ENV
echo "WHOLEBINOX=${{ github.workspace }}/buildroot/output/images/bl808-firmware.bin" >> $GITHUB_ENV
echo "BRSDK=${{ github.workspace }}/buildroot/output/images/riscv*.tar.gz" >> $GITHUB_ENV
- name: Upload package
uses: actions/upload-artifact@master
Expand All @@ -87,7 +86,6 @@ jobs:
${{env.OPENSBI}}
${{env.LOWLOAD}}
${{env.WHOLEBINOX}}
${{env.WHOLEBINM1}}
- name: Upload sdk
if: matrix.target == 'pine64_ox64_full_defconfig'
uses: actions/upload-artifact@master
Expand Down Expand Up @@ -123,8 +121,7 @@ jobs:
mv Image-${{ matrix.target }}.lz4 Image.lz4
mkdir firmware
cp *_lowload_bl808_*.bin firmware/
cp pine64-ox64-firmware.bin firmware/
cp sispeed-m1s-firmware.bin firmware/
cp bl808-firmware.bin firmware/
cp sdcard-${{ matrix.target }}.img.xz firmware/
tar -czvf bl808-linux-${{ matrix.target }}.tar.gz firmware
echo "FIRMWARE=${{ github.workspace }}/build/bl808-linux-${{ matrix.target }}.tar.gz" >> $GITHUB_ENV
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ The SD card images are configured with a 1Gb Swap Partition, and will resize the
Inside the downloads you will find the following files:
* m0_lowload_bl808_m0.bin - This firmware runs on M0 and forwards interupts to the D0 for several peripherals
* d0_lowload_bl808_d0.bin - This is a very basic bootloader that loads opensbi, the kernel and dts files into ram
* pine64-ox64-firmware.bin/sispeed-m1s-firmware.bin - A image containing OpenSBI, the Kernel and DTS files for Pine64 OX64 and SiSpeed M1S Dock
* bl808-firmware.bin - A image containing OpenSBI, Uboot and uboot dtb files.
* sdcard-*.tar.xz - A tarball containing the rootfs for the image to be flashed to the SD card

### Development images
Expand Down Expand Up @@ -51,7 +51,7 @@ Download your prefered image above and extract the files.
- D0 Group[Group0] Image Addr [0x58100000] [PATH to d0_low_load_bl808_d0.bin]
- Click 'Create & Download' and wait until it's done
- Switch to [IOT] page
- Enable 'Single Download', set Address with 0x800000, choose [PATH to pine64-ox64-firmware.bin/sispeed-m1s-firmware.bin] (depending on your board)
- Enable 'Single Download', set Address with 0x800000, choose [bl808-firmware.bin]
- Click 'Create & Download' again and wait until it's done
- flash the sdcard-pine64-*.img.xz to your SD card (you can use dd (after uncompressing) or https://github.com/balena-io/etcher)
- Serial Console access:
Expand Down
3 changes: 3 additions & 0 deletions board/pine64/ox64/genimage.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ image boot.vfat {
"boot-m1s.scr",
"boot-pine64.scr",
}
file "extlinux/extlinux.conf" {
image = "extlinux/extlinux.conf"
}
}
size = 200M
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
From da8f2c5011a1783d3458b42d49b274e935fb80f9 Mon Sep 17 00:00:00 2001
From: Justin Hammond <justin@dynam.ac>
Date: Sat, 4 Mar 2023 15:53:10 +0800
Subject: [PATCH] add a few more variables for extlinux loading to work

---
diff --git a/include/configs/bl808.h b/include/configs/bl808.h
index 976640894d..5de6947958 100644
--- a/include/configs/bl808.h
+++ b/include/configs/bl808.h
@@ -46,7 +46,10 @@

#define CFG_EXTRA_ENV_SETTINGS \
"scriptaddr=0x50000000\0" \
- BOOTENV
+ "kernel_addr_r=0x50200000\0" \
+ "fdt_addr_r=0x51ff8000\0" \
+ "fdtoverlay_addr_r=0x52008000\0" \
+ BOOTENV
#endif

#endif /* __CONFIG_H */
9 changes: 4 additions & 5 deletions board/pine64/ox64/post-build.sh
Original file line number Diff line number Diff line change
@@ -1,18 +1,17 @@
#!/bin/sh
#echo "Compressing Kernel Image"
#lz4 -9 -f $BINARIES_DIR/Image $BINARIES_DIR/Image.lz4
echo "Compressing UBoot Image"
lz4 -9 -f $BINARIES_DIR/u-boot.bin $BINARIES_DIR/u-boot.bin.lz4
cd $BINARIES_DIR
echo "Creating OpenSBI/DTB/Kernel Image"
$BR2_EXTERNAL_BOUFFALO_BR_PATH/board/pine64/ox64/mergebin.py -o pine64-ox64-firmware.bin -k u-boot.bin.lz4 -d u-boot.dtb -s fw_jump.bin
$BR2_EXTERNAL_BOUFFALO_BR_PATH/board/pine64/ox64/mergebin.py -o sispeed-m1s-firmware.bin -k u-boot.bin.lz4 -d u-boot.dtb -s fw_jump.bin
echo "Creating OpenSBI/DTB/Uboot Image"
$BR2_EXTERNAL_BOUFFALO_BR_PATH/board/pine64/ox64/mergebin.py -o bl808-firmware.bin -k u-boot.bin.lz4 -d u-boot.dtb -s fw_jump.bin
echo "Copying Boot Script"
$BINARIES_DIR/../host/bin/mkimage -C none -A riscv -T script -d $BR2_EXTERNAL_BOUFFALO_BR_PATH/board/pine64/ox64/boot-m1s.cmd $BINARIES_DIR/boot-m1s.scr
$BINARIES_DIR/../host/bin/mkimage -C none -A riscv -T script -d $BR2_EXTERNAL_BOUFFALO_BR_PATH/board/pine64/ox64/boot-pine64.cmd $BINARIES_DIR/boot-pine64.scr
cp $BINARIES_DIR/boot-pine64.scr $BINARIES_DIR/boot.scr
cp $BINARIES_DIR/*.scr $TARGET_DIR/boot/
cp $BR2_EXTERNAL_BOUFFALO_BR_PATH/board/pine64/ox64/*.cmd $TARGET_DIR/boot/
mkdir -p $BINARIES_DIR/extlinux/
cp $TARGET_DIR/boot/extlinux/* $BINARIES_DIR/extlinux/
echo "Creating Filesystem Image"
$BASE_DIR/../support/scripts/genimage.sh -c $BR2_EXTERNAL_BOUFFALO_BR_PATH/board/pine64/ox64/genimage.cfg
echo "Completed - Images are at $BINARIES_DIR"
12 changes: 12 additions & 0 deletions board/pine64/ox64/rootfs-overlay/boot/extlinux/extlinux.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# Generic Distro Configuration file generated by OpenEmbedded
menu title Select the boot mode
TIMEOUT 30
DEFAULT Pine64 OX64 Kernel
LABEL Pine64 0X64 Kernel
KERNEL ../Image
FDT ../bl808-pine64-ox64.dtb
APPEND root=PARTLABEL=rootfs rootwait rw rootfstype=ext4 console=ttyS0,2000000 loglevel=8 earlycon=sbi
LABEL Sipeed M1SDock Kernel
KERNEL ../Image
FDT ../bl808-sipeed-m1s.dtb
APPEND root=PARTLABEL=rootfs rootwait rw rootfstype=ext4 console=ttyS0,2000000 loglevel=8 earlycon=sbi
12 changes: 8 additions & 4 deletions board/pine64/ox64/rootfs-overlay/root/README!!!!.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
By Default, this image is configured to boot the Pine64 Ox64 image.
If you want to boot a different image, please copy the boot-m1s.scr
in /boot to /boot/boot.scr

The boot-m1s.scr/boot.scr file(s) are U-Boot scripts that will load the
correct DTB file the board you are using.
To change the image, you need to edit the file /boot/extlinux/extlinux.conf
and change the Default entry to Sipeed M1SDock Kernel

Alternatively, if you have custom images, and using uboot scripts, you can
add the relevent uboot script to the /boot/boot.scr file.

Please see the following link for more information on how how uboot is
configured:
https://github.com/openbouffalo/buildroot_bouffalo/wiki/U-Boot-Bootflow
5 changes: 5 additions & 0 deletions board/pine64/ox64/uboot_defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,14 @@ CONFIG_BOOTCOMMAND="mmc rescan; sleep 1; mmc rescan; run distro_bootcmd"
# CONFIG_BOOTM_PLAN9 is not set
# CONFIG_BOOTM_RTEMS is not set
# CONFIG_BOOTM_VXWORKS is not set
CONFIG_CMD_BOOTMENU=y
CONFIG_CMD_CLK=y
CONFIG_CMD_GPIO=y
CONFIG_CMD_MMC=y
# CONFIG_OF_OMIT_DTB is not set
CONFIG_ENV_IS_NOWHERE=y
CONFIG_ENV_IS_IN_FAT=y
CONFIG_ENV_FAT_DEVICE_AND_PART="0:auto"
CONFIG_NET_RANDOM_ETHADDR=y
CONFIG_MMC=y
CONFIG_MMC_BROKEN_CD=y
Expand All @@ -41,3 +45,4 @@ CONFIG_PINCONF=y
CONFIG_BAUDRATE=2000000
CONFIG_SYSRESET=y
# CONFIG_SHA256 is not set
CONFIG_OF_LIBFDT_OVERLAY=y

0 comments on commit a964f6e

Please sign in to comment.