Skip to contentSkip to conversation

configs/orangepi_zero_defconfig: switch to extlinux

PATCH Superseded Sergey Kuzminov 2 participants 6 messages Feb 5, 2022

v2 of 4 Superseded Latest is v4 →

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 configs/orangepi_zero_defconfig: switch to extlinux

Changes:
v1:
- Exclude FAT partition, it 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.

v2:
- Fix typo in first line of changes (s/he/it).
- Add BR2_TARGET_GENERIC_REMOUNT_ROOTFS_RW=y.
- Exclude one boot option from extlinux.conf.

---
 board/orangepi/common/extlinux.conf       |  4 +++
 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, 66 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
board/orangepi/common/extlinux.conf new file +4 -0
new file mode 100644
index 0000000000..12f496b1fa
@@ -0,0 +1,4 @@
+LABEL default
+  kernel /boot/%LINUXIMAGE%
+  devicetreedir /boot
+  append root=PARTUUID=%PARTUUID% rootwait console=${console} rootfstype=ext4 quiet panic=10
board/orangepi/common/genimage.cfg new file +23 -0
new file mode 100644
index 0000000000..fa0d988991
@@ -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%
+	}
+}
board/orangepi/common/post-build.sh new file +34 -0
new file mode 100755
index 0000000000..296f94b174
@@ -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"
board/orangepi/orangepi-zero/boot.cmd deleted +0 -9
deleted file mode 100644
index d094a64fe5..0000000000
@@ -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
board/orangepi/orangepi-zero/genimage.cfg deleted +0 -36
deleted file mode 100644
index 32f5454ae6..0000000000
@@ -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
-	}
-}
configs/orangepi_zero_defconfig +5 -6
index 5aaa1566c5..96f0c3f600 100644
@@ -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
Signature · 6 lines
2.34.1

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#1 lore raw

Hi Sergey,

below I give you a better example of commit log,
and the dealing with V1->V2 series.

Quoted 4 lines

Il giorno 5 feb 2022, alle ore 22:56, Sergey Kuzminov <[email protected]> ha scritto:

Changes:
v1:

Please Remove this line ^^^

Quoted 6 lines

- Exclude FAT partition, it 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.

v2:

Remove this ^^^ line

Quoted 1 line

- Fix typo in first line of changes (s/he/it).

This too ^^^

Quoted 1 line

- Add BR2_TARGET_GENERIC_REMOUNT_ROOTFS_RW=y.

Here we need an explanation of the reason why, what this implies.

Quoted 1 line

- Exclude one boot option from extlinux.conf.

This ^^^ too

Quoted 2 lines

—-
V1->V2:
* improved commit log
* removed commented line in extlinux.conf
* removed one boot option from extlinux.conf

Quoted 1 line

---

So as you can see, commit log doesn’t mention the patch version, while after the 3 dashes you can write in general whatever you want because it won’t be part of commit log and it’s usually used to report V1->V2 version etc.

Quoted 34 lines
board/orangepi/common/extlinux.conf       |  4 +++
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, 66 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

board/orangepi/common/extlinux.conf new file +4 -0
new file mode 100644
index 0000000000..12f496b1fa
@@ -0,0 +1,4 @@
+LABEL default
+  kernel /boot/%LINUXIMAGE%
+  devicetreedir /boot
+  append root=PARTUUID=%PARTUUID% rootwait console=${console} rootfstype=ext4 quiet panic=10
board/orangepi/common/genimage.cfg new file +5 -0
new file mode 100644
index 0000000000..fa0d988991
@@ -0,0 +1,23 @@
+image sdcard.img {
+    partition u-boot {
+        in-partition-table = false
+        image = "u-boot-sunxi-with-spl.bin"
+        offset = 8K

board/orangepi/common/genimage.cfg line 15

Quoted 10 lines
board/orangepi/common/genimage.cfg new file +10 -0
+        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

Why don’t you make this part ^^^ automatic with a script or you simply use genimage itself?

What it’s expected as board defconfig is something that you burn a sdcard with the sdcard.img file and that’s it. So here you need to make it automatic.

So we wait for V3 with the commit log form you read above and requested changes.

Thank you!
Best regards
—-
Giulio Benetti
Benetti Engineering sas

Quoted 140 lines
board/orangepi/common/genimage.cfg new file +8 -0
+    }
+
+    partition rootfs {
+        offset = 1M
+        image = "rootfs.ext4"
+        partition-uuid = %PARTUUID%
+    }
+}
board/orangepi/common/post-build.sh new file +34 -0
new file mode 100755
index 0000000000..296f94b174
@@ -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"
board/orangepi/orangepi-zero/boot.cmd deleted +0 -9
deleted file mode 100644
index d094a64fe5..0000000000
@@ -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
board/orangepi/orangepi-zero/genimage.cfg deleted +0 -36
deleted file mode 100644
index 32f5454ae6..0000000000
@@ -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
-    }
-}
configs/orangepi_zero_defconfig +0 -0
index 5aaa1566c5..96f0c3f600 100644
@@ -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

