All of lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [PATCH] configs/orangepi_zero_defconfig: switch to extlinux
@ 2022-02-05  7:28 Sergey Kuzminov
  2022-02-05 17:26 ` Giulio Benetti
  0 siblings, 1 reply; 4+ messages in thread
From: Sergey Kuzminov @ 2022-02-05  7:28 UTC (permalink / raw)
  To: buildroot; +Cc: Sergey Kuzminov

Changes:
- Exclude FAT partition, he is no longer needed for U-Boot.
- Switch the rootfs partition from MBR to GPT for partition-uuid to work.
- Switch to extlinux, this is convenient for debugging.
- Create common scenarios for multiple boards to create an SD image: board/orangepi/common.

Signed-off-by: Sergey Kuzminov <kuzminov.sergey81@gmail.com>
---
 board/orangepi/common/extlinux.conf       |  5 ++++
 board/orangepi/common/genimage.cfg        | 23 +++++++++++++++
 board/orangepi/common/post-build.sh       | 34 +++++++++++++++++++++
 board/orangepi/orangepi-zero/boot.cmd     |  9 ------
 board/orangepi/orangepi-zero/genimage.cfg | 36 -----------------------
 configs/orangepi_zero_defconfig           | 11 ++++---
 6 files changed, 67 insertions(+), 51 deletions(-)
 create mode 100644 board/orangepi/common/extlinux.conf
 create mode 100644 board/orangepi/common/genimage.cfg
 create mode 100755 board/orangepi/common/post-build.sh
 delete mode 100644 board/orangepi/orangepi-zero/boot.cmd
 delete mode 100644 board/orangepi/orangepi-zero/genimage.cfg

diff --git a/board/orangepi/common/extlinux.conf b/board/orangepi/common/extlinux.conf
new file mode 100644
index 0000000000..015f29270e
--- /dev/null
+++ b/board/orangepi/common/extlinux.conf
@@ -0,0 +1,5 @@
+LABEL default
+  kernel /boot/%LINUXIMAGE%
+  devicetreedir /boot
+  append root=PARTUUID=%PARTUUID% rootwait console=${console}
+# append root=PARTUUID=%PARTUUID% rootwait console=${console} rootfstype=ext4 quiet panic=10
diff --git a/board/orangepi/common/genimage.cfg b/board/orangepi/common/genimage.cfg
new file mode 100644
index 0000000000..fa0d988991
--- /dev/null
+++ b/board/orangepi/common/genimage.cfg
@@ -0,0 +1,23 @@
+image sdcard.img {
+	partition u-boot {
+		in-partition-table = false
+		image = "u-boot-sunxi-with-spl.bin"
+		offset = 8K
+		size = 1000K # 1MB - 8KB(offset) - 16KB(GPT)
+	}
+
+	hdimage {
+		partition-table-type = gpt
+		gpt-location = 1008K # 1MB - 16KB(GPT)
+		gpt-no-backup = true
+		# After writing the image to the SD card,
+		# backup GPT data structures at the end of the disk:
+		# gdisk /dev/mmcblk0 then press the buttons: x, e, w, y
+	}
+
+	partition rootfs {
+		offset = 1M
+		image = "rootfs.ext4"
+		partition-uuid = %PARTUUID%
+	}
+}
diff --git a/board/orangepi/common/post-build.sh b/board/orangepi/common/post-build.sh
new file mode 100755
index 0000000000..296f94b174
--- /dev/null
+++ b/board/orangepi/common/post-build.sh
@@ -0,0 +1,34 @@
+#!/bin/sh
+
+linux_image()
+{
+	if grep -Eq "^BR2_LINUX_KERNEL_UIMAGE=y$" ${BR2_CONFIG}; then
+		echo "uImage"
+	elif grep -Eq "^BR2_LINUX_KERNEL_IMAGE=y$" ${BR2_CONFIG}; then
+		echo "Image"
+	elif grep -Eq "^BR2_LINUX_KERNEL_IMAGEGZ=y$" ${BR2_CONFIG}; then
+		echo "Image.gz"
+	else
+		echo "zImage"
+	fi
+}
+
+generic_getty()
+{
+	if grep -Eq "^BR2_TARGET_GENERIC_GETTY=y$" ${BR2_CONFIG}; then
+		echo ""
+	else
+		echo "s/\s*console=\S*//"
+	fi
+}
+
+PARTUUID="$($HOST_DIR/bin/uuidgen)"
+
+install -d "$TARGET_DIR/boot/extlinux/"
+
+sed -e "$(generic_getty)" \
+	-e "s/%LINUXIMAGE%/$(linux_image)/g" \
+	-e "s/%PARTUUID%/$PARTUUID/g" \
+	"board/orangepi/common/extlinux.conf" > "$TARGET_DIR/boot/extlinux/extlinux.conf"
+
+sed "s/%PARTUUID%/$PARTUUID/g" "board/orangepi/common/genimage.cfg" > "$BINARIES_DIR/genimage.cfg"
diff --git a/board/orangepi/orangepi-zero/boot.cmd b/board/orangepi/orangepi-zero/boot.cmd
deleted file mode 100644
index d094a64fe5..0000000000
--- a/board/orangepi/orangepi-zero/boot.cmd
+++ /dev/null
@@ -1,9 +0,0 @@
-setenv fdt_high ffffffff
-
-part uuid mmc 0:2 uuid
-setenv bootargs console=ttyS0,115200 root=PARTUUID=${uuid} rootwait
-
-fatload mmc 0 $kernel_addr_r zImage
-fatload mmc 0 $fdt_addr_r sun8i-h2-plus-orangepi-zero.dtb
-
-bootz $kernel_addr_r - $fdt_addr_r
diff --git a/board/orangepi/orangepi-zero/genimage.cfg b/board/orangepi/orangepi-zero/genimage.cfg
deleted file mode 100644
index 32f5454ae6..0000000000
--- a/board/orangepi/orangepi-zero/genimage.cfg
+++ /dev/null
@@ -1,36 +0,0 @@
-# Minimal SD card image for the OrangePi Zero
-#
-image boot.vfat {
-	vfat {
-		files = {
-			"zImage",
-			"sun8i-h2-plus-orangepi-zero.dtb",
-			"boot.scr"
-		}
-	}
-	size = 10M
-}
-
-image sdcard.img {
-	hdimage {
-	}
-
-	partition u-boot {
-		in-partition-table = "no"
-		image = "u-boot-sunxi-with-spl.bin"
-		offset = 8K
-		size = 1016K # 1MB - 8KB
-	}
-
-	partition boot {
-		partition-type = 0xC
-		bootable = "true"
-		image = "boot.vfat"
-	}
-
-	partition rootfs {
-		partition-type = 0x83
-		image = "rootfs.ext4"
-		size = 512M
-	}
-}
diff --git a/configs/orangepi_zero_defconfig b/configs/orangepi_zero_defconfig
index 5aaa1566c5..96f0c3f600 100644
--- a/configs/orangepi_zero_defconfig
+++ b/configs/orangepi_zero_defconfig
@@ -20,10 +20,13 @@ BR2_LINUX_KERNEL_DTS_SUPPORT=y
 BR2_LINUX_KERNEL_INTREE_DTS_NAME="sun8i-h2-plus-orangepi-zero"
 BR2_LINUX_KERNEL_CONFIG_FRAGMENT_FILES="board/orangepi/orangepi-zero/linux-extras.fragment"
 BR2_LINUX_KERNEL_NEEDS_HOST_OPENSSL=y
+BR2_LINUX_KERNEL_INSTALL_TARGET=y
 
 # Filesystem
 BR2_TARGET_ROOTFS_EXT2=y
 BR2_TARGET_ROOTFS_EXT2_4=y
+BR2_TARGET_ROOTFS_EXT2_SIZE="63M"
+BR2_TARGET_GENERIC_REMOUNT_ROOTFS_RW=y
 # BR2_TARGET_ROOTFS_TAR is not set
 
 # Bootloader
@@ -39,16 +42,12 @@ BR2_TARGET_UBOOT_SPL=y
 BR2_TARGET_UBOOT_SPL_NAME="u-boot-sunxi-with-spl.bin"
 
 # Required tools to create the SD image
-BR2_PACKAGE_HOST_UBOOT_TOOLS=y
-BR2_PACKAGE_HOST_UBOOT_TOOLS_BOOT_SCRIPT=y
-BR2_PACKAGE_HOST_UBOOT_TOOLS_BOOT_SCRIPT_SOURCE="board/orangepi/orangepi-zero/boot.cmd"
-BR2_PACKAGE_HOST_DOSFSTOOLS=y
 BR2_PACKAGE_HOST_GENIMAGE=y
-BR2_PACKAGE_HOST_MTOOLS=y
 
 # Image
+BR2_ROOTFS_POST_BUILD_SCRIPT="board/orangepi/common/post-build.sh"
 BR2_ROOTFS_POST_IMAGE_SCRIPT="support/scripts/genimage.sh"
-BR2_ROOTFS_POST_SCRIPT_ARGS="-c board/orangepi/orangepi-zero/genimage.cfg"
+BR2_ROOTFS_POST_SCRIPT_ARGS="-c $(BINARIES_DIR)/genimage.cfg"
 
 # Wireless driver and firmware
 BR2_PACKAGE_XR819_XRADIO=y
-- 
2.34.1

_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [Buildroot] [PATCH] configs/orangepi_zero_defconfig: switch to extlinux
  2022-02-05  7:28 [Buildroot] [PATCH] configs/orangepi_zero_defconfig: switch to extlinux Sergey Kuzminov
@ 2022-02-05 17:26 ` Giulio Benetti
  2022-02-05 18:21   ` Sergey Kuzminov
  0 siblings, 1 reply; 4+ messages in thread
From: Giulio Benetti @ 2022-02-05 17:26 UTC (permalink / raw)
  To: Sergey Kuzminov, buildroot

Hi Sergey,

On 05/02/22 08:28, Sergey Kuzminov wrote:
> Changes:
> - Exclude FAT partition, he is no longer needed for U-Boot.

typo s/he/it

> - Switch the rootfs partition from MBR to GPT for partition-uuid to work.
> - Switch to extlinux, this is convenient for debugging.
> - Create common scenarios for multiple boards to create an SD image: board/orangepi/common.
> 
> Signed-off-by: Sergey Kuzminov <kuzminov.sergey81@gmail.com>
> ---
>   board/orangepi/common/extlinux.conf       |  5 ++++
>   board/orangepi/common/genimage.cfg        | 23 +++++++++++++++
>   board/orangepi/common/post-build.sh       | 34 +++++++++++++++++++++
>   board/orangepi/orangepi-zero/boot.cmd     |  9 ------
>   board/orangepi/orangepi-zero/genimage.cfg | 36 -----------------------
>   configs/orangepi_zero_defconfig           | 11 ++++---
>   6 files changed, 67 insertions(+), 51 deletions(-)
>   create mode 100644 board/orangepi/common/extlinux.conf
>   create mode 100644 board/orangepi/common/genimage.cfg
>   create mode 100755 board/orangepi/common/post-build.sh
>   delete mode 100644 board/orangepi/orangepi-zero/boot.cmd
>   delete mode 100644 board/orangepi/orangepi-zero/genimage.cfg
> 
> diff --git a/board/orangepi/common/extlinux.conf b/board/orangepi/common/extlinux.conf
> new file mode 100644
> index 0000000000..015f29270e
> --- /dev/null
> +++ b/board/orangepi/common/extlinux.conf
> @@ -0,0 +1,5 @@
> +LABEL default
> +  kernel /boot/%LINUXIMAGE%
> +  devicetreedir /boot
> +  append root=PARTUUID=%PARTUUID% rootwait console=${console}
> +# append root=PARTUUID=%PARTUUID% rootwait console=${console} rootfstype=ext4 quiet panic=10

Here ^^^ you've left a commented line, I guess the correct one is the 
second one, right? Or anyway you can only keep one.

> diff --git a/board/orangepi/common/genimage.cfg b/board/orangepi/common/genimage.cfg
> new file mode 100644
> index 0000000000..fa0d988991
> --- /dev/null
> +++ b/board/orangepi/common/genimage.cfg
> @@ -0,0 +1,23 @@
> +image sdcard.img {
> +	partition u-boot {
> +		in-partition-table = false
> +		image = "u-boot-sunxi-with-spl.bin"
> +		offset = 8K
> +		size = 1000K # 1MB - 8KB(offset) - 16KB(GPT)
> +	}
> +
> +	hdimage {
> +		partition-table-type = gpt
> +		gpt-location = 1008K # 1MB - 16KB(GPT)
> +		gpt-no-backup = true
> +		# After writing the image to the SD card,
> +		# backup GPT data structures at the end of the disk:
> +		# gdisk /dev/mmcblk0 then press the buttons: x, e, w, y
> +	}
> +
> +	partition rootfs {
> +		offset = 1M
> +		image = "rootfs.ext4"
> +		partition-uuid = %PARTUUID%
> +	}
> +}
> diff --git a/board/orangepi/common/post-build.sh b/board/orangepi/common/post-build.sh
> new file mode 100755
> index 0000000000..296f94b174
> --- /dev/null
> +++ b/board/orangepi/common/post-build.sh
> @@ -0,0 +1,34 @@
> +#!/bin/sh
> +
> +linux_image()
> +{
> +	if grep -Eq "^BR2_LINUX_KERNEL_UIMAGE=y$" ${BR2_CONFIG}; then
> +		echo "uImage"
> +	elif grep -Eq "^BR2_LINUX_KERNEL_IMAGE=y$" ${BR2_CONFIG}; then
> +		echo "Image"
> +	elif grep -Eq "^BR2_LINUX_KERNEL_IMAGEGZ=y$" ${BR2_CONFIG}; then
> +		echo "Image.gz"
> +	else
> +		echo "zImage"
> +	fi
> +}
> +
> +generic_getty()
> +{
> +	if grep -Eq "^BR2_TARGET_GENERIC_GETTY=y$" ${BR2_CONFIG}; then
> +		echo ""
> +	else
> +		echo "s/\s*console=\S*//"
> +	fi
> +}
> +
> +PARTUUID="$($HOST_DIR/bin/uuidgen)"
> +
> +install -d "$TARGET_DIR/boot/extlinux/"
> +
> +sed -e "$(generic_getty)" \
> +	-e "s/%LINUXIMAGE%/$(linux_image)/g" \
> +	-e "s/%PARTUUID%/$PARTUUID/g" \
> +	"board/orangepi/common/extlinux.conf" > "$TARGET_DIR/boot/extlinux/extlinux.conf"
> +
> +sed "s/%PARTUUID%/$PARTUUID/g" "board/orangepi/common/genimage.cfg" > "$BINARIES_DIR/genimage.cfg"
> diff --git a/board/orangepi/orangepi-zero/boot.cmd b/board/orangepi/orangepi-zero/boot.cmd
> deleted file mode 100644
> index d094a64fe5..0000000000
> --- a/board/orangepi/orangepi-zero/boot.cmd
> +++ /dev/null
> @@ -1,9 +0,0 @@
> -setenv fdt_high ffffffff
> -
> -part uuid mmc 0:2 uuid
> -setenv bootargs console=ttyS0,115200 root=PARTUUID=${uuid} rootwait
> -
> -fatload mmc 0 $kernel_addr_r zImage
> -fatload mmc 0 $fdt_addr_r sun8i-h2-plus-orangepi-zero.dtb
> -
> -bootz $kernel_addr_r - $fdt_addr_r
> diff --git a/board/orangepi/orangepi-zero/genimage.cfg b/board/orangepi/orangepi-zero/genimage.cfg
> deleted file mode 100644
> index 32f5454ae6..0000000000
> --- a/board/orangepi/orangepi-zero/genimage.cfg
> +++ /dev/null
> @@ -1,36 +0,0 @@
> -# Minimal SD card image for the OrangePi Zero
> -#
> -image boot.vfat {
> -	vfat {
> -		files = {
> -			"zImage",
> -			"sun8i-h2-plus-orangepi-zero.dtb",
> -			"boot.scr"
> -		}
> -	}
> -	size = 10M
> -}
> -
> -image sdcard.img {
> -	hdimage {
> -	}
> -
> -	partition u-boot {
> -		in-partition-table = "no"
> -		image = "u-boot-sunxi-with-spl.bin"
> -		offset = 8K
> -		size = 1016K # 1MB - 8KB
> -	}
> -
> -	partition boot {
> -		partition-type = 0xC
> -		bootable = "true"
> -		image = "boot.vfat"
> -	}
> -
> -	partition rootfs {
> -		partition-type = 0x83
> -		image = "rootfs.ext4"
> -		size = 512M
> -	}
> -}
> diff --git a/configs/orangepi_zero_defconfig b/configs/orangepi_zero_defconfig
> index 5aaa1566c5..96f0c3f600 100644
> --- a/configs/orangepi_zero_defconfig
> +++ b/configs/orangepi_zero_defconfig
> @@ -20,10 +20,13 @@ BR2_LINUX_KERNEL_DTS_SUPPORT=y
>   BR2_LINUX_KERNEL_INTREE_DTS_NAME="sun8i-h2-plus-orangepi-zero"
>   BR2_LINUX_KERNEL_CONFIG_FRAGMENT_FILES="board/orangepi/orangepi-zero/linux-extras.fragment"
>   BR2_LINUX_KERNEL_NEEDS_HOST_OPENSSL=y
> +BR2_LINUX_KERNEL_INSTALL_TARGET=y
>   
>   # Filesystem
>   BR2_TARGET_ROOTFS_EXT2=y
>   BR2_TARGET_ROOTFS_EXT2_4=y
> +BR2_TARGET_ROOTFS_EXT2_SIZE="63M"
> +BR2_TARGET_GENERIC_REMOUNT_ROOTFS_RW=y

It's worth mentioning this change ^^^ in commit log

>   # BR2_TARGET_ROOTFS_TAR is not set
>   
>   # Bootloader
> @@ -39,16 +42,12 @@ BR2_TARGET_UBOOT_SPL=y
>   BR2_TARGET_UBOOT_SPL_NAME="u-boot-sunxi-with-spl.bin"
>   
>   # Required tools to create the SD image
> -BR2_PACKAGE_HOST_UBOOT_TOOLS=y
> -BR2_PACKAGE_HOST_UBOOT_TOOLS_BOOT_SCRIPT=y
> -BR2_PACKAGE_HOST_UBOOT_TOOLS_BOOT_SCRIPT_SOURCE="board/orangepi/orangepi-zero/boot.cmd"
> -BR2_PACKAGE_HOST_DOSFSTOOLS=y
>   BR2_PACKAGE_HOST_GENIMAGE=y
> -BR2_PACKAGE_HOST_MTOOLS=y
>   
>   # Image
> +BR2_ROOTFS_POST_BUILD_SCRIPT="board/orangepi/common/post-build.sh"
>   BR2_ROOTFS_POST_IMAGE_SCRIPT="support/scripts/genimage.sh"
> -BR2_ROOTFS_POST_SCRIPT_ARGS="-c board/orangepi/orangepi-zero/genimage.cfg"
> +BR2_ROOTFS_POST_SCRIPT_ARGS="-c $(BINARIES_DIR)/genimage.cfg"
>   
>   # Wireless driver and firmware
>   BR2_PACKAGE_XR819_XRADIO=y

I've built it successfully locally so:
Tested-by: Giulio Benetti <giulio.benetti@benettiengineering.com>
and with the corrected commit log you can send V2 with ^^^ and also:
Reviewed-by: Giulio Benetti <giulio.benetti@benettiengineering.com>

Best regards
-- 
Giulio Benetti
Benetti Engineering sas
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [Buildroot] [PATCH] configs/orangepi_zero_defconfig: switch to extlinux
  2022-02-05 17:26 ` Giulio Benetti
