console cleanup
PATCH v2 1/1 console cleanup
Consolidate all the various console definitions to the common conf/machine/include/rockchip-defaults.inc file and create RK_CONSOLE_BAUD and RK_CONSOLE_DEVICE variables that can be reused in the wks files.
The following variables were checked before and after this patch to make sure they are sensible:
- SERIAL_CONSOLES
- RK_CONSOLE_DEVICE
- RK_CONSOLE_BAUD
A boot test was performed on the following boards to make sure they all continue to boot to a cmdline:
- tinker-board
- rock-pi-e
- nanopi-m4-2gb
- rock64
- rock-pi-4b
---
Changes from v1:
- In v1 I defined RK_CONSOLE_BAUD and RK_CONSOLE_DEVICE for each MACHINE and then redefined SERIAL_CONSOLES to be the concatenation of these two variables. Khem pointed out this is a bad approach because I'm redefining an oe-core-defined variable that all BSPs expect.
- In v2 I set/consolidate SERIAL_CONSOLES for each MACHINE and then generate RK_CONSOLE_BAUD and RK_CONSOLE_DEVICE based on the first-defined <baud>;<device> pair found in SERIAL_CONSOLES; these generated variables are then used in the wks files.
--- conf/machine/include/nanopi-m4.inc | 2 -- conf/machine/include/rk3066.inc | 2 ++ conf/machine/include/rk3188.inc | 2 ++ conf/machine/include/rk3288.inc | 4 ++-- conf/machine/include/rk3328.inc | 2 -- conf/machine/include/rk3399.inc | 2 -- conf/machine/include/rock-pi-4.inc | 2 -- conf/machine/include/rockchip-defaults.inc | 12 +++++++++++- conf/machine/marsboard-rk3066.conf | 1 - conf/machine/radxarock.conf | 1 - wic/firefly-rk3288.wks | 2 +- wic/rock-pi-4.wks | 2 +- wic/rock-pi-e.wks | 2 +- wic/tinker-board.wks | 2 +- wic/vyasa-rk3288.wks | 2 +- 15 files changed, 22 insertions(+), 18 deletions(-)
conf/machine/include/nanopi-m4.inc +0 -2
@@ -21,5 +21,3 @@ WKS_FILE_DEPENDS ?= " \ IMAGE_BOOT_FILES ?= "\ ${KERNEL_IMAGETYPE} \ " - -SERIAL_CONSOLES = "1500000;ttyS2"
conf/machine/include/rk3066.inc +2 -0
@@ -7,5 +7,7 @@ require conf/machine/include/tune-cortexa9.inc require conf/machine/include/soc-family.inc require conf/machine/include/rockchip-defaults.inc +SERIAL_CONSOLES = "115200;ttyS2" + KBUILD_DEFCONFIG = "multi_v7_defconfig" KERNEL_IMAGETYPE = "zImage"
conf/machine/include/rk3188.inc +2 -0
@@ -7,5 +7,7 @@ require conf/machine/include/tune-cortexa9.inc require conf/machine/include/soc-family.inc require conf/machine/include/rockchip-defaults.inc +SERIAL_CONSOLES = "115200;ttyFIQ0" + KBUILD_DEFCONFIG = "multi_v7_defconfig" KERNEL_IMAGETYPE = "zImage"
conf/machine/include/rk3288.inc +2 -2
@@ -7,11 +7,11 @@ require conf/machine/include/tune-cortexa17.inc require conf/machine/include/soc-family.inc require conf/machine/include/rockchip-defaults.inc +SERIAL_CONSOLES = "115200;ttyS2" + KBUILD_DEFCONFIG ?= "multi_v7_defconfig" KERNEL_IMAGETYPE = "zImage" -SERIAL_CONSOLES = "115200;ttyS2" - PREFERRED_PROVIDER_virtual/bootloader ?= "u-boot" SPL_BINARY ?= "idbloader.img"
conf/machine/include/rk3328.inc +0 -2
@@ -19,7 +19,5 @@ TFA_BUILD_TARGET = "bl31" UBOOT_SUFFIX ?= "itb" UBOOT_ENTRYPOINT ?= "0x06000000" -SERIAL_CONSOLES = "1500000;ttyS2" - PREFERRED_PROVIDER_virtual/bootloader ?= "u-boot" SPL_BINARY ?= "idbloader.img"
conf/machine/include/rk3399.inc +0 -2
@@ -19,8 +19,6 @@ TFA_BUILD_TARGET = "bl31" UBOOT_SUFFIX ?= "itb" UBOOT_ENTRYPOINT ?= "0x06000000" -SERIAL_CONSOLES = "115200;ttyS2" - PREFERRED_PROVIDER_virtual/bootloader ?= "u-boot" SPL_BINARY ?= "idbloader.img"
conf/machine/include/rock-pi-4.inc +0 -2
@@ -17,6 +17,4 @@ IMAGE_BOOT_FILES ?= "\ ${KERNEL_IMAGETYPE} \ " -SERIAL_CONSOLES = "1500000;ttyS2" - MACHINE_EXTRA_RRECOMMENDS += "kernel-modules"
conf/machine/include/rockchip-defaults.inc +11 -1
@@ -21,9 +21,19 @@ XSERVER = " \ " # misc +SERIAL_CONSOLES ?= "1500000;ttyS2" IMAGE_FSTYPES += "ext4" +# use the first-defined <baud>;<device> pair in SERIAL_CONSOLES +# for the console parameter in the wks files +RK_CONSOLE_BAUD ?= "${@d.getVar('SERIAL_CONSOLES').split(';')[0]}" +RK_CONSOLE_DEVICE ?= "${@d.getVar('SERIAL_CONSOLES').split(';')[1].split()[0]}" + # boot device (sd-card/emmc) RK_BOOT_DEVICE ??= "mmcblk0" -WICVARS_append = " RK_BOOT_DEVICE" +WICVARS_append = " \ + RK_BOOT_DEVICE \ + RK_CONSOLE_BAUD \ + RK_CONSOLE_DEVICE \ + "
conf/machine/marsboard-rk3066.conf +0 -1
@@ -8,5 +8,4 @@ require conf/machine/include/rk3066.inc -SERIAL_CONSOLES = "115200;ttyS2" KERNEL_DEVICETREE = "rk3066a-marsboard.dtb"
conf/machine/radxarock.conf +0 -1
@@ -9,5 +9,4 @@ require conf/machine/include/rk3188.inc -SERIAL_CONSOLES = "115200;ttyFIQ0" KERNEL_DEVICETREE = "rk3188-radxarock.dtb"
wic/firefly-rk3288.wks +1 -1
@@ -4,4 +4,4 @@ include rk3288-boot.wks part / --ondisk ${RK_BOOT_DEVICE} --source rootfs --fstype=ext4 --label root -bootloader --ptable gpt --append="console=tty1 console=ttyS2,115200n8 rw root=/dev/${RK_BOOT_DEVICE}p7 rootfstype=ext4 init=/sbin/init" +bootloader --ptable gpt --append="console=tty1 console=${RK_CONSOLE_DEVICE},${RK_CONSOLE_BAUD}n8 rw root=/dev/${RK_BOOT_DEVICE}p7 rootfstype=ext4 init=/sbin/init"
wic/rock-pi-4.wks +1 -1
@@ -4,4 +4,4 @@ include rk3399-boot.wks part / --ondisk ${RK_BOOT_DEVICE} --source rootfs --fstype=ext4 --label root -bootloader --ptable gpt --append="console=tty1 console=ttyS2,1500000n8 rw root=/dev/${RK_BOOT_DEVICE}p7 rootfstype=ext4 init=/sbin/init" +bootloader --ptable gpt --append="console=tty1 console=${RK_CONSOLE_DEVICE},${RK_CONSOLE_BAUD}n8 rw root=/dev/${RK_BOOT_DEVICE}p7 rootfstype=ext4 init=/sbin/init"
wic/rock-pi-e.wks +1 -1
@@ -1,4 +1,4 @@ include rk3328-boot.wks part / --ondisk ${RK_BOOT_DEVICE} --source rootfs --fstype=ext4 --label root -bootloader --ptable gpt --append="console=tty1 console=ttyS2,1500000n8 rw root=/dev/${RK_BOOT_DEVICE}p7 rootfstype=ext4 init=/sbin/init" +bootloader --ptable gpt --append="console=tty1 console=${RK_CONSOLE_DEVICE},${RK_CONSOLE_BAUD}n8 rw root=/dev/${RK_BOOT_DEVICE}p7 rootfstype=ext4 init=/sbin/init"
wic/tinker-board.wks +1 -1
@@ -5,4 +5,4 @@ include rk3288-boot.wks part / --ondisk ${RK_BOOT_DEVICE} --source rootfs --fstype=ext4 --label root -bootloader --ptable gpt --append="console=tty1 console=ttyS2,115200n8 rw root=/dev/${RK_BOOT_DEVICE}p7 rootfstype=ext4 init=/sbin/init" +bootloader --ptable gpt --append="console=tty1 console=${RK_CONSOLE_DEVICE},${RK_CONSOLE_BAUD}n8 rw root=/dev/${RK_BOOT_DEVICE}p7 rootfstype=ext4 init=/sbin/init"
wic/vyasa-rk3288.wks +1 -1
@@ -4,5 +4,5 @@ include rk3288-boot.wks part / --ondisk ${RK_BOOT_DEVICE} --source rootfs --fstype=ext4 --label root -bootloader --ptable gpt --append="console=tty1 console=ttyS2,115200n8 rw root=/dev/${RK_BOOT_DEVICE}p7 rootfstype=ext4 init=/sbin/init" +bootloader --ptable gpt --append="console=tty1 console=${RK_CONSOLE_DEVICE},${RK_CONSOLE_BAUD}n8 rw root=/dev/${RK_BOOT_DEVICE}p7 rootfstype=ext4 init=/sbin/init"
Signature · 1 line
2.30.0.rc0
Quoted 11 lines · Trevor Woerner
Consolidate all the various console definitions to the common conf/machine/include/rockchip-defaults.inc file and create
RK_CONSOLE_BAUDandRK_CONSOLE_DEVICEvariables that can be reused in the wks files.The following variables were checked before and after this patch to make sure they are sensible:
-SERIAL_CONSOLES
-RK_CONSOLE_DEVICE
-RK_CONSOLE_BAUD
Quoted 7 lines
A boot test was performed on the following boards to make sure they all continue to boot to a cmdline:
- tinker-board
- rock-pi-e
- nanopi-m4-2gb
- rock64
- rock-pi-4b
This version looks good to me.
Quoted 220 lines
Signed-off-by Trevor Woerner <[email protected]>---
Changes from v1:
- In v1 I definedRK_CONSOLE_BAUDandRK_CONSOLE_DEVICEfor each MACHINE and then redefinedSERIAL_CONSOLESto be the concatenation of these two variables. Khem pointed out this is a bad approach because I'm redefining an oe-core-defined variable that all BSPs expect.
- In v2 I set/consolidateSERIAL_CONSOLESfor each MACHINE and then generateRK_CONSOLE_BAUDandRK_CONSOLE_DEVICEbased on the first-defined <baud>;<device> pair found inSERIAL_CONSOLES; these generated variables are then used in the wks files.--- conf/machine/include/nanopi-m4.inc | 2 -- conf/machine/include/rk3066.inc | 2 ++ conf/machine/include/rk3188.inc | 2 ++ conf/machine/include/rk3288.inc | 4 ++-- conf/machine/include/rk3328.inc | 2 -- conf/machine/include/rk3399.inc | 2 -- conf/machine/include/rock-pi-4.inc | 2 -- conf/machine/include/rockchip-defaults.inc | 12 +++++++++++- conf/machine/marsboard-rk3066.conf | 1 - conf/machine/radxarock.conf | 1 - wic/firefly-rk3288.wks | 2 +- wic/rock-pi-4.wks | 2 +- wic/rock-pi-e.wks | 2 +- wic/tinker-board.wks | 2 +- wic/vyasa-rk3288.wks | 2 +- 15 files changed, 22 insertions(+), 18 deletions(-)conf/machine/include/nanopi-m4.inc +0
-2@@ -21,5 +21,3 @@ WKS_FILE_DEPENDS ?= " \ IMAGE_BOOT_FILES ?= "\ ${KERNEL_IMAGETYPE} \ " - -SERIAL_CONSOLES = "1500000;ttyS2"conf/machine/include/rk3066.inc +2
-0@@ -7,5 +7,7 @@ require conf/machine/include/tune-cortexa9.inc require conf/machine/include/soc-family.inc require conf/machine/include/rockchip-defaults.inc +SERIAL_CONSOLES = "115200;ttyS2" + KBUILD_DEFCONFIG = "multi_v7_defconfig" KERNEL_IMAGETYPE = "zImage"conf/machine/include/rk3188.inc +2
-0@@ -7,5 +7,7 @@ require conf/machine/include/tune-cortexa9.inc require conf/machine/include/soc-family.inc require conf/machine/include/rockchip-defaults.inc +SERIAL_CONSOLES = "115200;ttyFIQ0" + KBUILD_DEFCONFIG = "multi_v7_defconfig" KERNEL_IMAGETYPE = "zImage"conf/machine/include/rk3288.inc +2
-2@@ -7,11 +7,11 @@ require conf/machine/include/tune-cortexa17.inc require conf/machine/include/soc-family.inc require conf/machine/include/rockchip-defaults.inc +SERIAL_CONSOLES = "115200;ttyS2" + KBUILD_DEFCONFIG ?= "multi_v7_defconfig" KERNEL_IMAGETYPE = "zImage" -SERIAL_CONSOLES = "115200;ttyS2" - PREFERRED_PROVIDER_virtual/bootloader ?= "u-boot" SPL_BINARY ?= "idbloader.img"conf/machine/include/rk3328.inc +0
-2@@ -19,7 +19,5 @@ TFA_BUILD_TARGET = "bl31" UBOOT_SUFFIX ?= "itb" UBOOT_ENTRYPOINT ?= "0x06000000" -SERIAL_CONSOLES = "1500000;ttyS2" - PREFERRED_PROVIDER_virtual/bootloader ?= "u-boot" SPL_BINARY ?= "idbloader.img"conf/machine/include/rk3399.inc +0
-2@@ -19,8 +19,6 @@ TFA_BUILD_TARGET = "bl31" UBOOT_SUFFIX ?= "itb" UBOOT_ENTRYPOINT ?= "0x06000000" -SERIAL_CONSOLES = "115200;ttyS2" - PREFERRED_PROVIDER_virtual/bootloader ?= "u-boot" SPL_BINARY ?= "idbloader.img"conf/machine/include/rock-pi-4.inc +0
-2@@ -17,6 +17,4 @@ IMAGE_BOOT_FILES ?= "\ ${KERNEL_IMAGETYPE} \ " -SERIAL_CONSOLES = "1500000;ttyS2" - MACHINE_EXTRA_RRECOMMENDS += "kernel-modules"conf/machine/include/rockchip-defaults.inc +11
-1@@ -21,9 +21,19 @@ XSERVER = " \ " # misc +SERIAL_CONSOLES ?= "1500000;ttyS2" IMAGE_FSTYPES += "ext4" +# use the first-defined <baud>;<device> pair in SERIAL_CONSOLES +# for the console parameter in the wks files +RK_CONSOLE_BAUD ?= "${@d.getVar('SERIAL_CONSOLES').split(';')[0]}" +RK_CONSOLE_DEVICE ?= "${@d.getVar('SERIAL_CONSOLES').split(';')[1].split()[0]}" + # boot device (sd-card/emmc) RK_BOOT_DEVICE ??= "mmcblk0" -WICVARS_append = " RK_BOOT_DEVICE" +WICVARS_append = " \ + RK_BOOT_DEVICE \ + RK_CONSOLE_BAUD \ + RK_CONSOLE_DEVICE \ + "conf/machine/marsboard-rk3066.conf +0
-1@@ -8,5 +8,4 @@ require conf/machine/include/rk3066.inc -SERIAL_CONSOLES = "115200;ttyS2" KERNEL_DEVICETREE = "rk3066a-marsboard.dtb"conf/machine/radxarock.conf +0
-1@@ -9,5 +9,4 @@ require conf/machine/include/rk3188.inc -SERIAL_CONSOLES = "115200;ttyFIQ0" KERNEL_DEVICETREE = "rk3188-radxarock.dtb"wic/firefly-rk3288.wks +1
-1@@ -4,4 +4,4 @@ include rk3288-boot.wks part / --ondisk ${RK_BOOT_DEVICE} --source rootfs --fstype=ext4 --label root -bootloader --ptable gpt --append="console=tty1 console=ttyS2,115200n8 rw root=/dev/${RK_BOOT_DEVICE}p7 rootfstype=ext4 init=/sbin/init" +bootloader --ptable gpt --append="console=tty1 console=${RK_CONSOLE_DEVICE},${RK_CONSOLE_BAUD}n8 rw root=/dev/${RK_BOOT_DEVICE}p7 rootfstype=ext4 init=/sbin/init"wic/rock-pi-4.wks +1
-1@@ -4,4 +4,4 @@ include rk3399-boot.wks part / --ondisk ${RK_BOOT_DEVICE} --source rootfs --fstype=ext4 --label root -bootloader --ptable gpt --append="console=tty1 console=ttyS2,1500000n8 rw root=/dev/${RK_BOOT_DEVICE}p7 rootfstype=ext4 init=/sbin/init" +bootloader --ptable gpt --append="console=tty1 console=${RK_CONSOLE_DEVICE},${RK_CONSOLE_BAUD}n8 rw root=/dev/${RK_BOOT_DEVICE}p7 rootfstype=ext4 init=/sbin/init"wic/rock-pi-e.wks +1
-1@@ -1,4 +1,4 @@ include rk3328-boot.wks part / --ondisk ${RK_BOOT_DEVICE} --source rootfs --fstype=ext4 --label root -bootloader --ptable gpt --append="console=tty1 console=ttyS2,1500000n8 rw root=/dev/${RK_BOOT_DEVICE}p7 rootfstype=ext4 init=/sbin/init" +bootloader --ptable gpt --append="console=tty1 console=${RK_CONSOLE_DEVICE},${RK_CONSOLE_BAUD}n8 rw root=/dev/${RK_BOOT_DEVICE}p7 rootfstype=ext4 init=/sbin/init"wic/tinker-board.wks +1
-1@@ -5,4 +5,4 @@ include rk3288-boot.wks part / --ondisk ${RK_BOOT_DEVICE} --source rootfs --fstype=ext4 --label root -bootloader --ptable gpt --append="console=tty1 console=ttyS2,115200n8 rw root=/dev/${RK_BOOT_DEVICE}p7 rootfstype=ext4 init=/sbin/init" +bootloader --ptable gpt --append="console=tty1 console=${RK_CONSOLE_DEVICE},${RK_CONSOLE_BAUD}n8 rw root=/dev/${RK_BOOT_DEVICE}p7 rootfstype=ext4 init=/sbin/init"wic/vyasa-rk3288.wks +1
-1@@ -4,5 +4,5 @@ include rk3288-boot.wks part / --ondisk ${RK_BOOT_DEVICE} --source rootfs --fstype=ext4 --label root -bootloader --ptable gpt --append="console=tty1 console=ttyS2,115200n8 rw root=/dev/${RK_BOOT_DEVICE}p7 rootfstype=ext4 init=/sbin/init" +bootloader --ptable gpt --append="console=tty1 console=${RK_CONSOLE_DEVICE},${RK_CONSOLE_BAUD}n8 rw root=/dev/${RK_BOOT_DEVICE}p7 rootfstype=ext4 init=/sbin/init"
Quoted 1 line · Khem Raj
This version looks good to me.
Thanks, I appreciate your feedback.
Trevor Woerner
AppliedQuoted 20 lines · Trevor Woerner
Consolidate all the various console definitions to the common conf/machine/include/rockchip-defaults.inc file and create
RK_CONSOLE_BAUDandRK_CONSOLE_DEVICEvariables that can be reused in the wks files.The following variables were checked before and after this patch to make sure they are sensible:
-SERIAL_CONSOLES
-RK_CONSOLE_DEVICE
-RK_CONSOLE_BAUDA boot test was performed on the following boards to make sure they all continue to boot to a cmdline:
- tinker-board
- rock-pi-e
- nanopi-m4-2gb
- rock64
- rock-pi-4bSigned-off-by Trevor Woerner <[email protected]>
Quoted 10 lines
---
Changes from v1:
- In v1 I definedRK_CONSOLE_BAUDandRK_CONSOLE_DEVICEfor each MACHINE and then redefinedSERIAL_CONSOLESto be the concatenation of these two variables. Khem pointed out this is a bad approach because I'm redefining an oe-core-defined variable that all BSPs expect.
- In v2 I set/consolidateSERIAL_CONSOLESfor each MACHINE and then generateRK_CONSOLE_BAUDandRK_CONSOLE_DEVICEbased on the first-defined <baud>;<device> pair found inSERIAL_CONSOLES; these generated variables are then used in the wks files.
Applied to meta-rockchip master.