configs/orangepi_zero_defconfig +2 -0
+BR2_TARGET_ROOTFS_EXT2_SIZE="63M"
+BR2_TARGET_GENERIC_REMOUNT_ROOTFS_RW=y

# BR2_TARGET_ROOTFS_TAR is not set

# Bootloader

configs/orangepi_zero_defconfig +0 -0
@@ -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

configs/orangepi_zero_defconfig +0 -4
-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"

configs/orangepi_zero_defconfig +1 -1
-BR2_ROOTFS_POST_SCRIPT_ARGS="-c board/orangepi/orangepi-zero/genimage.cfg"
+BR2_ROOTFS_POST_SCRIPT_ARGS="-c $(BINARIES_DIR)/genimage.cfg"
Quoted 9 lines

# Wireless driver and firmware
BR2_PACKAGE_XR819_XRADIO=y

Signature · 6 lines
2.34.1

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot

#2 lore raw

Hi Giulio,

06.02.2022 01:18, Giulio Benetti:

Quoted 32 lines

Hi Sergey,

below I give you a better example of commit log,
and the dealing with V1->V2 series.

Quoted 4 lines

Il giorno 5 feb 2022, alle ore 22:56, Sergey Kuzminov <[email protected]> ha scritto:

Changes:
v1:

Please Remove this line ^^^

Quoted 6 lines

- Exclude FAT partition, it 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.

v2:

Remove this ^^^ line

Quoted 1 line

- Fix typo in first line of changes (s/he/it).

This too ^^^

Quoted 1 line

- Add BR2_TARGET_GENERIC_REMOUNT_ROOTFS_RW=y.

Here we need an explanation of the reason why, what this implies.

Quoted 1 line

- Exclude one boot option from extlinux.conf.

This ^^^ too

Quoted 2 lines

—-
V1->V2:
* improved commit log
* removed commented line in extlinux.conf
* removed one boot option from extlinux.conf

Quoted 5 lines
Quoted 1 line

---

So as you can see, commit log doesn’t mention the patch version, while after the 3 dashes you can write in general whatever you want because it won’t be part of commit log and it’s usually used to report V1->V2 version etc.

Changes:
* Exclude FAT partition, it 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.
* Add BR2_TARGET_GENERIC_REMOUNT_ROOTFS_RW=y, remount root filesystem read-write during boot.

---
V1->V2:
* improved commit log
* removed commented line in extlinux.conf
* removed one boot option from extlinux.conf

V2->V3:
* improved commit log

That's right?

Quoted 20 lines
Quoted 7 lines

+++ b/board/orangepi/common/genimage.cfg

