From 706c8e3cec9b6f7981330ca5d70458b3cc9ee196 Mon Sep 17 00:00:00 2001 From: Michel Stempin Date: Tue, 13 Oct 2020 23:27:43 +0200 Subject: [PATCH] working multi-boot Signed-off-by: Michel Stempin --- FunKey/board/funkey/genimage.cfg | 32 +++++++++++++++---- FunKey/board/funkey/post-build.sh | 3 ++ .../funkey/rootfs-overlay/etc/u-boot.env | 12 +++---- FunKey/board/funkey/uboot.config | 2 ++ 4 files changed, 35 insertions(+), 14 deletions(-) diff --git a/FunKey/board/funkey/genimage.cfg b/FunKey/board/funkey/genimage.cfg index 20dd696..d980c4f 100644 --- a/FunKey/board/funkey/genimage.cfg +++ b/FunKey/board/funkey/genimage.cfg @@ -9,6 +9,17 @@ image boot.vfat { size = 8M } +image boot_alt.vfat { + vfat { + files = { + "uImage", + "sun8i-v3s-funkey.dtb", + "boot_alt.scr" + } + } + size = 8M +} + image sdcard.img { hdimage { gpt = true @@ -28,13 +39,13 @@ image sdcard.img { size = 536K # 544KB - 8KB } -# partition u-boot-env0 { +# partition u-boot-env { # in-partition-table = "no" # offset = 544K # size = 128K # } -# partition u-boot-env1 { +# partition u-boot_alt-env { # in-partition-table = "no" # offset = 672K # size = 128K @@ -46,31 +57,38 @@ image sdcard.img { # size = 16K # } - partition boot0 { + partition boot { offset = 1M partition-type = 0xC bootable = "true" image = "boot.vfat" } - partition boot1 { + partition boot_alt { offset = 9M partition-type = 0xC bootable = "true" - image = "boot.vfat" + image = "boot_alt.vfat" } - partition rootfs0 { + partition rootfs { offset = 17M partition-type = 0x83 image = "rootfs.ext4" size = 111M } - partition rootfs1 { + partition rootfs_alt { offset = 128M partition-type = 0x83 image = "rootfs.ext4" size = 128M } + +# partition share { +# offset = 256M +# partition-type = 0xC +# bootable = "false" +# size = 0 +# } } diff --git a/FunKey/board/funkey/post-build.sh b/FunKey/board/funkey/post-build.sh index 57f26e1..ed51cc2 100755 --- a/FunKey/board/funkey/post-build.sh +++ b/FunKey/board/funkey/post-build.sh @@ -13,3 +13,6 @@ rm -f ${TARGET_DIR}/etc/init.d/S01syslogd ${TARGET_DIR}/etc/init.d/S02klogd # Change dropbear init sequence mv ${TARGET_DIR}/etc/init.d/S50dropbear ${TARGET_DIR}/etc/init.d/S42dropbear + +# Generate alternate U-Boot boot script +${HOST_DIR}/bin/mkimage -C none -A arm -T script -d ${BR2_EXTERNAL_FUNKEY_PATH}/board/funkey/boot_alt.cmd ${BINARIES_DIR}/boot_alt.scr diff --git a/FunKey/board/funkey/rootfs-overlay/etc/u-boot.env b/FunKey/board/funkey/rootfs-overlay/etc/u-boot.env index 68cd235..9a505af 100644 --- a/FunKey/board/funkey/rootfs-overlay/etc/u-boot.env +++ b/FunKey/board/funkey/rootfs-overlay/etc/u-boot.env @@ -1,19 +1,17 @@ -arch=arm -args_mmc=setenv bootargs console=ttyS0,115200 panic=5 rootwait fbcon=map:10 fbcon=font:VGA8x8 vt.global_cursor_default=0 root=/dev/mmcblk0p2 rootfstype=ext4 rootflags=commit=120,data=writeback,barrier=0,journal_async_commit rw quiet +alt_args_mmc=setenv bootargs console=ttyS0,115200 panic=5 rootwait fbcon=map:10 fbcon=font:VGA8x8 vt.global_cursor_default=0 root=/dev/mmcblk0p4 rootfstype=ext4 rootflags=commit=120,data=writeback,barrier=0,journal_async_commit rw quiet +alt_bootcmd=run alt_args_mmc; run alt_loadfdt; run alt_loadimage; bootm ${loadaddr} - ${fdtaddr} +alt_loadfdt=load mmc 0:2 ${fdtaddr} sun8i-v3s-funkey.dtb +alt_loadimage=load mmc 0:2 ${loadaddr} uImage +args_mmc=setenv bootargs console=ttyS0,115200 panic=5 rootwait fbcon=map:10 fbcon=font:VGA8x8 vt.global_cursor_default=0 root=/dev/mmcblk0p3 rootfstype=ext4 rootflags=commit=120,data=writeback,barrier=0,journal_async_commit rw quiet baudrate=115200 -board=sunxi -board_name=sunxi bootcmd=run args_mmc; run loadfdt; run loadimage; bootm ${loadaddr} - ${fdtaddr} bootdelay=0 console=ttyS0,115200 -cpu=armv7 fdt_high=0xffffffff fdtaddr=0x41800000 loadaddr=0x41000000 loadfdt=load mmc 0:1 ${fdtaddr} sun8i-v3s-funkey.dtb loadimage=load mmc 0:1 ${loadaddr} uImage -serial#=12c000026a14b94a -soc=sunxi stderr=serial@01c28000 stdin=serial@01c28000 stdout=serial@01c28000 diff --git a/FunKey/board/funkey/uboot.config b/FunKey/board/funkey/uboot.config index 72998d0..5499606 100644 --- a/FunKey/board/funkey/uboot.config +++ b/FunKey/board/funkey/uboot.config @@ -24,4 +24,6 @@ CONFIG_CMD_FAT=y CONFIG_CMD_FS_GENERIC=y # CONFIG_ENV_IS_IN_FAT is not set CONFIG_ENV_IS_IN_MMC=y +CONFIG_USE_DEFAULT_ENV_FILE=y +CONFIG_DEFAULT_ENV_FILE="$(BR2_EXTERNAL_FUNKEY_PATH)/board/funkey/rootfs-overlay/etc/u-boot.env" # CONFIG_NET is not set