@ 2022-02-05 18:21   ` Sergey Kuzminov
  2022-02-05 19:38     ` Giulio Benetti
  0 siblings, 1 reply; 4+ messages in thread
From: Sergey Kuzminov @ 2022-02-05 18:21 UTC (permalink / raw)
  To: Giulio Benetti, buildroot

Hi, Giulio,

05.02.2022 20:26, Giulio Benetti:
> Hi Sergey,
> 
> On 05/02/22 08:28, Sergey Kuzminov wrote:
>> Changes:
>> - Exclude FAT partition, he is no longer needed for U-Boot.
> 
> typo s/he/it

ok

> 
>> - Switch the rootfs partition from MBR to GPT for partition-uuid to work.
>> - Switch to extlinux, this is convenient for debugging.
>> - Create common scenarios for multiple boards to create an SD image: 
>> board/orangepi/common.
>>
>> Signed-off-by: Sergey Kuzminov <kuzminov.sergey81@gmail.com>
>> ---
>>   board/orangepi/common/extlinux.conf       |  5 ++++
>>   board/orangepi/common/genimage.cfg        | 23 +++++++++++++++
>>   board/orangepi/common/post-build.sh       | 34 +++++++++++++++++++++
>>   board/orangepi/orangepi-zero/boot.cmd     |  9 ------
>>   board/orangepi/orangepi-zero/genimage.cfg | 36 -----------------------
>>   configs/orangepi_zero_defconfig           | 11 ++++---
>>   6 files changed, 67 insertions(+), 51 deletions(-)
>>   create mode 100644 board/orangepi/common/extlinux.conf
>>   create mode 100644 board/orangepi/common/genimage.cfg
>>   create mode 100755 board/orangepi/common/post-build.sh
>>   delete mode 100644 board/orangepi/orangepi-zero/boot.cmd
>>   delete mode 100644 board/orangepi/orangepi-zero/genimage.cfg
>>
>> diff --git a/board/orangepi/common/extlinux.conf 
>> b/board/orangepi/common/extlinux.conf
>> new file mode 100644
>> index 0000000000..015f29270e
>> --- /dev/null
>> +++ b/board/orangepi/common/extlinux.conf
>> @@ -0,0 +1,5 @@
>> +LABEL default
>> +  kernel /boot/%LINUXIMAGE%
>> +  devicetreedir /boot
>> +  append root=PARTUUID=%PARTUUID% rootwait console=${console}
>> +# append root=PARTUUID=%PARTUUID% rootwait console=${console} 
>> rootfstype=ext4 quiet panic=10
> 
> Here ^^^ you've left a commented line, I guess the correct one is the 
> second one, right? Or anyway you can only keep one.

