diff mbox series

[v12,09/16] board/ti/am62x-sk: generalize post-build.sh

Message ID 20240407103512.1112712-10-romain.naour@smile.fr
State Accepted
Headers show
Series Add support for AM62x-SK HS-FS devices | expand

Commit Message

Romain Naour April 7, 2024, 10:35 a.m. UTC
From: Dario Binacchi <dario.binacchi@amarulasolutions.com>

Removing any explicit reference to the ti_am62x_sk_defconfig
configuration, the script can also be used by other configurations or at
least by ti_am64x_sk_defconfig.

Signed-off-by: Dario Binacchi <dario.binacchi@amarulasolutions.com>
Signed-off-by: Romain Naour <romain.naour@smile.fr>
---

Added in v8
---
 board/ti/am62x-sk/post-build.sh | 10 +++++++---
 configs/ti_am62x_sk_defconfig   |  2 +-
 2 files changed, 8 insertions(+), 4 deletions(-)

Comments

Arnout Vandecappelle April 8, 2024, 1:25 p.m. UTC | #1
On 07/04/2024 12:35, Romain Naour wrote:
> From: Dario Binacchi <dario.binacchi@amarulasolutions.com>
> 
> Removing any explicit reference to the ti_am62x_sk_defconfig
> configuration, the script can also be used by other configurations or at
> least by ti_am64x_sk_defconfig.
> 
> Signed-off-by: Dario Binacchi <dario.binacchi@amarulasolutions.com>
> Signed-off-by: Romain Naour <romain.naour@smile.fr>
> ---
> 
> Added in v8
> ---
>   board/ti/am62x-sk/post-build.sh | 10 +++++++---

  Keeping in mind the above remark that it can be reused for ti_am64x, perhaps 
move it to board/ti/common or board/ti/common-am6x or something like that?

  Same for the hash files BTW.

  For me it's fine to apply as is and clean this up afterwards.

>   configs/ti_am62x_sk_defconfig   |  2 +-
>   2 files changed, 8 insertions(+), 4 deletions(-)
> 
> diff --git a/board/ti/am62x-sk/post-build.sh b/board/ti/am62x-sk/post-build.sh
> index 4f19f4d6cf..d066e28fd0 100755
> --- a/board/ti/am62x-sk/post-build.sh
> +++ b/board/ti/am62x-sk/post-build.sh
> @@ -12,8 +12,8 @@ EOF
>     exit 1
>   }
>   
> -o='c:d:r:x:'
> -O='console:,devicetree:,root:,extra-args:'
> +o='c:d:l:r:x:'
> +O='console:,devicetree:,label:,root:,extra-args:'
>   opts="$(getopt -n "${0##*/}" -o "${o}" -l "${O}" -- "${@}")"
>   eval set -- "${opts}"
>   while [ ${#} -gt 0 ]; do
> @@ -24,6 +24,9 @@ while [ ${#} -gt 0 ]; do
>       (-d|--devicetree)
>           DEVICETREE="${2}"; shift 2
>           ;;
> +    (-l|--label)
> +        LABEL="${2}"; shift 2
> +        ;;
>       (-r|--root)
>           ROOT="${2}"; shift 2
>           ;;
> @@ -38,6 +41,7 @@ done
>   
>   [ -n "${CONSOLE}" ] || die "Missing \`console' argument"
>   [ -n "${DEVICETREE}" ] || die "Missing \`devicetree' argument"
> +[ -n "${LABEL}" ] || die "Missing \`label' argument"
>   [ -n "${ROOT}" ] || die "Missing \`root' argument"
>   append="console=${CONSOLE} root=${ROOT} rw rootfstype=ext4 rootwait"
>   if [ -n "${EXTRA_ARGS}" ]; then
> @@ -46,7 +50,7 @@ fi
>   
>   mkdir -p "${BINARIES_DIR}"
>   cat <<-__HEADER_EOF > "${BINARIES_DIR}/extlinux.conf"
> -	label am62x-sk-buildroot
> +	label ${LABEL}

  AFAIK the label is completely meaningless when you use extlinux.conf from 
U-Boot. It's used as the menu entry in the extlinux bootloader, but in U-Boot I 
think it's just the first one which gets chosen, without menu. And regardless, 
we have one entry anyway. So can't we just set the label to "buildroot"?

  If we do set a label, I would use BR2_TARGET_GENERIC_HOSTNAME instead of 
adding yet another option in the post-build script.

  Regards,
  Arnout

>   	  kernel /Image
>   	  fdtdir /
>   	  devicetree /${DEVICETREE}
> diff --git a/configs/ti_am62x_sk_defconfig b/configs/ti_am62x_sk_defconfig
> index d4b19e5039..1c7085d04d 100644
> --- a/configs/ti_am62x_sk_defconfig
> +++ b/configs/ti_am62x_sk_defconfig
> @@ -3,7 +3,7 @@ BR2_PACKAGE_HOST_LINUX_HEADERS_CUSTOM_6_6=y
>   BR2_GLOBAL_PATCH_DIR="board/ti/am62x-sk/patches"
>   BR2_DOWNLOAD_FORCE_CHECK_HASHES=y
>   BR2_ROOTFS_POST_BUILD_SCRIPT="board/ti/am62x-sk/post-build.sh"
> -BR2_ROOTFS_POST_BUILD_SCRIPT_ARGS="-c ttyS2,115200n8 -d k3-am625-sk.dtb -r /dev/mmcblk1p2 -x earlycon=ns16550a,mmio32,0x02800000"
> +BR2_ROOTFS_POST_BUILD_SCRIPT_ARGS="-c ttyS2,115200n8 -d k3-am625-sk.dtb -l am62x-sk-buildroot -r /dev/mmcblk1p2 -x earlycon=ns16550a,mmio32,0x02800000"
>   BR2_ROOTFS_POST_IMAGE_SCRIPT="support/scripts/genimage.sh"
>   BR2_ROOTFS_POST_IMAGE_SCRIPT_ARGS="-c board/ti/am62x-sk/genimage.cfg"
>   BR2_LINUX_KERNEL=y
Romain Naour April 9, 2024, 11:41 a.m. UTC | #2
Hello Arnout,

Le 08/04/2024 à 15:25, Arnout Vandecappelle a écrit :
> 
> 
> On 07/04/2024 12:35, Romain Naour wrote:
>> From: Dario Binacchi <dario.binacchi@amarulasolutions.com>
>>
>> Removing any explicit reference to the ti_am62x_sk_defconfig
>> configuration, the script can also be used by other configurations or at
>> least by ti_am64x_sk_defconfig.
>>
>> Signed-off-by: Dario Binacchi <dario.binacchi@amarulasolutions.com>
>> Signed-off-by: Romain Naour <romain.naour@smile.fr>
>> ---
>>
>> Added in v8
>> ---
>>   board/ti/am62x-sk/post-build.sh | 10 +++++++---
> 
>  Keeping in mind the above remark that it can be reused for ti_am64x, perhaps
> move it to board/ti/common or board/ti/common-am6x or something like that?
> 
>  Same for the hash files BTW.
> 
>  For me it's fine to apply as is and clean this up afterwards.
> 
>>   configs/ti_am62x_sk_defconfig   |  2 +-
>>   2 files changed, 8 insertions(+), 4 deletions(-)
>>
>> diff --git a/board/ti/am62x-sk/post-build.sh b/board/ti/am62x-sk/post-build.sh
>> index 4f19f4d6cf..d066e28fd0 100755
>> --- a/board/ti/am62x-sk/post-build.sh
>> +++ b/board/ti/am62x-sk/post-build.sh
>> @@ -12,8 +12,8 @@ EOF
>>     exit 1
>>   }
>>   -o='c:d:r:x:'
>> -O='console:,devicetree:,root:,extra-args:'
>> +o='c:d:l:r:x:'
>> +O='console:,devicetree:,label:,root:,extra-args:'
>>   opts="$(getopt -n "${0##*/}" -o "${o}" -l "${O}" -- "${@}")"
>>   eval set -- "${opts}"
>>   while [ ${#} -gt 0 ]; do
>> @@ -24,6 +24,9 @@ while [ ${#} -gt 0 ]; do
>>       (-d|--devicetree)
>>           DEVICETREE="${2}"; shift 2
>>           ;;
>> +    (-l|--label)
>> +        LABEL="${2}"; shift 2
>> +        ;;
>>       (-r|--root)
>>           ROOT="${2}"; shift 2
>>           ;;
>> @@ -38,6 +41,7 @@ done
>>     [ -n "${CONSOLE}" ] || die "Missing \`console' argument"
>>   [ -n "${DEVICETREE}" ] || die "Missing \`devicetree' argument"
>> +[ -n "${LABEL}" ] || die "Missing \`label' argument"
>>   [ -n "${ROOT}" ] || die "Missing \`root' argument"
>>   append="console=${CONSOLE} root=${ROOT} rw rootfstype=ext4 rootwait"
>>   if [ -n "${EXTRA_ARGS}" ]; then
>> @@ -46,7 +50,7 @@ fi
>>     mkdir -p "${BINARIES_DIR}"
>>   cat <<-__HEADER_EOF > "${BINARIES_DIR}/extlinux.conf"
>> -    label am62x-sk-buildroot
>> +    label ${LABEL}
> 
>  AFAIK the label is completely meaningless when you use extlinux.conf from
> U-Boot. It's used as the menu entry in the extlinux bootloader, but in U-Boot I
> think it's just the first one which gets chosen, without menu. And regardless,
> we have one entry anyway. So can't we just set the label to "buildroot"?
> 
>  If we do set a label, I would use BR2_TARGET_GENERIC_HOSTNAME instead of adding
> yet another option in the post-build script.

I'll keep this as is in order to merge this series.

Best regards,
Romain

> 
>  Regards,
>  Arnout
> 
>>         kernel /Image
>>         fdtdir /
>>         devicetree /${DEVICETREE}
>> diff --git a/configs/ti_am62x_sk_defconfig b/configs/ti_am62x_sk_defconfig
>> index d4b19e5039..1c7085d04d 100644
>> --- a/configs/ti_am62x_sk_defconfig
>> +++ b/configs/ti_am62x_sk_defconfig
>> @@ -3,7 +3,7 @@ BR2_PACKAGE_HOST_LINUX_HEADERS_CUSTOM_6_6=y
>>   BR2_GLOBAL_PATCH_DIR="board/ti/am62x-sk/patches"
>>   BR2_DOWNLOAD_FORCE_CHECK_HASHES=y
>>   BR2_ROOTFS_POST_BUILD_SCRIPT="board/ti/am62x-sk/post-build.sh"
>> -BR2_ROOTFS_POST_BUILD_SCRIPT_ARGS="-c ttyS2,115200n8 -d k3-am625-sk.dtb -r
>> /dev/mmcblk1p2 -x earlycon=ns16550a,mmio32,0x02800000"
>> +BR2_ROOTFS_POST_BUILD_SCRIPT_ARGS="-c ttyS2,115200n8 -d k3-am625-sk.dtb -l
>> am62x-sk-buildroot -r /dev/mmcblk1p2 -x earlycon=ns16550a,mmio32,0x02800000"
>>   BR2_ROOTFS_POST_IMAGE_SCRIPT="support/scripts/genimage.sh"
>>   BR2_ROOTFS_POST_IMAGE_SCRIPT_ARGS="-c board/ti/am62x-sk/genimage.cfg"
>>   BR2_LINUX_KERNEL=y
diff mbox series

Patch

diff --git a/board/ti/am62x-sk/post-build.sh b/board/ti/am62x-sk/post-build.sh
index 4f19f4d6cf..d066e28fd0 100755
--- a/board/ti/am62x-sk/post-build.sh
+++ b/board/ti/am62x-sk/post-build.sh
@@ -12,8 +12,8 @@  EOF
   exit 1
 }
 
-o='c:d:r:x:'
-O='console:,devicetree:,root:,extra-args:'
+o='c:d:l:r:x:'
+O='console:,devicetree:,label:,root:,extra-args:'
 opts="$(getopt -n "${0##*/}" -o "${o}" -l "${O}" -- "${@}")"
 eval set -- "${opts}"
 while [ ${#} -gt 0 ]; do
@@ -24,6 +24,9 @@  while [ ${#} -gt 0 ]; do
     (-d|--devicetree)
         DEVICETREE="${2}"; shift 2
         ;;
+    (-l|--label)
+        LABEL="${2}"; shift 2
+        ;;
     (-r|--root)
         ROOT="${2}"; shift 2
         ;;
@@ -38,6 +41,7 @@  done
 
 [ -n "${CONSOLE}" ] || die "Missing \`console' argument"
 [ -n "${DEVICETREE}" ] || die "Missing \`devicetree' argument"
+[ -n "${LABEL}" ] || die "Missing \`label' argument"
 [ -n "${ROOT}" ] || die "Missing \`root' argument"
 append="console=${CONSOLE} root=${ROOT} rw rootfstype=ext4 rootwait"
 if [ -n "${EXTRA_ARGS}" ]; then
@@ -46,7 +50,7 @@  fi
 
 mkdir -p "${BINARIES_DIR}"
 cat <<-__HEADER_EOF > "${BINARIES_DIR}/extlinux.conf"
-	label am62x-sk-buildroot
+	label ${LABEL}
 	  kernel /Image
 	  fdtdir /
 	  devicetree /${DEVICETREE}
diff --git a/configs/ti_am62x_sk_defconfig b/configs/ti_am62x_sk_defconfig
index d4b19e5039..1c7085d04d 100644
--- a/configs/ti_am62x_sk_defconfig
+++ b/configs/ti_am62x_sk_defconfig
@@ -3,7 +3,7 @@  BR2_PACKAGE_HOST_LINUX_HEADERS_CUSTOM_6_6=y
 BR2_GLOBAL_PATCH_DIR="board/ti/am62x-sk/patches"
 BR2_DOWNLOAD_FORCE_CHECK_HASHES=y
 BR2_ROOTFS_POST_BUILD_SCRIPT="board/ti/am62x-sk/post-build.sh"
-BR2_ROOTFS_POST_BUILD_SCRIPT_ARGS="-c ttyS2,115200n8 -d k3-am625-sk.dtb -r /dev/mmcblk1p2 -x earlycon=ns16550a,mmio32,0x02800000"
+BR2_ROOTFS_POST_BUILD_SCRIPT_ARGS="-c ttyS2,115200n8 -d k3-am625-sk.dtb -l am62x-sk-buildroot -r /dev/mmcblk1p2 -x earlycon=ns16550a,mmio32,0x02800000"
 BR2_ROOTFS_POST_IMAGE_SCRIPT="support/scripts/genimage.sh"
 BR2_ROOTFS_POST_IMAGE_SCRIPT_ARGS="-c board/ti/am62x-sk/genimage.cfg"
 BR2_LINUX_KERNEL=y