From 7e9ee36f0bf226f4535566b56d2e84353ec89dde Mon Sep 17 00:00:00 2001 From: Michel Stempin Date: Sat, 10 Oct 2020 22:55:51 +0200 Subject: [PATCH 01/10] U-Boot config for 2020.10 release Signed-off-by: Michel Stempin --- FunKey/board/funkey/uboot.config | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/FunKey/board/funkey/uboot.config b/FunKey/board/funkey/uboot.config index bab94d1..72998d0 100644 --- a/FunKey/board/funkey/uboot.config +++ b/FunKey/board/funkey/uboot.config @@ -1,30 +1,27 @@ CONFIG_ARM=y CONFIG_ARCH_SUNXI=y -# CONFIG_ARMV7_NONSEC is not set +CONFIG_SPL=y CONFIG_IDENT_STRING=" FunKey" -# CONFIG_PRE_CONSOLE_BUFFER is not set CONFIG_MACH_SUN8I_V3S=y CONFIG_DRAM_CLK=360 -CONFIG_DRAM_ZQ=14779 -# CONFIG_VIDEO is not set +# CONFIG_ARMV7_NONSEC is not set CONFIG_DEFAULT_DEVICE_TREE="sun8i-v3s-funkey" CONFIG_LOCALVERSION="-funkey" # CONFIG_DISTRO_DEFAULTS is not set +# CONFIG_FIT is not set CONFIG_BOOTDELAY=0 +# CONFIG_PRE_CONSOLE_BUFFER is not set CONFIG_SYS_CONSOLE_INFO_QUIET=y CONFIG_SYS_STDIO_DEREGISTER=y # CONFIG_DISPLAY_CPUINFO is not set # CONFIG_DISPLAY_BOARDINFO is not set -CONFIG_SPL=y CONFIG_HUSH_PARSER=y CONFIG_CMD_BOOTZ=y -# CONFIG_CMD_IMLS is not set -# CONFIG_CMD_FLASH is not set -# CONFIG_CMD_FPGA is not set -# CONFIG_CMD_NET is not set -# CONFIG_CMD_NFS is not set +CONFIG_CMD_PART=y CONFIG_CMD_EXT2=y CONFIG_CMD_EXT4=y CONFIG_CMD_FAT=y CONFIG_CMD_FS_GENERIC=y -CONFIG_REGEX=y +# CONFIG_ENV_IS_IN_FAT is not set +CONFIG_ENV_IS_IN_MMC=y +# CONFIG_NET is not set From 5d825dd7bb33f30f9b19393467ff01fd9a5a13b2 Mon Sep 17 00:00:00 2001 From: Michel Stempin Date: Tue, 13 Oct 2020 13:38:30 +0200 Subject: [PATCH 02/10] add GPT support Signed-off-by: Michel Stempin --- FunKey/board/funkey/genimage.cfg | 8 ++++++++ FunKey/board/funkey/linux.config | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/FunKey/board/funkey/genimage.cfg b/FunKey/board/funkey/genimage.cfg index 93692e1..511d7fa 100644 --- a/FunKey/board/funkey/genimage.cfg +++ b/FunKey/board/funkey/genimage.cfg @@ -11,8 +11,16 @@ image boot.vfat { image sdcard.img { hdimage { + gpt = true + gpt-location = 800K # 688128 # 672K } +# partition gpt-header { +# in-partition-table = "no" +# offset = 1K +# size = 512 +# } + partition u-boot { in-partition-table = "no" image = "u-boot-sunxi-with-spl.bin" diff --git a/FunKey/board/funkey/linux.config b/FunKey/board/funkey/linux.config index e47d1ba..d1e3519 100644 --- a/FunKey/board/funkey/linux.config +++ b/FunKey/board/funkey/linux.config @@ -11,7 +11,7 @@ CONFIG_PERF_EVENTS=y CONFIG_MODULES=y CONFIG_MODULE_UNLOAD=y CONFIG_PARTITION_ADVANCED=y -# CONFIG_EFI_PARTITION is not set +# CONFIG_MSDOS_PARTITION is not set CONFIG_ARCH_SUNXI=y # CONFIG_MACH_SUN4I is not set # CONFIG_MACH_SUN5I is not set From 829a1c397363302bc903500993b166cb9cfdb933 Mon Sep 17 00:00:00 2001 From: Michel Stempin Date: Tue, 13 Oct 2020 13:41:02 +0200 Subject: [PATCH 03/10] double boot and rootfs partitions Signed-off-by: Michel Stempin --- FunKey/board/funkey/boot.cmd | 2 +- FunKey/board/funkey/boot_alt.cmd | 4 ++++ FunKey/board/funkey/genimage.cfg | 35 ++++++++++++++++++++++++++++---- 3 files changed, 36 insertions(+), 5 deletions(-) create mode 100644 FunKey/board/funkey/boot_alt.cmd diff --git a/FunKey/board/funkey/boot.cmd b/FunKey/board/funkey/boot.cmd index f9b1bc0..79e1bdd 100644 --- a/FunKey/board/funkey/boot.cmd +++ b/FunKey/board/funkey/boot.cmd @@ -1,4 +1,4 @@ -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 +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 load mmc 0:1 0x41000000 uImage load mmc 0:1 0x41800000 sun8i-v3s-funkey.dtb bootm 0x41000000 - 0x41800000 diff --git a/FunKey/board/funkey/boot_alt.cmd b/FunKey/board/funkey/boot_alt.cmd new file mode 100644 index 0000000..e7df9bf --- /dev/null +++ b/FunKey/board/funkey/boot_alt.cmd @@ -0,0 +1,4 @@ +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 +load mmc 0:2 0x41000000 uImage +load mmc 0:2 0x41800000 sun8i-v3s-funkey.dtb +bootm 0x41000000 - 0x41800000 diff --git a/FunKey/board/funkey/genimage.cfg b/FunKey/board/funkey/genimage.cfg index 511d7fa..20dd696 100644 --- a/FunKey/board/funkey/genimage.cfg +++ b/FunKey/board/funkey/genimage.cfg @@ -28,22 +28,49 @@ image sdcard.img { size = 536K # 544KB - 8KB } -# partition u-boot-env { +# partition u-boot-env0 { # in-partition-table = "no" # offset = 544K # size = 128K # } - partition boot { +# partition u-boot-env1 { +# in-partition-table = "no" +# offset = 672K +# size = 128K +# } + +# partition gpt-table { +# in-partition-table = "no" +# offset = 800K +# size = 16K +# } + + partition boot0 { offset = 1M partition-type = 0xC bootable = "true" image = "boot.vfat" } - partition rootfs { + partition boot1 { + offset = 9M + partition-type = 0xC + bootable = "true" + image = "boot.vfat" + } + + partition rootfs0 { + offset = 17M partition-type = 0x83 image = "rootfs.ext4" - size = 0 + size = 111M + } + + partition rootfs1 { + offset = 128M + partition-type = 0x83 + image = "rootfs.ext4" + size = 128M } } From d2f122307aba1d3bda2fe5491639a8437e9af6ac Mon Sep 17 00:00:00 2001 From: Michel Stempin Date: Tue, 13 Oct 2020 23:27:43 +0200 Subject: [PATCH 04/10] 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 From 2f327c0c4515c8c52c3c2484d47d17e6c6ac2b4b Mon Sep 17 00:00:00 2001 From: Michel Stempin Date: Wed, 14 Oct 2020 22:44:10 +0200 Subject: [PATCH 05/10] remove boot scripts Signed-off-by: Michel Stempin --- FunKey/board/funkey/boot.cmd | 4 ---- FunKey/board/funkey/boot_alt.cmd | 4 ---- FunKey/board/funkey/genimage.cfg | 2 -- FunKey/board/funkey/post-build.sh | 3 --- FunKey/configs/funkey_defconfig | 3 +-- 5 files changed, 1 insertion(+), 15 deletions(-) delete mode 100644 FunKey/board/funkey/boot.cmd delete mode 100644 FunKey/board/funkey/boot_alt.cmd diff --git a/FunKey/board/funkey/boot.cmd b/FunKey/board/funkey/boot.cmd deleted file mode 100644 index 79e1bdd..0000000 --- a/FunKey/board/funkey/boot.cmd +++ /dev/null @@ -1,4 +0,0 @@ -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 -load mmc 0:1 0x41000000 uImage -load mmc 0:1 0x41800000 sun8i-v3s-funkey.dtb -bootm 0x41000000 - 0x41800000 diff --git a/FunKey/board/funkey/boot_alt.cmd b/FunKey/board/funkey/boot_alt.cmd deleted file mode 100644 index e7df9bf..0000000 --- a/FunKey/board/funkey/boot_alt.cmd +++ /dev/null @@ -1,4 +0,0 @@ -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 -load mmc 0:2 0x41000000 uImage -load mmc 0:2 0x41800000 sun8i-v3s-funkey.dtb -bootm 0x41000000 - 0x41800000 diff --git a/FunKey/board/funkey/genimage.cfg b/FunKey/board/funkey/genimage.cfg index d980c4f..517ed3b 100644 --- a/FunKey/board/funkey/genimage.cfg +++ b/FunKey/board/funkey/genimage.cfg @@ -3,7 +3,6 @@ image boot.vfat { files = { "uImage", "sun8i-v3s-funkey.dtb", - "boot.scr" } } size = 8M @@ -14,7 +13,6 @@ image boot_alt.vfat { files = { "uImage", "sun8i-v3s-funkey.dtb", - "boot_alt.scr" } } size = 8M diff --git a/FunKey/board/funkey/post-build.sh b/FunKey/board/funkey/post-build.sh index ed51cc2..57f26e1 100755 --- a/FunKey/board/funkey/post-build.sh +++ b/FunKey/board/funkey/post-build.sh @@ -13,6 +13,3 @@ 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/configs/funkey_defconfig b/FunKey/configs/funkey_defconfig index 0802cd0..ce989cc 100644 --- a/FunKey/configs/funkey_defconfig +++ b/FunKey/configs/funkey_defconfig @@ -84,8 +84,7 @@ BR2_TARGET_UBOOT_CUSTOM_CONFIG_FILE="$(BR2_EXTERNAL_FUNKEY_PATH)/board/funkey/ub BR2_TARGET_UBOOT_NEEDS_DTC=y BR2_TARGET_UBOOT_FORMAT_CUSTOM=y BR2_TARGET_UBOOT_FORMAT_CUSTOM_NAME="u-boot-sunxi-with-spl.bin" -BR2_TARGET_UBOOT_BOOT_SCRIPT=y -BR2_TARGET_UBOOT_BOOT_SCRIPT_SOURCE="$(BR2_EXTERNAL_FUNKEY_PATH)/board/funkey/boot.cmd" BR2_PACKAGE_HOST_DOSFSTOOLS=y BR2_PACKAGE_HOST_GENIMAGE=y BR2_PACKAGE_HOST_MTOOLS=y +BR2_PACKAGE_HOST_UBOOT_TOOLS=y From 6bdf048310c9cf4799171121ddfc4e95a8c6f0f3 Mon Sep 17 00:00:00 2001 From: Michel Stempin Date: Wed, 14 Oct 2020 22:44:45 +0200 Subject: [PATCH 06/10] use zImage instead of uImage Signed-off-by: Michel Stempin --- FunKey/board/funkey/genimage.cfg | 4 ++-- FunKey/board/funkey/rootfs-overlay/etc/u-boot.env | 8 ++++---- FunKey/configs/funkey_defconfig | 2 -- 3 files changed, 6 insertions(+), 8 deletions(-) diff --git a/FunKey/board/funkey/genimage.cfg b/FunKey/board/funkey/genimage.cfg index 517ed3b..3e98825 100644 --- a/FunKey/board/funkey/genimage.cfg +++ b/FunKey/board/funkey/genimage.cfg @@ -1,7 +1,7 @@ image boot.vfat { vfat { files = { - "uImage", + "zImage", "sun8i-v3s-funkey.dtb", } } @@ -11,7 +11,7 @@ image boot.vfat { image boot_alt.vfat { vfat { files = { - "uImage", + "zImage", "sun8i-v3s-funkey.dtb", } } diff --git a/FunKey/board/funkey/rootfs-overlay/etc/u-boot.env b/FunKey/board/funkey/rootfs-overlay/etc/u-boot.env index 9a505af..c19fec5 100644 --- a/FunKey/board/funkey/rootfs-overlay/etc/u-boot.env +++ b/FunKey/board/funkey/rootfs-overlay/etc/u-boot.env @@ -1,17 +1,17 @@ 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_bootcmd=run alt_args_mmc; run alt_loadfdt; run alt_loadimage; bootz ${loadaddr} - ${fdtaddr} alt_loadfdt=load mmc 0:2 ${fdtaddr} sun8i-v3s-funkey.dtb -alt_loadimage=load mmc 0:2 ${loadaddr} uImage +alt_loadimage=load mmc 0:2 ${loadaddr} zImage 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 -bootcmd=run args_mmc; run loadfdt; run loadimage; bootm ${loadaddr} - ${fdtaddr} +bootcmd=run args_mmc; run loadfdt; run loadimage; bootz ${loadaddr} - ${fdtaddr} bootdelay=0 console=ttyS0,115200 fdt_high=0xffffffff fdtaddr=0x41800000 loadaddr=0x41000000 loadfdt=load mmc 0:1 ${fdtaddr} sun8i-v3s-funkey.dtb -loadimage=load mmc 0:1 ${loadaddr} uImage +loadimage=load mmc 0:1 ${loadaddr} zImage stderr=serial@01c28000 stdin=serial@01c28000 stdout=serial@01c28000 diff --git a/FunKey/configs/funkey_defconfig b/FunKey/configs/funkey_defconfig index ce989cc..522bdcd 100644 --- a/FunKey/configs/funkey_defconfig +++ b/FunKey/configs/funkey_defconfig @@ -22,9 +22,7 @@ BR2_LINUX_KERNEL_CUSTOM_REPO_URL="https://github.com/FunKey-Project/linux" BR2_LINUX_KERNEL_CUSTOM_REPO_VERSION="cda44c146b9b87290bc7c636ffa7d88cbfb03ace" BR2_LINUX_KERNEL_USE_CUSTOM_CONFIG=y BR2_LINUX_KERNEL_CUSTOM_CONFIG_FILE="$(BR2_EXTERNAL_FUNKEY_PATH)/board/funkey/linux.config" -BR2_LINUX_KERNEL_UIMAGE=y BR2_LINUX_KERNEL_LZO=y -BR2_LINUX_KERNEL_UIMAGE_LOADADDR="0x41000000" BR2_LINUX_KERNEL_DTS_SUPPORT=y BR2_LINUX_KERNEL_INTREE_DTS_NAME="sun8i-v3s-funkey" BR2_PACKAGE_BUSYBOX_CONFIG="$(BR2_EXTERNAL_FUNKEY_PATH)/board/funkey/busybox.config" From b5d7aaa6acec114fb1a09847f44e6c25b2c5a101 Mon Sep 17 00:00:00 2001 From: Michel Stempin Date: Wed, 14 Oct 2020 23:34:04 +0200 Subject: [PATCH 07/10] moved kernel and dtb to rootfs Signed-off-by: Michel Stempin --- FunKey/board/funkey/genimage.cfg | 26 ++----------------- .../funkey/rootfs-overlay/etc/u-boot.env | 8 +++--- FunKey/configs/funkey_defconfig | 1 + 3 files changed, 7 insertions(+), 28 deletions(-) diff --git a/FunKey/board/funkey/genimage.cfg b/FunKey/board/funkey/genimage.cfg index 3e98825..5c54d1c 100644 --- a/FunKey/board/funkey/genimage.cfg +++ b/FunKey/board/funkey/genimage.cfg @@ -1,23 +1,3 @@ -image boot.vfat { - vfat { - files = { - "zImage", - "sun8i-v3s-funkey.dtb", - } - } - size = 8M -} - -image boot_alt.vfat { - vfat { - files = { - "zImage", - "sun8i-v3s-funkey.dtb", - } - } - size = 8M -} - image sdcard.img { hdimage { gpt = true @@ -58,15 +38,13 @@ image sdcard.img { partition boot { offset = 1M partition-type = 0xC - bootable = "true" - image = "boot.vfat" + size = 8M } partition boot_alt { offset = 9M partition-type = 0xC - bootable = "true" - image = "boot_alt.vfat" + size = 8M } partition rootfs { diff --git a/FunKey/board/funkey/rootfs-overlay/etc/u-boot.env b/FunKey/board/funkey/rootfs-overlay/etc/u-boot.env index c19fec5..a825419 100644 --- a/FunKey/board/funkey/rootfs-overlay/etc/u-boot.env +++ b/FunKey/board/funkey/rootfs-overlay/etc/u-boot.env @@ -1,7 +1,7 @@ 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; bootz ${loadaddr} - ${fdtaddr} -alt_loadfdt=load mmc 0:2 ${fdtaddr} sun8i-v3s-funkey.dtb -alt_loadimage=load mmc 0:2 ${loadaddr} zImage +alt_loadfdt=load mmc 0:4 ${fdtaddr} /boot/sun8i-v3s-funkey.dtb +alt_loadimage=load mmc 0:4 ${loadaddr} /boot/zImage 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 bootcmd=run args_mmc; run loadfdt; run loadimage; bootz ${loadaddr} - ${fdtaddr} @@ -10,8 +10,8 @@ console=ttyS0,115200 fdt_high=0xffffffff fdtaddr=0x41800000 loadaddr=0x41000000 -loadfdt=load mmc 0:1 ${fdtaddr} sun8i-v3s-funkey.dtb -loadimage=load mmc 0:1 ${loadaddr} zImage +loadfdt=load mmc 0:3 ${fdtaddr} /boot/sun8i-v3s-funkey.dtb +loadimage=load mmc 0:3 ${loadaddr} /boot/zImage stderr=serial@01c28000 stdin=serial@01c28000 stdout=serial@01c28000 diff --git a/FunKey/configs/funkey_defconfig b/FunKey/configs/funkey_defconfig index 522bdcd..59078e8 100644 --- a/FunKey/configs/funkey_defconfig +++ b/FunKey/configs/funkey_defconfig @@ -25,6 +25,7 @@ BR2_LINUX_KERNEL_CUSTOM_CONFIG_FILE="$(BR2_EXTERNAL_FUNKEY_PATH)/board/funkey/li BR2_LINUX_KERNEL_LZO=y BR2_LINUX_KERNEL_DTS_SUPPORT=y BR2_LINUX_KERNEL_INTREE_DTS_NAME="sun8i-v3s-funkey" +BR2_LINUX_KERNEL_INSTALL_TARGET=y BR2_PACKAGE_BUSYBOX_CONFIG="$(BR2_EXTERNAL_FUNKEY_PATH)/board/funkey/busybox.config" BR2_PACKAGE_BUSYBOX_SHOW_OTHERS=y BR2_PACKAGE_ALSA_UTILS=y From 42fc776aef06887179ed1962f0381007cc2c599f Mon Sep 17 00:00:00 2001 From: Michel Stempin Date: Wed, 14 Oct 2020 23:44:39 +0200 Subject: [PATCH 08/10] removed boot partitions Signed-off-by: Michel Stempin --- FunKey/board/funkey/genimage.cfg | 22 +++++-------------- .../funkey/rootfs-overlay/etc/u-boot.env | 12 +++++----- 2 files changed, 11 insertions(+), 23 deletions(-) diff --git a/FunKey/board/funkey/genimage.cfg b/FunKey/board/funkey/genimage.cfg index 5c54d1c..2a06001 100644 --- a/FunKey/board/funkey/genimage.cfg +++ b/FunKey/board/funkey/genimage.cfg @@ -35,34 +35,22 @@ image sdcard.img { # size = 16K # } - partition boot { - offset = 1M - partition-type = 0xC - size = 8M - } - - partition boot_alt { - offset = 9M - partition-type = 0xC - size = 8M - } - partition rootfs { - offset = 17M + offset = 1M partition-type = 0x83 image = "rootfs.ext4" - size = 111M + size = 100M } partition rootfs_alt { - offset = 128M + offset = 101M partition-type = 0x83 image = "rootfs.ext4" - size = 128M + size = 100M } # partition share { -# offset = 256M +# offset = 201M # partition-type = 0xC # bootable = "false" # size = 0 diff --git a/FunKey/board/funkey/rootfs-overlay/etc/u-boot.env b/FunKey/board/funkey/rootfs-overlay/etc/u-boot.env index a825419..b26a333 100644 --- a/FunKey/board/funkey/rootfs-overlay/etc/u-boot.env +++ b/FunKey/board/funkey/rootfs-overlay/etc/u-boot.env @@ -1,8 +1,8 @@ -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_args_mmc=setenv bootargs console=ttyS0,115200 panic=5 rootwait fbcon=map:10 fbcon=font:VGA8x8 vt.global_cursor_default=0 root=/dev/mmcblk0p1 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; bootz ${loadaddr} - ${fdtaddr} -alt_loadfdt=load mmc 0:4 ${fdtaddr} /boot/sun8i-v3s-funkey.dtb -alt_loadimage=load mmc 0:4 ${loadaddr} /boot/zImage -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 +alt_loadfdt=load mmc 0:1 ${fdtaddr} /boot/sun8i-v3s-funkey.dtb +alt_loadimage=load mmc 0:1 ${loadaddr} /boot/zImage +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 baudrate=115200 bootcmd=run args_mmc; run loadfdt; run loadimage; bootz ${loadaddr} - ${fdtaddr} bootdelay=0 @@ -10,8 +10,8 @@ console=ttyS0,115200 fdt_high=0xffffffff fdtaddr=0x41800000 loadaddr=0x41000000 -loadfdt=load mmc 0:3 ${fdtaddr} /boot/sun8i-v3s-funkey.dtb -loadimage=load mmc 0:3 ${loadaddr} /boot/zImage +loadfdt=load mmc 0:2 ${fdtaddr} /boot/sun8i-v3s-funkey.dtb +loadimage=load mmc 0:2 ${loadaddr} /boot/zImage stderr=serial@01c28000 stdin=serial@01c28000 stdout=serial@01c28000 From fb4a95f1710fc6f1637b423ebf4b33a8759972ac Mon Sep 17 00:00:00 2001 From: Michel Stempin Date: Wed, 14 Oct 2020 23:48:45 +0200 Subject: [PATCH 09/10] swapped rootfs and rootfs_alt partitions Signed-off-by: Michel Stempin --- FunKey/board/funkey/genimage.cfg | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/FunKey/board/funkey/genimage.cfg b/FunKey/board/funkey/genimage.cfg index 2a06001..a107816 100644 --- a/FunKey/board/funkey/genimage.cfg +++ b/FunKey/board/funkey/genimage.cfg @@ -35,14 +35,14 @@ image sdcard.img { # size = 16K # } - partition rootfs { + partition rootfs_alt { offset = 1M partition-type = 0x83 image = "rootfs.ext4" size = 100M } - partition rootfs_alt { + partition rootfs { offset = 101M partition-type = 0x83 image = "rootfs.ext4" @@ -50,7 +50,7 @@ image sdcard.img { } # partition share { -# offset = 201M +# offset = 1G # partition-type = 0xC # bootable = "false" # size = 0 From a452990d84d7366f207c3b92d0b5121baadff4c1 Mon Sep 17 00:00:00 2001 From: Michel Stempin Date: Thu, 15 Oct 2020 23:12:07 +0200 Subject: [PATCH 10/10] adjust first_boot script to GPT partition layout Signed-off-by: Michel Stempin --- .../rootfs-overlay/usr/local/sbin/first_boot | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/FunKey/board/funkey/rootfs-overlay/usr/local/sbin/first_boot b/FunKey/board/funkey/rootfs-overlay/usr/local/sbin/first_boot index 760dede..b7ea00e 100755 --- a/FunKey/board/funkey/rootfs-overlay/usr/local/sbin/first_boot +++ b/FunKey/board/funkey/rootfs-overlay/usr/local/sbin/first_boot @@ -3,10 +3,15 @@ # Uncomment the following line to get debug info #set -x -SELF=$(basename $0) - source /usr/local/lib/utils +SELF=$(basename $0) +root_part=$(cat /proc/cmdline | sed -n 's|^.*root=/dev/\([^ ]*\).*|\1|p') +part_num=${root_part#mmcblk0p} +if [ "${part_num}" -eq 1 ]; then + die 0 "recovery mode" +fi + notif () { info "$@" printf "$@" > /sys/class/graphics/fb0/notification @@ -27,8 +32,6 @@ check_root_id () { } resize_rootfs_partition () { - local root_part=$(cat /proc/cmdline | sed -n 's|^.*root=/dev/\([^ ]*\).*|\1|p') - local part_num=${root_part#mmcblk0p} if [ "${part_num}" = "{$root_part}" ]; then die 2 "${root_part} is not an SD card. Don't know how to expand it, aborting" fi @@ -50,7 +53,6 @@ resize_rootfs_partition () { d ${part_num} n -p ${part_num} ${part_start} +1G @@ -69,7 +71,6 @@ reload_partition_table () { } resize_rootfs_filesystem () { - local root_part=$(cat /proc/cmdline | sed -n 's|^.*root=/dev/\([^ ]*\).*|\1|p') resize2fs /dev/${root_part} >/dev/null 2>&1 || die 7 "cannot resize the root filesystem, aborting" return 0 } @@ -106,8 +107,6 @@ create_backing_store_partition () { if [ $? -ne 0 ]; then # Find out the root partition number from kernel command line - local root_part=$(cat /proc/cmdline | sed -n 's|^.*root=/dev/\([^ ]*\).*|\1|p') - local part_num=${root_part#mmcblk0p} if [ "$part_num" = "$root_part" ]; then die 5 "$root_part is not an SD card. Don't know how to create the backing store partition" fi @@ -130,13 +129,12 @@ create_backing_store_partition () { # Create a third FAT32 partition that filsl the disk fdisk /dev/mmcblk0 >/dev/null 2>&1 <