The first line is for debugging, the second is for work.

> 
>> diff --git a/board/orangepi/common/genimage.cfg 
>> b/board/orangepi/common/genimage.cfg
>> new file mode 100644
>> index 0000000000..fa0d988991
>> --- /dev/null
>> +++ b/board/orangepi/common/genimage.cfg
>> @@ -0,0 +1,23 @@
>> +image sdcard.img {
>> +    partition u-boot {
>> +        in-partition-table = false
>> +        image = "u-boot-sunxi-with-spl.bin"
>> +        offset = 8K
>> +        size = 1000K # 1MB - 8KB(offset) - 16KB(GPT)
>> +    }
>> +
>> +    hdimage {
>> +        partition-table-type = gpt
>> +        gpt-location = 1008K # 1MB - 16KB(GPT)
>> +        gpt-no-backup = true
>> +        # After writing the image to the SD card,
>> +        # backup GPT data structures at the end of the disk:
>> +        # gdisk /dev/mmcblk0 then press the buttons: x, e, w, y
>> +    }
>> +
>> +    partition rootfs {
>> +        offset = 1M
>> +        image = "rootfs.ext4"
>> +        partition-uuid = %PARTUUID%
>> +    }
>> +}
>> diff --git a/board/orangepi/common/post-build.sh 
>> b/board/orangepi/common/post-build.sh
>> new file mode 100755
>> index 0000000000..296f94b174
>> --- /dev/null
>> +++ b/board/orangepi/common/post-build.sh
>> @@ -0,0 +1,34 @@
>> +#!/bin/sh
>> +
>> +linux_image()
>> +{
>> +    if grep -Eq "^BR2_LINUX_KERNEL_UIMAGE=y$" ${BR2_CONFIG}; then
>> +        echo "uImage"
>> +    elif grep -Eq "^BR2_LINUX_KERNEL_IMAGE=y$" ${BR2_CONFIG}; then
>> +        echo "Image"
>> +    elif grep -Eq "^BR2_LINUX_KERNEL_IMAGEGZ=y$" ${BR2_CONFIG}; then
>> +        echo "Image.gz"
>> +    else
>> +        echo "zImage"
>> +    fi
>> +}
>> +
>> +generic_getty()
>> +{
>> +    if grep -Eq "^BR2_TARGET_GENERIC_GETTY=y$" ${BR2_CONFIG}; then
>> +        echo ""
>> +    else
>> +        echo "s/\s*console=\S*//"
>> +    fi
>> +}
>> +
>> +PARTUUID="$($HOST_DIR/bin/uuidgen)"
>> +
>> +install -d "$TARGET_DIR/boot/extlinux/"
>> +
>> +sed -e "$(generic_getty)" \
>> +    -e "s/%LINUXIMAGE%/$(linux_image)/g" \
>> +    -e "s/%PARTUUID%/$PARTUUID/g" \
>> +    "board/orangepi/common/extlinux.conf" > 
>> "$TARGET_DIR/boot/extlinux/extlinux.conf"
>> +
>> +sed "s/%PARTUUID%/$PARTUUID/g" "board/orangepi/common/genimage.cfg" > 
>> "$BINARIES_DIR/genimage.cfg"
>> diff --git a/board/orangepi/orangepi-zero/boot.cmd 
>> b/board/orangepi/orangepi-zero/boot.cmd
>> deleted file mode 100644
>> index d094a64fe5..0000000000
>> --- a/board/orangepi/orangepi-zero/boot.cmd
>> +++ /dev/null
>> @@ -1,9 +0,0 @@
>> -setenv fdt_high ffffffff
>> -
>> -part uuid mmc 0:2 uuid
>> -setenv bootargs console=ttyS0,115200 root=PARTUUID=${uuid} rootwait
>> -
>> -fatload mmc 0 $kernel_addr_r zImage
>> -fatload mmc 0 $fdt_addr_r sun8i-h2-plus-orangepi-zero.dtb
>> -
>> -bootz $kernel_addr_r - $fdt_addr_r
>> diff --git a/board/orangepi/orangepi-zero/genimage.cfg 
>> b/board/orangepi/orangepi-zero/genimage.cfg
>> deleted file mode 100644
>> index 32f5454ae6..0000000000
>> --- a/board/orangepi/orangepi-zero/genimage.cfg
>> +++ /dev/null
>> @@ -1,36 +0,0 @@
>> -# Minimal SD card image for the OrangePi Zero
>> -#
>> -image boot.vfat {
>> -    vfat {
>> -        files = {
>> -            "zImage",
>> -            "sun8i-h2-plus-orangepi-zero.dtb",
>> -            "boot.scr"
>> -        }
>> -    }
>> -    size = 10M
>> -}
>> -
>> -image sdcard.img {
>> -    hdimage {
>> -    }
>> -
>> -    partition u-boot {
>> -        in-partition-table = "no"
>> -        image = "u-boot-sunxi-with-spl.bin"
>> -        offset = 8K
>> -        size = 1016K # 1MB - 8KB
>> -    }
>> -
>> -    partition boot {
>> -        partition-type = 0xC
>> -        bootable = "true"
>> -        image = "boot.vfat"
>> -    }
>> -
>> -    partition rootfs {
>> -        partition-type = 0x83
>> -        image = "rootfs.ext4"
>> -        size = 512M
>> -    }
>> -}
>> diff --git a/configs/orangepi_zero_defconfig 
>> b/configs/orangepi_zero_defconfig
>> index 5aaa1566c5..96f0c3f600 100644
>> --- a/configs/orangepi_zero_defconfig
>> +++ b/configs/orangepi_zero_defconfig
>> @@ -20,10 +20,13 @@ BR2_LINUX_KERNEL_DTS_SUPPORT=y
>>   BR2_LINUX_KERNEL_INTREE_DTS_NAME="sun8i-h2-plus-orangepi-zero"
>>   
>> BR2_LINUX_KERNEL_CONFIG_FRAGMENT_FILES="board/orangepi/orangepi-zero/linux-extras.fragment" 
>>
>>   BR2_LINUX_KERNEL_NEEDS_HOST_OPENSSL=y
>> +BR2_LINUX_KERNEL_INSTALL_TARGET=y
>>   # Filesystem
>>   BR2_TARGET_ROOTFS_EXT2=y
>>   BR2_TARGET_ROOTFS_EXT2_4=y
>> +BR2_TARGET_ROOTFS_EXT2_SIZE="63M"
>> +BR2_TARGET_GENERIC_REMOUNT_ROOTFS_RW=y
> 
> It's worth mentioning this change ^^^ in commit log