board/orangepi/common/genimage.cfg new file +5 -0
@@ -0,0 +1,23 @@
+image sdcard.img {
+    partition u-boot {
+        in-partition-table = false
+        image = "u-boot-sunxi-with-spl.bin"
+        offset = 8K

board/orangepi/common/genimage.cfg line 15

Quoted 10 lines
board/orangepi/common/genimage.cfg new file +10 -0
+        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

Why don’t you make this part ^^^ automatic with a script or you simply use genimage itself?

Quoted 3 lines

What it’s expected as board defconfig is something that you burn a sdcard with the sdcard.img file and that’s it. So here you need to make it automatic.

So we wait for V3 with the commit log form you read above and requested changes.

The problem is that it is not possible to create an sdcard.img image with the correct GPT structure. The second copy of the GPT must be at the end of the disk, and the size of sdcard.img will not match the SD card. Will work and so, with one copy of GPT. But the disk utilities may issue a warning about the absence of a second copy of the GPT. You can correct the situation only after writing sdcard.img to the SD card, or during the first loading of the board in a separate script. This is out of scope for this patch.

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot

#3 lore raw

Hi Sergey,

Quoted 56 lines · Sergey Kuzminov

Hi Giulio,

06.02.2022 01:18, Giulio Benetti:

Quoted 32 lines

Hi Sergey,

below I give you a better example of commit log,
and the dealing with V1->V2 series.

Quoted 4 lines

Il giorno 5 feb 2022, alle ore 22:56, Sergey Kuzminov <[email protected]> ha scritto:

Changes:
v1:

Please Remove this line ^^^

Quoted 6 lines

- Exclude FAT partition, it 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.

v2:

Remove this ^^^ line

Quoted 1 line

- Fix typo in first line of changes (s/he/it).

This too ^^^

Quoted 1 line

- Add BR2_TARGET_GENERIC_REMOUNT_ROOTFS_RW=y.

Here we need an explanation of the reason why, what this implies.

Quoted 1 line

- Exclude one boot option from extlinux.conf.

This ^^^ too

Quoted 2 lines

—-
V1->V2:
* improved commit log
* removed commented line in extlinux.conf
* removed one boot option from extlinux.conf

Quoted 5 lines
Quoted 1 line

---

So as you can see, commit log doesn’t mention the patch version, while after the 3 dashes you can write in general whatever you want because it won’t be part of commit log and it’s usually used to report V1->V2 version etc.

Changes:
* Exclude FAT partition, it 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.
* Add BR2_TARGET_GENERIC_REMOUNT_ROOTFS_RW=y, remount root filesystem read-write during boot.

---
V1->V2:
* improved commit log
* removed commented line in extlinux.conf
* removed one boot option from extlinux.conf

Quoted 4 lines

V2->V3:
* improved commit log

That's right?

Yes, this works for me now

Quoted 25 lines
Quoted 21 lines
Quoted 8 lines

+++ b/board/orangepi/common/genimage.cfg

board/orangepi/common/genimage.cfg new file +5 -0
@@ -0,0 +1,23 @@
+image sdcard.img {
+    partition u-boot {
+        in-partition-table = false
+        image = "u-boot-sunxi-with-spl.bin"
+        offset = 8K

board/orangepi/common/genimage.cfg line 15

Quoted 10 lines
board/orangepi/common/genimage.cfg new file +10 -0
+        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

Why don’t you make this part ^^^ automatic with a script or you simply use genimage itself?

Quoted 3 lines

What it’s expected as board defconfig is something that you burn a sdcard with the sdcard.img file and that’s it. So here you need to make it automatic.

So we wait for V3 with the commit log form you read above and requested changes.

Quoted 8 lines

The problem is that it is not possible to create an sdcard.img image with the correct GPT structure. The second copy of the GPT must be at the end of the disk, and the size of sdcard.img will not match the SD card. Will work and so, with one copy of GPT. But the disk utilities may issue a warning about the absence of a second copy of the GPT. You can correct the situation only after writing sdcard.img to the SD card, or during the first loading of the board in a separate script. This is out of scope for this patch.

Ok, so please remove those 3 commented lines since I think the board actually works without those additional commands, correct?

Otherwise, it this doesn't work on target without gdisk commands, you need to add a post-image.sh script to launch those commands.

Thank you!
Best regards

Signature · 6 lines
Giulio Benetti
Benetti Engineering sas
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#4 lore raw

06.02.2022 02:13, Giulio Benetti пишет:

Quoted 102 lines

Hi Sergey,

Quoted 58 lines · Sergey Kuzminov

Hi Giulio,

06.02.2022 01:18, Giulio Benetti:

Quoted 34 lines

Hi Sergey,

below I give you a better example of commit log,
and the dealing with V1->V2 series.

Quoted 4 lines

Il giorno 5 feb 2022, alle ore 22:56, Sergey Kuzminov <[email protected]> ha scritto:

Changes:
v1:

Please Remove this line ^^^

Quoted 8 lines

- Exclude FAT partition, it 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.

v2:

Remove this ^^^ line

Quoted 1 line

- Fix typo in first line of changes (s/he/it).

This too ^^^

Quoted 1 line

- Add BR2_TARGET_GENERIC_REMOUNT_ROOTFS_RW=y.

Here we need an explanation of the reason why, what this implies.

Quoted 1 line

- Exclude one boot option from extlinux.conf.

This ^^^ too

Quoted 2 lines

—-
V1->V2:
* improved commit log
* removed commented line in extlinux.conf
* removed one boot option from extlinux.conf

Quoted 5 lines
Quoted 1 line

---

So as you can see, commit log doesn’t mention the patch version, while after the 3 dashes you can write in general whatever you want because it won’t be part of commit log and it’s usually used to report V1->V2 version etc.

Changes:
* Exclude FAT partition, it 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.
* Add BR2_TARGET_GENERIC_REMOUNT_ROOTFS_RW=y, remount root filesystem read-write during boot.

---
V1->V2:
* improved commit log
* removed commented line in extlinux.conf
* removed one boot option from extlinux.conf

Quoted 4 lines

V2->V3:
* improved commit log

That's right?

Yes, this works for me now

Quoted 25 lines
Quoted 21 lines
Quoted 8 lines

+++ b/board/orangepi/common/genimage.cfg

board/orangepi/common/genimage.cfg new file +5 -0
@@ -0,0 +1,23 @@
+image sdcard.img {
+    partition u-boot {
+        in-partition-table = false
+        image = "u-boot-sunxi-with-spl.bin"
+        offset = 8K

board/orangepi/common/genimage.cfg line 15

Quoted 10 lines
board/orangepi/common/genimage.cfg new file +10 -0
+        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

Why don’t you make this part ^^^ automatic with a script or you simply use genimage itself?

Quoted 3 lines

What it’s expected as board defconfig is something that you burn a sdcard with the sdcard.img file and that’s it. So here you need to make it automatic.

So we wait for V3 with the commit log form you read above and requested changes.

Quoted 8 lines

The problem is that it is not possible to create an sdcard.img image with the correct GPT structure. The second copy of the GPT must be at the end of the disk, and the size of sdcard.img will not match the SD card. Will work and so, with one copy of GPT. But the disk utilities may issue a warning about the absence of a second copy of the GPT. You can correct the situation only after writing sdcard.img to the SD card, or during the first loading of the board in a separate script. This is out of scope for this patch.

Quoted 1 line

Ok, so please remove those 3 commented lines since I think the board actually works without those additional commands, correct?

Yes.

Quoted 5 lines

Otherwise, it this doesn't work on target without gdisk commands, you need to add a post-image.sh script to launch those commands.

Thank you!
Best regards

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot

#5 lore raw

Hi Sergey,

Quoted 99 lines

Il giorno 6 feb 2022, alle ore 00:17, Sergey Kuzminov <[email protected]> ha scritto:

06.02.2022 02:13, Giulio Benetti пишет:

Quoted 96 lines

Hi Sergey,

Quoted 57 lines · Sergey Kuzminov

Hi Giulio,

06.02.2022 01:18, Giulio Benetti:

Quoted 32 lines

Hi Sergey,

below I give you a better example of commit log,
and the dealing with V1->V2 series.

Quoted 4 lines

Il giorno 5 feb 2022, alle ore 22:56, Sergey Kuzminov <[email protected]> ha scritto:

Changes:
v1:

Please Remove this line ^^^

Quoted 6 lines

- Exclude FAT partition, it 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.

v2:

Remove this ^^^ line

Quoted 1 line

- Fix typo in first line of changes (s/he/it).

This too ^^^

Quoted 1 line

- Add BR2_TARGET_GENERIC_REMOUNT_ROOTFS_RW=y.

Here we need an explanation of the reason why, what this implies.

Quoted 1 line

- Exclude one boot option from extlinux.conf.

This ^^^ too

Quoted 2 lines

—-
V1->V2:
* improved commit log
* removed commented line in extlinux.conf
* removed one boot option from extlinux.conf

Quoted 5 lines
Quoted 1 line

---

So as you can see, commit log doesn’t mention the patch version, while after the 3 dashes you can write in general whatever you want because it won’t be part of commit log and it’s usually used to report V1->V2 version etc.

Changes:
* Exclude FAT partition, it 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.
* Add BR2_TARGET_GENERIC_REMOUNT_ROOTFS_RW=y, remount root filesystem read-write during boot.

---
V1->V2:
* improved commit log
* removed commented line in extlinux.conf
* removed one boot option from extlinux.conf

Quoted 4 lines

V2->V3:
* improved commit log

That's right?

Yes, this works for me now

Quoted 33 lines
Quoted 21 lines
Quoted 8 lines

+++ b/board/orangepi/common/genimage.cfg

board/orangepi/common/genimage.cfg new file +5 -0
@@ -0,0 +1,23 @@
+image sdcard.img {
+    partition u-boot {
+        in-partition-table = false
+        image = "u-boot-sunxi-with-spl.bin"
+        offset = 8K

board/orangepi/common/genimage.cfg line 15

Quoted 10 lines
board/orangepi/common/genimage.cfg new file +10 -0
+        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

Why don’t you make this part ^^^ automatic with a script or you simply use genimage itself?

Quoted 3 lines

What it’s expected as board defconfig is something that you burn a sdcard with the sdcard.img file and that’s it. So here you need to make it automatic.

So we wait for V3 with the commit log form you read above and requested changes.

The problem is that it is not possible to create an sdcard.img image with the correct GPT structure. The second copy of the GPT must be at the end of the disk, and the size of sdcard.img will not match the SD card. Will work and so, with one copy of GPT. But the disk utilities may issue a warning about the absence of a second copy of the GPT. You can correct the situation only after writing sdcard.img to the SD card, or during the first loading of the board in a separate script. This is out of scope for this patch.

Quoted 3 lines
Quoted 1 line

Ok, so please remove those 3 commented lines since I think the board actually works without those additional commands, correct?

Yes.

Perfect, so you can send the V3 patch.
Please remember to keep my Reviewed-by and Tested-by after your SoB that I’ve given you on V1 patch.

You can follow patchwork here:
https://patchwork.ozlabs.org/project/buildroot/list/

You should also subscribe to patchwork and mark your V1 and V2 patches as superseded.

Thank you
Giulio

Quoted 5 lines
Quoted 4 lines

Otherwise, it this doesn't work on target without gdisk commands, you need to add a post-image.sh script to launch those commands. Thank you!
Best regards

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot