From 83584718167cf8231c887cf05226ad40384cef0c Mon Sep 17 00:00:00 2001 From: hzyitc Date: Thu, 18 Aug 2022 01:44:55 +0800 Subject: [PATCH] Onecloud: some update (#4073) * Onecloud: Rename back to csc * meson: Adjust sources config * Onecloud: disable u-boot compilation * Onecloud: Add armbianEnv.txt Onecloud: Use UUID to special rootfs * Onecloud: bootscript lint * Onecloud: bootscript support extraargs * Onecloud: support output boot log to HDMI * Onecloud: tweak VCC_CORE * Typo --- config/boards/odroidc1.eos | 5 +- config/boards/{onecloud.eos => onecloud.csc} | 4 +- config/bootenv/onecloud.txt | 23 ++++++++ config/bootscripts/boot-onecloud.cmd | 54 ++++++++++++------- .../sources/families/include/meson_common.inc | 42 +++++++-------- .../meson-5.14/board_onecloud/add-dts.patch | 37 ++++++------- .../board_onecloud/0001-add-dts.patch | 37 ++++++------- 7 files changed, 119 insertions(+), 83 deletions(-) rename config/boards/{onecloud.eos => onecloud.csc} (64%) create mode 100644 config/bootenv/onecloud.txt diff --git a/config/boards/odroidc1.eos b/config/boards/odroidc1.eos index 87cf025fe..8aee9a8f9 100644 --- a/config/boards/odroidc1.eos +++ b/config/boards/odroidc1.eos @@ -1,7 +1,10 @@ # Amlogic S805 C1 quad core 1GB RAM SoC GBE BOARD_NAME="Odroid C1" BOARDFAMILY="meson8b" -BOOTCONFIG="odroidc_config" KERNEL_TARGET="legacy,current,edge" + +BOOTCONFIG="odroidc_config" +BOOTSCRIPT="boot-odroid-c1.ini:boot.ini" + BOOTSIZE="200" BOOTFS_TYPE="fat" diff --git a/config/boards/onecloud.eos b/config/boards/onecloud.csc similarity index 64% rename from config/boards/onecloud.eos rename to config/boards/onecloud.csc index fbf3dda23..b510c95d5 100644 --- a/config/boards/onecloud.eos +++ b/config/boards/onecloud.csc @@ -3,7 +3,9 @@ BOARD_NAME="OneCloud" BOARDFAMILY="meson8b" KERNEL_TARGET="legacy,current,edge" -BOOTCONFIG="odroidc_config" +BOOTCONFIG="none" +BOOTSCRIPT="boot-onecloud.cmd:boot.cmd" +BOOTENV_FILE="onecloud.txt" BOOTSIZE="200" BOOTFS_TYPE="fat" diff --git a/config/bootenv/onecloud.txt b/config/bootenv/onecloud.txt new file mode 100644 index 000000000..495dffa99 --- /dev/null +++ b/config/bootenv/onecloud.txt @@ -0,0 +1,23 @@ +# console: +# Where the boot log print. +# both: HDMI Display and serial +# display: HDMI Display +# serial: Serial +# Note: +# Due to https://github.com/systemd/systemd/issues/9899, only the last +# console will be the primary console (/dev/console) which is the +# only console the initramfs shell and the systemd log use. +# So when set "both", we use serial console as the primary console. +console="both" +# console="display" +# console="serial" + +# consoleargs: +# Use custom console arguments +# Note: +# When is set, the arguments generated by the "console" setting will be invaild. +# consoleargs="" + +# extraargs="" + +# The following contents are auto-generated. diff --git a/config/bootscripts/boot-onecloud.cmd b/config/bootscripts/boot-onecloud.cmd index 99abc5688..2e7b45d3b 100644 --- a/config/bootscripts/boot-onecloud.cmd +++ b/config/bootscripts/boot-onecloud.cmd @@ -4,34 +4,50 @@ # # We can't use `test -z` due to the bug: https://lists.denx.de/pipermail/u-boot/2005-August/011447.html -test -n "${bootdev}" && test -n "${rootdev}" -if test $? != 0; then - echo '==============================================================' - echo 'Please set "bootdev" and "rootdev" before calling this script.' - echo '' - echo 'Boot from usb:' - echo ' bootdev="usb 0"' - echo ' rootdev="/dev/sda2"' - echo ' usb start' - echo ' fatload ${bootdev} 0x20800000 boot.scr && autoscr 0x20800000' - echo '' - echo 'Boot from eMMC:' - echo ' bootdev="mmc 1"' - echo ' rootdev="/dev/mmcblk1p2"' - echo ' fatload ${bootdev} 0x20800000 boot.scr && autoscr 0x20800000' - echo '==============================================================' - exit 22 +if test -n "${bootdev}"; test $? != 0; then + echo '==============================================================' + echo 'Please set "bootdev" before calling this script.' + echo '' + echo 'Boot from usb:' + echo ' setenv bootdev "usb 0"' + echo ' usb start' + echo ' fatload ${bootdev} 0x20800000 boot.scr && autoscr 0x20800000' + echo '' + echo 'Boot from eMMC:' + echo ' setenv bootdev "mmc 1"' + echo ' fatload ${bootdev} 0x20800000 boot.scr && autoscr 0x20800000' + echo '==============================================================' + exit 22 fi echo "Try to boot from ${bootdev}" fatload ${bootdev} 0x20800000 /armbianEnv.txt && env import -t 0x20800000 ${filesize} -test -n "${consoleargs}" || setenv consoleargs "console=ttyAML0,115200n8" + +if test -n "${rootdev}"; test $? != 0; then + echo 'Please set "rootdev" before calling this script' + echo 'or set it in armbianEnv.txt.' + exit 22 +fi + +if test -n "${consoleargs}"; test $? != 0; then + test -n "${console}" || setenv console "both" + + setenv consoleargs "" + # Due to https://github.com/systemd/systemd/issues/9899, only the last + # console will be the primary console (/dev/console) which is the + # only console the initramfs shell and the systemd log use. + # So when set "both", we use serial console as the primary console. + test "${console}" = "display" || test "${console}" = "both" && setenv consoleargs "${consoleargs} console=tty1" + test "${console}" = "serial" || test "${console}" = "both" && setenv consoleargs "${consoleargs} console=ttyAML0,115200n8" + setenv consoleargs "${consoleargs} no_console_suspend consoleblank=0" +fi # Boot Arguments setenv bootargs "" setenv bootargs "${bootargs} root=${rootdev} rootwait rw" -setenv bootargs "${bootargs} ${consoleargs} no_console_suspend consoleblank=0" +setenv bootargs "${bootargs} ${consoleargs}" +setenv bootargs "${bootargs} ${extraargs}" # Booting fatload ${bootdev} 0x20800000 /uImage || exit 1 diff --git a/config/sources/families/include/meson_common.inc b/config/sources/families/include/meson_common.inc index 27098b696..d4eb6e210 100644 --- a/config/sources/families/include/meson_common.inc +++ b/config/sources/families/include/meson_common.inc @@ -1,18 +1,29 @@ ARCH=armhf -BOOTSOURCE='https://github.com/hardkernel/u-boot.git' -BOOTBRANCH='branch:odroidc-v2011.03' -BOOTDIR='u-boot-odroidc1' -UBOOT_COMPILER="arm-linux-gnueabihf-" -UBOOT_USE_GCC='< 4.9' -SERIALCON="ttyAML0" -UBOOT_TARGET_MAP=';;sd_fuse/bl1.bin.hardkernel sd_fuse/u-boot.bin' -SRC_LOADADDR='LOADADDR=0x00208000' -KERNEL_IMAGE_TYPE=uImage LINUXFAMILY=meson +KERNEL_IMAGE_TYPE=uImage +SRC_LOADADDR='LOADADDR=0x00208000' + +SERIALCON="ttyAML0" + CPUMIN=504000 CPUMAX=1632000 GOVERNOR=ondemand +case $BOARD in + odroidc1) + + BOOTDIR='u-boot-odroidc1' + BOOTSOURCE='https://github.com/hardkernel/u-boot.git' + BOOTBRANCH='branch:odroidc-v2011.03' + + UBOOT_COMPILER="arm-linux-gnueabihf-" + UBOOT_USE_GCC='< 4.9' + + UBOOT_TARGET_MAP=';;sd_fuse/bl1.bin.hardkernel sd_fuse/u-boot.bin' + + ;; +esac + case $BRANCH in legacy) @@ -40,19 +51,6 @@ case $BRANCH in ;; esac -case $BOARD in - odroidc1) - - BOOTSCRIPT="boot-odroid-c1.ini:boot.ini" - - ;; - onecloud) - - BOOTSCRIPT="boot-onecloud.cmd:boot.cmd" - - ;; -esac - write_uboot_platform() { dd if=$1/bl1.bin.hardkernel of=$2 bs=1 count=442 conv=fsync > /dev/null 2>&1 diff --git a/patch/kernel/archive/meson-5.14/board_onecloud/add-dts.patch b/patch/kernel/archive/meson-5.14/board_onecloud/add-dts.patch index f644e4fdb..36362d6b3 100644 --- a/patch/kernel/archive/meson-5.14/board_onecloud/add-dts.patch +++ b/patch/kernel/archive/meson-5.14/board_onecloud/add-dts.patch @@ -2,8 +2,8 @@ Add dts --- arch/arm/boot/dts/Makefile | 1 + - arch/arm/boot/dts/meson8b-onecloud.dts | 405 +++++++++++++++++++++++++ - 2 files changed, 406 insertions(+) + arch/arm/boot/dts/meson8b-onecloud.dts | 402 +++++++++++++++++++++++++ + 2 files changed, 403 insertions(+) create mode 100644 arch/arm/boot/dts/meson8b-onecloud.dts diff --git a/arch/arm/boot/dts/Makefile b/arch/arm/boot/dts/Makefile @@ -20,10 +20,10 @@ index 863347b6b..0b50bfb6f 100644 pxa168-aspenite.dtb \ diff --git a/arch/arm/boot/dts/meson8b-onecloud.dts b/arch/arm/boot/dts/meson8b-onecloud.dts new file mode 100644 -index 000000000..23454ffe1 +index 000000000..d517e45e2 --- /dev/null +++ b/arch/arm/boot/dts/meson8b-onecloud.dts -@@ -0,0 +1,405 @@ +@@ -0,0 +1,402 @@ +// SPDX-License-Identifier: GPL-2.0-only +/* + * Author: hzyitc @@ -170,25 +170,22 @@ index 000000000..23454ffe1 + + regulator-name = "VCC_CORE"; + -+ // +------------------------------------------+ -+ // | The actual mapping in phyical | -+ // +------+--------+--------+--------+--------+ -+ // | | 100% | 60% | 30% | 0% | -+ // +------+--------+--------+--------+--------+ -+ // | V1.0 | 677mV | 857mV | 992mV | 1127mV | -+ // | V1.3 | 1116mV | 1121mV | 1125mV | 1129mV | -+ // +------+--------+--------+--------+--------+ ++ // +---------------------------------------------------+ ++ // | The actual mapping in phyical | ++ // +------+--------+--------+--------+--------+--------+ ++ // | | 100% | 60% | 30% | 10% | 0% | ++ // +------+--------+--------+--------+--------+--------+ ++ // | V1.0 | 677mV | 857mV | 992mV | 1082mV | 1127mV | ++ // | V1.3 | 1116mV | 1121mV | 1125mV | 1128mV | 1129mV | ++ // +------+--------+--------+--------+--------+--------+ + // -+ // According to meson8b.dtsi, the CPU should be able -+ // to run at 504MHz with 870mV. But according to my -+ // test on V1.0, the system will crash in this case. -+ // -+ // And this regulator supplies not only CPU but also GPU. -+ // -+ // So we use higher voltages. ++ // According to meson8b.dtsi, the CPU should be able to ++ // run at 504MHz with 870mV. But this regulator supplies ++ // not only CPU but also GPU. And according to the users' ++ // tests on V1.0, we need such higher voltages. + + pwms = <&pwm_cd 1 12001 0>; // PWM_D -+ pwm-dutycycle-range = <30 0>; ++ pwm-dutycycle-range = <10 0>; + regulator-min-microvolt = <860000>; + regulator-max-microvolt = <1140000>; + diff --git a/patch/kernel/archive/meson-5.18/board_onecloud/0001-add-dts.patch b/patch/kernel/archive/meson-5.18/board_onecloud/0001-add-dts.patch index b06bc006e..6c5e9d7b1 100644 --- a/patch/kernel/archive/meson-5.18/board_onecloud/0001-add-dts.patch +++ b/patch/kernel/archive/meson-5.18/board_onecloud/0001-add-dts.patch @@ -2,8 +2,8 @@ Add dts --- arch/arm/boot/dts/Makefile | 1 + - arch/arm/boot/dts/meson8b-onecloud.dts | 405 +++++++++++++++++++++++++ - 2 files changed, 406 insertions(+) + arch/arm/boot/dts/meson8b-onecloud.dts | 402 +++++++++++++++++++++++++ + 2 files changed, 403 insertions(+) create mode 100644 arch/arm/boot/dts/meson8b-onecloud.dts diff --git a/arch/arm/boot/dts/Makefile b/arch/arm/boot/dts/Makefile @@ -20,10 +20,10 @@ index e802f817e3a..51206ea5d3e 100644 meson8m2-m8s.dtb \ diff --git a/arch/arm/boot/dts/meson8b-onecloud.dts b/arch/arm/boot/dts/meson8b-onecloud.dts new file mode 100644 -index 00000000000..23454ffe145 +index 00000000000..d517e45e22b --- /dev/null +++ b/arch/arm/boot/dts/meson8b-onecloud.dts -@@ -0,0 +1,405 @@ +@@ -0,0 +1,402 @@ +// SPDX-License-Identifier: GPL-2.0-only +/* + * Author: hzyitc @@ -170,25 +170,22 @@ index 00000000000..23454ffe145 + + regulator-name = "VCC_CORE"; + -+ // +------------------------------------------+ -+ // | The actual mapping in phyical | -+ // +------+--------+--------+--------+--------+ -+ // | | 100% | 60% | 30% | 0% | -+ // +------+--------+--------+--------+--------+ -+ // | V1.0 | 677mV | 857mV | 992mV | 1127mV | -+ // | V1.3 | 1116mV | 1121mV | 1125mV | 1129mV | -+ // +------+--------+--------+--------+--------+ ++ // +---------------------------------------------------+ ++ // | The actual mapping in phyical | ++ // +------+--------+--------+--------+--------+--------+ ++ // | | 100% | 60% | 30% | 10% | 0% | ++ // +------+--------+--------+--------+--------+--------+ ++ // | V1.0 | 677mV | 857mV | 992mV | 1082mV | 1127mV | ++ // | V1.3 | 1116mV | 1121mV | 1125mV | 1128mV | 1129mV | ++ // +------+--------+--------+--------+--------+--------+ + // -+ // According to meson8b.dtsi, the CPU should be able -+ // to run at 504MHz with 870mV. But according to my -+ // test on V1.0, the system will crash in this case. -+ // -+ // And this regulator supplies not only CPU but also GPU. -+ // -+ // So we use higher voltages. ++ // According to meson8b.dtsi, the CPU should be able to ++ // run at 504MHz with 870mV. But this regulator supplies ++ // not only CPU but also GPU. And according to the users' ++ // tests on V1.0, we need such higher voltages. + + pwms = <&pwm_cd 1 12001 0>; // PWM_D -+ pwm-dutycycle-range = <30 0>; ++ pwm-dutycycle-range = <10 0>; + regulator-min-microvolt = <860000>; + regulator-max-microvolt = <1140000>; +