ok

> 
>>   # BR2_TARGET_ROOTFS_TAR is not set
>>   # Bootloader
>> @@ -39,16 +42,12 @@ BR2_TARGET_UBOOT_SPL=y
>>   BR2_TARGET_UBOOT_SPL_NAME="u-boot-sunxi-with-spl.bin"
>>   # Required tools to create the SD image
>> -BR2_PACKAGE_HOST_UBOOT_TOOLS=y
>> -BR2_PACKAGE_HOST_UBOOT_TOOLS_BOOT_SCRIPT=y
>> -BR2_PACKAGE_HOST_UBOOT_TOOLS_BOOT_SCRIPT_SOURCE="board/orangepi/orangepi-zero/boot.cmd" 
>>
>> -BR2_PACKAGE_HOST_DOSFSTOOLS=y
>>   BR2_PACKAGE_HOST_GENIMAGE=y
>> -BR2_PACKAGE_HOST_MTOOLS=y
>>   # Image
>> +BR2_ROOTFS_POST_BUILD_SCRIPT="board/orangepi/common/post-build.sh"
>>   BR2_ROOTFS_POST_IMAGE_SCRIPT="support/scripts/genimage.sh"
>> -BR2_ROOTFS_POST_SCRIPT_ARGS="-c 
>> board/orangepi/orangepi-zero/genimage.cfg"
>> +BR2_ROOTFS_POST_SCRIPT_ARGS="-c $(BINARIES_DIR)/genimage.cfg"
>>   # Wireless driver and firmware
>>   BR2_PACKAGE_XR819_XRADIO=y
> 
> I've built it successfully locally so:
> Tested-by: Giulio Benetti <giulio.benetti@benettiengineering.com>
> and with the corrected commit log you can send V2 with ^^^ and also:
> Reviewed-by: Giulio Benetti <giulio.benetti@benettiengineering.com>
> 
> Best regards

Thank you.

_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [Buildroot] [PATCH] configs/orangepi_zero_defconfig: switch to extlinux
  2022-02-05 18:21   ` Sergey Kuzminov
@ 2022-02-05 19:38     ` Giulio Benetti
  0 siblings, 0 replies; 4+ messages in thread
From: Giulio Benetti @ 2022-02-05 19:38 UTC (permalink / raw)
  To: Sergey Kuzminov; +Cc: buildroot

Hi Sergey,

> Il giorno 5 feb 2022, alle ore 19:22, Sergey Kuzminov <kuzminov.sergey81@gmail.com> ha scritto:
> 
> Hi, Giulio,
> 
> 05.02.2022 20:26, Giulio Benetti:
>> Hi Sergey,
>>> On 05/02/22 08:28, Sergey Kuzminov wrote:
>>> Changes:
>>> - Exclude FAT partition, he is no longer needed for U-Boot.
>> typo s/he/it
> 
> ok
> 
>>> - Switch the rootfs partition from MBR to GPT for partition-uuid to work.
>>> - Switch to extlinux, this is convenient for debugging.
>>> - Create common scenarios for multiple boards to create an SD image: board/orangepi/common.
>>> 
>>> Signed-off-by: Sergey Kuzminov <kuzminov.sergey81@gmail.com>
>>> ---
>>>   board/orangepi/common/extlinux.conf       |  5 ++++
>>>   board/orangepi/common/genimage.cfg        | 23 +++++++++++++++
>>>   board/orangepi/common/post-build.sh       | 34 +++++++++++++++++++++
>>>   board/orangepi/orangepi-zero/boot.cmd     |  9 ------
>>>   board/orangepi/orangepi-zero/genimage.cfg | 36 -----------------------
>>>   configs/orangepi_zero_defconfig           | 11 ++++---
>>>   6 files changed, 67 insertions(+), 51 deletions(-)
>>>   create mode 100644 board/orangepi/common/extlinux.conf
>>>   create mode 100644 board/orangepi/common/genimage.cfg
>>>   create mode 100755 board/orangepi/common/post-build.sh
>>>   delete mode 100644 board/orangepi/orangepi-zero/boot.cmd
>>>   delete mode 100644 board/orangepi/orangepi-zero/genimage.cfg
>>> 
>>> diff --git a/board/orangepi/common/extlinux.conf b/board/orangepi/common/extlinux.conf
>>> new file mode 100644
>>> index 0000000000..015f29270e
>>> --- /dev/null
>>> +++ b/board/orangepi/common/extlinux.conf
>>> @@ -0,0 +1,5 @@
>>> +LABEL default
>>> +  kernel /boot/%LINUXIMAGE%
>>> +  devicetreedir /boot
>>> +  append root=PARTUUID=%PARTUUID% rootwait console=${console}
>>> +# append root=PARTUUID=%PARTUUID% rootwait console=${console} rootfstype=ext4 quiet panic=10
>> Here ^^^ you've left a commented line, I guess the correct one is the second one, right? Or anyway you can only keep one.
> 
> The first line is for debugging, the second is for work.

