On Mon 2020-02-10 @ 06:25:22 PM, Sergey Bostandzhyan wrote:
> From: Sergey 'Jin' Bostandzhyan <[email protected]>
> 
> wic modifies /etc/fstab on the root file system during image generation,
> without the --ondisk parameter it assumes some default device name which
> leads to an /etc/fstab file populated with /dev/sda entries.
> This is not correct for the machines in the rockchip layer which use
> mmcblkX.
> 
> This patch introduces an RK_BOOT_DEVICE option which is being set in the
> machine configuratoin and which is being used in the wks files.
> The variable expansion in the wks is handled by propagating the variable to
> the wic environment.
> 
> This results in correct /etc/fstab entries and in a correct kernel
> bootargs root= parameter.
> 
> Signed-off-by: Sergey Bostandzhyan <[email protected]>
> ---
>  conf/machine/include/rk3288.inc            |  1 -
>  conf/machine/include/rockchip-defaults.inc |  5 +++++
>  conf/machine/rock-pi-4.conf                |  1 +
>  conf/machine/vyasa-rk3288.conf             |  1 +
>  wic/firefly-rk3288.wks                     |  4 ++--
>  wic/rk3288-boot.wks                        | 12 ++++++------
>  wic/rk3399-boot.wks                        | 12 ++++++------
>  wic/rock-pi-4.wks                          |  4 ++--
>  wic/tinker-board.wks                       |  5 +++--
>  wic/vyasa-rk3288.wks                       |  4 ++--
>  10 files changed, 28 insertions(+), 21 deletions(-)
> 
> diff --git a/conf/machine/include/rk3288.inc b/conf/machine/include/rk3288.inc
> index a7edac5..3504f10 100644
> --- a/conf/machine/include/rk3288.inc
> +++ b/conf/machine/include/rk3288.inc
> @@ -14,4 +14,3 @@ SERIAL_CONSOLES = "115200;ttyS2"
>  
>  PREFERRED_PROVIDER_virtual/bootloader ?= "u-boot"
>  SPL_BINARY ?= "idbloader.img"
> -

The above looks like a whitespace change? Can you send a v2 without it,
otherwise I can remove it when applying.

Otherwise this patch looks good to me.

> diff --git a/conf/machine/include/rockchip-defaults.inc 
> b/conf/machine/include/rockchip-defaults.inc
> index 0507017..82fd590 100644
> --- a/conf/machine/include/rockchip-defaults.inc
> +++ b/conf/machine/include/rockchip-defaults.inc
> @@ -21,3 +21,8 @@ XSERVER = " \
>  
>  # misc
>  IMAGE_FSTYPES += "ext4"
> +
> +# boot device (sd-card/emmc)
> +RK_BOOT_DEVICE ??= "mmcblk0"
> +WICVARS_append = " RK_BOOT_DEVICE"
> +
> diff --git a/conf/machine/rock-pi-4.conf b/conf/machine/rock-pi-4.conf
> index 4a0671c..5231abf 100644
> --- a/conf/machine/rock-pi-4.conf
> +++ b/conf/machine/rock-pi-4.conf
> @@ -10,6 +10,7 @@ require conf/machine/include/rk3399.inc
>  KERNEL_DEVICETREE = "rockchip/rk3399-rock-pi-4.dtb"
>  UBOOT_MACHINE = "rock-pi-4-rk3399_defconfig"
>  
> +RK_BOOT_DEVICE = "mmcblk1"
>  WKS_FILE ?= "rock-pi-4.wks"
>  IMAGE_FSTYPES += "wic wic.bmap"
>  
> diff --git a/conf/machine/vyasa-rk3288.conf b/conf/machine/vyasa-rk3288.conf
> index d8a6af6..1e1eba4 100644
> --- a/conf/machine/vyasa-rk3288.conf
> +++ b/conf/machine/vyasa-rk3288.conf
> @@ -13,6 +13,7 @@ KERNEL_EXTRA_ARGS += "LOADADDR=0x02000000"
>  
>  UBOOT_MACHINE = "vyasa-rk3288_defconfig"
>  
> +RK_BOOT_DEVICE = "mmcblk2"
>  WKS_FILE = "vyasa-rk3288.wks"
>  IMAGE_FSTYPES += "wic wic.bmap"
>  
> diff --git a/wic/firefly-rk3288.wks b/wic/firefly-rk3288.wks
> index c2027bd..b60aa0e 100644
> --- a/wic/firefly-rk3288.wks
> +++ b/wic/firefly-rk3288.wks
> @@ -2,6 +2,6 @@
>  # Released under the MIT license (see COPYING.MIT for the terms)
>  
>  include rk3288-boot.wks
> -part / --align 131072 --source rootfs --fstype=ext4 --label root
> +part / --align 131072 --ondisk ${RK_BOOT_DEVICE} --source rootfs 
> --fstype=ext4 --label root
>  
> -bootloader --ptable gpt --append="console=tty1 console=ttyS2,115200n8 rw 
> root=/dev/mmcblk0p7 rootfstype=ext4 init=/sbin/init"
> +bootloader --ptable gpt --append="console=tty1 console=ttyS2,115200n8 rw 
> root=/dev/${RK_BOOT_DEVICE}p7 rootfstype=ext4 init=/sbin/init"
> diff --git a/wic/rk3288-boot.wks b/wic/rk3288-boot.wks
> index 53c8162..c0b7d95 100644
> --- a/wic/rk3288-boot.wks
> +++ b/wic/rk3288-boot.wks
> @@ -15,10 +15,10 @@
>  #   root        262144          -
>  #
>  
> -part loader1    --align 32     --size 4000K            --source rawcopy 
> --sourceparams="file=idbloader.img"
> -part reserved1  --align 4032   --size 64K
> -part reserved2  --align 4096   --size 4096K
> -part loader2    --align 8192   --size 4096K            --source rawcopy 
> --sourceparams="file=u-boot.bin"
> -part atf        --align 12288  --size 4096K
> -part /boot      --align 16384  --size=114688K --active --source 
> bootimg-partition --fstype=vfat --label boot --sourceparams="loader=u-boot"
> +part loader1    --align 32     --size 4000K            --ondisk 
> ${RK_BOOT_DEVICE} --source rawcopy --sourceparams="file=idbloader.img"
> +part reserved1  --align 4032   --size 64K              --ondisk 
> ${RK_BOOT_DEVICE}
> +part reserved2  --align 4096   --size 4096K            --ondisk 
> ${RK_BOOT_DEVICE}
> +part loader2    --align 8192   --size 4096K            --ondisk 
> ${RK_BOOT_DEVICE} --source rawcopy --sourceparams="file=u-boot.bin"
> +part atf        --align 12288  --size 4096K            --ondisk 
> ${RK_BOOT_DEVICE}
> +part /boot      --align 16384  --size=114688K --active --ondisk 
> ${RK_BOOT_DEVICE} --source bootimg-partition --fstype=vfat --label boot 
> --sourceparams="loader=u-boot"
>  
> diff --git a/wic/rk3399-boot.wks b/wic/rk3399-boot.wks
> index 100b94d..885d46b 100644
> --- a/wic/rk3399-boot.wks
> +++ b/wic/rk3399-boot.wks
> @@ -15,10 +15,10 @@
>  #   root        262144          -
>  #
>  
> -part loader1    --align 32     --size 4000K            --source rawcopy 
> --sourceparams="file=idbloader.img"
> -part reserved1  --align 4032   --size 64K
> -part reserved2  --align 4096   --size 4096K
> -part loader2    --align 8192   --size 4096K            --source rawcopy 
> --sourceparams="file=u-boot.itb"
> -part atf        --align 12288  --size 4096K
> -part /boot      --align 16384  --size=114688K --active --source 
> bootimg-partition --fstype=vfat --label boot --sourceparams="loader=u-boot"
> +part loader1    --align 32     --size 4000K            --ondisk 
> ${RK_BOOT_DEVICE} --source rawcopy --sourceparams="file=idbloader.img"
> +part reserved1  --align 4032   --size 64K              --ondisk 
> ${RK_BOOT_DEVICE}
> +part reserved2  --align 4096   --size 4096K            --ondisk 
> ${RK_BOOT_DEVICE}
> +part loader2    --align 8192   --size 4096K            --ondisk 
> ${RK_BOOT_DEVICE} --source rawcopy --sourceparams="file=u-boot.itb"
> +part atf        --align 12288  --size 4096K            --ondisk 
> ${RK_BOOT_DEVICE}
> +part /boot      --align 16384  --size=114688K --active --ondisk 
> ${RK_BOOT_DEVICE} --source bootimg-partition --fstype=vfat --label boot 
> --sourceparams="loader=u-boot"
>  
> diff --git a/wic/rock-pi-4.wks b/wic/rock-pi-4.wks
> index 8e4b37c..75ac358 100644
> --- a/wic/rock-pi-4.wks
> +++ b/wic/rock-pi-4.wks
> @@ -2,6 +2,6 @@
>  # Released under the MIT license (see COPYING.MIT for the terms)
>  
>  include rk3399-boot.wks
> -part / --align 131072 --source rootfs --fstype=ext4 --label root
> +part / --align 131072 --ondisk ${RK_BOOT_DEVICE} --source rootfs 
> --fstype=ext4 --label root
>  
> -bootloader --ptable gpt --append="console=tty1 console=ttyS2,1500000n8 rw 
> root=/dev/mmcblk1p7 rootfstype=ext4 init=/sbin/init"
> +bootloader --ptable gpt --append="console=tty1 console=ttyS2,1500000n8 rw 
> root=/dev/${RK_BOOT_DEVICE}p7 rootfstype=ext4 init=/sbin/init"
> diff --git a/wic/tinker-board.wks b/wic/tinker-board.wks
> index c2027bd..8f08138 100644
> --- a/wic/tinker-board.wks
> +++ b/wic/tinker-board.wks
> @@ -2,6 +2,7 @@
>  # Released under the MIT license (see COPYING.MIT for the terms)
>  
>  include rk3288-boot.wks
> -part / --align 131072 --source rootfs --fstype=ext4 --label root
>  
> -bootloader --ptable gpt --append="console=tty1 console=ttyS2,115200n8 rw 
> root=/dev/mmcblk0p7 rootfstype=ext4 init=/sbin/init"
> +part / --align 131072 --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"
> diff --git a/wic/vyasa-rk3288.wks b/wic/vyasa-rk3288.wks
> index f019e0d..b577e5a 100644
> --- a/wic/vyasa-rk3288.wks
> +++ b/wic/vyasa-rk3288.wks
> @@ -2,7 +2,7 @@
>  # Released under the MIT license (see COPYING.MIT for the terms)
>  
>  include rk3288-boot.wks
> -part / --align 131072 --source rootfs --fstype=ext4 --label root
> +part / --align 131072 --ondisk ${RK_BOOT_DEVICE} --source rootfs 
> --fstype=ext4 --label root
>  
> -bootloader --ptable gpt --append="console=tty1 console=ttyS2,115200n8 rw 
> root=/dev/mmcblk2p7 rootfstype=ext4 init=/sbin/init"
> +bootloader --ptable gpt --append="console=tty1 console=ttyS2,115200n8 rw 
> root=/dev/${RK_BOOT_DEVICE}p7 rootfstype=ext4 init=/sbin/init"
>  
> -- 
> 2.24.1
> 
-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.

View/Reply Online (#48340): https://lists.yoctoproject.org/g/yocto/message/48340
Mute This Topic: https://lists.yoctoproject.org/mt/71154175/21656
Group Owner: [email protected]
Unsubscribe: https://lists.yoctoproject.org/g/yocto/unsub  
[[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to