I understand, but you have to keep only one, so the second one and drop the first, 
otherwise I don’t think it will be accepted.

Thank you!
Best regards
Giulio Benetti

> 
>>> diff --git a/board/orangepi/common/genimage.cfg b/board/orangepi/common/genimage.cfg
>>> new file mode 100644
>>> index 0000000000..fa0d988991
>>> --- /dev/null
>>> +++ b/board/orangepi/common/genimage.cfg
>>> @@ -0,0 +1,23 @@
>>> +image sdcard.img {
>>> +    partition u-boot {
>>> +        in-partition-table = false
>>> +        image = "u-boot-sunxi-with-spl.bin"
>>> +        offset = 8K
>>> +        size = 1000K # 1MB - 8KB(offset) - 16KB(GPT)
>>> +    }
>>> +
>>> +    hdimage {
>>> +        partition-table-type = gpt
>>> +        gpt-location = 1008K # 1MB - 16KB(GPT)
>>> +        gpt-no-backup = true
>>> +        # After writing the image to the SD card,
>>> +        # backup GPT data structures at the end of the disk:
>>> +        # gdisk /dev/mmcblk0 then press the buttons: x, e, w, y
>>> +    }
>>> +
>>> +    partition rootfs {
>>> +        offset = 1M
>>> +        image = "rootfs.ext4"
>>> +        partition-uuid = %PARTUUID%
>>> +    }
>>> +}
>>> diff --git a/board/orangepi/common/post-build.sh b/board/orangepi/common/post-build.sh
>>> new file mode 100755
>>> index 0000000000..296f94b174
>>> --- /dev/null
>>> +++ b/board/orangepi/common/post-build.sh
>>> @@ -0,0 +1,34 @@
>>> +#!/bin/sh
>>> +
>>> +linux_image()
>>> +{
>>> +    if grep -Eq "^BR2_LINUX_KERNEL_UIMAGE=y$" ${BR2_CONFIG}; then
>>> +        echo "uImage"
>>> +    elif grep -Eq "^BR2_LINUX_KERNEL_IMAGE=y$" ${BR2_CONFIG}; then
>>> +        echo "Image"
>>> +    elif grep -Eq "^BR2_LINUX_KERNEL_IMAGEGZ=y$" ${BR2_CONFIG}; then
>>> +        echo "Image.gz"
>>> +    else
>>> +        echo "zImage"
>>> +    fi
>>> +}
>>> +
>>> +generic_getty()
>>> +{
>>> +    if grep -Eq "^BR2_TARGET_GENERIC_GETTY=y$" ${BR2_CONFIG}; then
>>> +        echo ""
>>> +    else
>>> +        echo "s/\s*console=\S*//"
>>> +    fi
>>> +}
>>> +
>>> +PARTUUID="$($HOST_DIR/bin/uuidgen)"
>>> +
>>> +install -d "$TARGET_DIR/boot/extlinux/"
>>> +
>>> +sed -e "$(generic_getty)" \
>>> +    -e "s/%LINUXIMAGE%/$(linux_image)/g" \
>>> +    -e "s/%PARTUUID%/$PARTUUID/g" \
>>> +    "board/orangepi/common/extlinux.conf" > "$TARGET_DIR/boot/extlinux/extlinux.conf"
>>> +
>>> +sed "s/%PARTUUID%/$PARTUUID/g" "board/orangepi/common/genimage.cfg" > "$BINARIES_DIR/genimage.cfg"
>>> diff --git a/board/orangepi/orangepi-zero/boot.cmd b/board/orangepi/orangepi-zero/boot.cmd
>>> deleted file mode 100644
>>> index d094a64fe5..0000000000
>>> --- a/board/orangepi/orangepi-zero/boot.cmd
>>> +++ /dev/null
>>> @@ -1,9 +0,0 @@
>>> -setenv fdt_high ffffffff
>>> -
>>> -part uuid mmc 0:2 uuid
>>> -setenv bootargs console=ttyS0,115200 root=PARTUUID=${uuid} rootwait
>>> -
>>> -fatload mmc 0 $kernel_addr_r zImage
>>> -fatload mmc 0 $fdt_addr_r sun8i-h2-plus-orangepi-zero.dtb
>>> -
>>> -bootz $kernel_addr_r - $fdt_addr_r
>>> diff --git a/board/orangepi/orangepi-zero/genimage.cfg b/board/orangepi/orangepi-zero/genimage.cfg
>>> deleted file mode 100644
>>> index 32f5454ae6..0000000000
>>> --- a/board/orangepi/orangepi-zero/genimage.cfg
>>> +++ /dev/null
>>> @@ -1,36 +0,0 @@
>>> -# Minimal SD card image for the OrangePi Zero
>>> -#
>>> -image boot.vfat {
>>> -    vfat {
>>> -        files = {
>>> -            "zImage",
>>> -            "sun8i-h2-plus-orangepi-zero.dtb",
>>> -            "boot.scr"
>>> -        }
>>> -    }
>>> -    size = 10M
>>> -}
>>> -
>>> -image sdcard.img {
>>> -    hdimage {
>>> -    }
>>> -
>>> -    partition u-boot {
>>> -        in-partition-table = "no"
>>> -        image = "u-boot-sunxi-with-spl.bin"
>>> -        offset = 8K
>>> -        size = 1016K # 1MB - 8KB
>>> -    }
>>> -
>>> -    partition boot {
>>> -        partition-type = 0xC
>>> -        bootable = "true"
>>> -        image = "boot.vfat"
>>> -    }
>>> -
>>> -    partition rootfs {
>>> -        partition-type = 0x83
>>> -        image = "rootfs.ext4"
>>> -        size = 512M
>>> -    }
>>> -}
>>> diff --git a/configs/orangepi_zero_defconfig b/configs/orangepi_zero_defconfig
>>> index 5aaa1566c5..96f0c3f600 100644
>>> --- a/configs/orangepi_zero_defconfig
>>> +++ b/configs/orangepi_zero_defconfig
>>> @@ -20,10 +20,13 @@ BR2_LINUX_KERNEL_DTS_SUPPORT=y
>>>   BR2_LINUX_KERNEL_INTREE_DTS_NAME="sun8i-h2-plus-orangepi-zero"
>>>  BR2_LINUX_KERNEL_CONFIG_FRAGMENT_FILES="board/orangepi/orangepi-zero/linux-extras.fragment" 
>>>   BR2_LINUX_KERNEL_NEEDS_HOST_OPENSSL=y
>>> +BR2_LINUX_KERNEL_INSTALL_TARGET=y
>>>   # Filesystem
>>>   BR2_TARGET_ROOTFS_EXT2=y
>>>   BR2_TARGET_ROOTFS_EXT2_4=y
>>> +BR2_TARGET_ROOTFS_EXT2_SIZE="63M"
>>> +BR2_TARGET_GENERIC_REMOUNT_ROOTFS_RW=y
>> It's worth mentioning this change ^^^ in commit log
> 
> ok
> 
>>>   # BR2_TARGET_ROOTFS_TAR is not set
>>>   # Bootloader
>>> @@ -39,16 +42,12 @@ BR2_TARGET_UBOOT_SPL=y
>>>   BR2_TARGET_UBOOT_SPL_NAME="u-boot-sunxi-with-spl.bin"
>>>   # Required tools to create the SD image
>>> -BR2_PACKAGE_HOST_UBOOT_TOOLS=y
>>> -BR2_PACKAGE_HOST_UBOOT_TOOLS_BOOT_SCRIPT=y
>>> -BR2_PACKAGE_HOST_UBOOT_TOOLS_BOOT_SCRIPT_SOURCE="board/orangepi/orangepi-zero/boot.cmd" 
>>> -BR2_PACKAGE_HOST_DOSFSTOOLS=y
>>>   BR2_PACKAGE_HOST_GENIMAGE=y
>>> -BR2_PACKAGE_HOST_MTOOLS=y
>>>   # Image
>>> +BR2_ROOTFS_POST_BUILD_SCRIPT="board/orangepi/common/post-build.sh"
>>>   BR2_ROOTFS_POST_IMAGE_SCRIPT="support/scripts/genimage.sh"
>>> -BR2_ROOTFS_POST_SCRIPT_ARGS="-c board/orangepi/orangepi-zero/genimage.cfg"
>>> +BR2_ROOTFS_POST_SCRIPT_ARGS="-c $(BINARIES_DIR)/genimage.cfg"
>>>   # Wireless driver and firmware
>>>   BR2_PACKAGE_XR819_XRADIO=y
>> I've built it successfully locally so:
>> Tested-by: Giulio Benetti <giulio.benetti@benettiengineering.com>
>> and with the corrected commit log you can send V2 with ^^^ and also:
>> Reviewed-by: Giulio Benetti <giulio.benetti@benettiengineering.com>
>> Best regards
> 
> Thank you.
> 

_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2022-02-05 19:38 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-02-05  7:28 [Buildroot] [PATCH] configs/orangepi_zero_defconfig: switch to extlinux Sergey Kuzminov
2022-02-05 17:26 ` Giulio Benetti
2022-02-05 18:21   ` Sergey Kuzminov
2022-02-05 19:38     ` Giulio Benetti

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.