diff mbox series

[2/5] board/boundarydevices: update post-build.sh for i.MX8MQ platforms

Message ID 20180719073253.22433-3-gary.bisson@boundarydevices.com
State Superseded
Headers show
Series Add Boundary Devices Nitrogen8M support | expand

Commit Message

Gary Bisson July 19, 2018, 7:32 a.m. UTC
- Making sure to use proper ARCH for mkimage command
- Remove obsolete 6x_bootscript/6x_upgrade references
- Copy bootloader as u-boot.<defconfig_name>

Signed-off-by: Gary Bisson <gary.bisson@boundarydevices.com>
---
 board/boundarydevices/common/post-build.sh | 28 ++++++++++++----------
 1 file changed, 16 insertions(+), 12 deletions(-)

Comments

Thomas Petazzoni July 19, 2018, 7:58 a.m. UTC | #1
Hello,

On Thu, 19 Jul 2018 09:32:50 +0200, Gary Bisson wrote:
> - Making sure to use proper ARCH for mkimage command
> - Remove obsolete 6x_bootscript/6x_upgrade references
> - Copy bootloader as u-boot.<defconfig_name>
> 
> Signed-off-by: Gary Bisson <gary.bisson@boundarydevices.com>

This patch is doing quite a few things that are in fact separate, which
kind of calls for separate patches.

Removing the use of the obsolete 6x_bootscript and 6x_upgrade scripts
should be one patch, which also removes those files (in the same patch).

Then, adding support for using a ARCH/UBOOT_BINARY value that depends
on BR2_aarch64 should be another patch.

Finally, why do you copy the bootloader as u-boot.<defconfig_name> ?

Thanks!

Thomas
Gary Bisson July 19, 2018, 8:03 a.m. UTC | #2
Hi Thomas,

On Thu, Jul 19, 2018 at 09:58:43AM +0200, Thomas Petazzoni wrote:
> Hello,
> 
> On Thu, 19 Jul 2018 09:32:50 +0200, Gary Bisson wrote:
> > - Making sure to use proper ARCH for mkimage command
> > - Remove obsolete 6x_bootscript/6x_upgrade references
> > - Copy bootloader as u-boot.<defconfig_name>
> > 
> > Signed-off-by: Gary Bisson <gary.bisson@boundarydevices.com>
> 
> This patch is doing quite a few things that are in fact separate, which
> kind of calls for separate patches.

Ok.

> Removing the use of the obsolete 6x_bootscript and 6x_upgrade scripts
> should be one patch, which also removes those files (in the same patch).

Ok.

> Then, adding support for using a ARCH/UBOOT_BINARY value that depends
> on BR2_aarch64 should be another patch.

Ok.

> Finally, why do you copy the bootloader as u-boot.<defconfig_name> ?

That is actually what the upgrade.cmd looks for, it was wrong to copy it
as u-boot.imx in the first place anyway.
https://git.buildroot.net/buildroot/tree/board/boundarydevices/common/upgrade.cmd#n66

Regards,
Gary
Thomas Petazzoni July 19, 2018, 8:08 a.m. UTC | #3
Hello,

On Thu, 19 Jul 2018 10:03:41 +0200, Gary Bisson wrote:

> > Finally, why do you copy the bootloader as u-boot.<defconfig_name> ?  
> 
> That is actually what the upgrade.cmd looks for, it was wrong to copy it
> as u-boot.imx in the first place anyway.
> https://git.buildroot.net/buildroot/tree/board/boundarydevices/common/upgrade.cmd#n66

And so the upgrade.cmd logic is broken today, independently from the
i.MX8 addition? If so, that definitely calls for a separate patch.

(However, it's not clear to me why you had two upgrade scripts, and
which one was used in which situation).

Thomas
Gary Bisson July 19, 2018, 8:15 a.m. UTC | #4
Hi Thomas,

On Thu, Jul 19, 2018 at 10:08:37AM +0200, Thomas Petazzoni wrote:
> Hello,
> 
> On Thu, 19 Jul 2018 10:03:41 +0200, Gary Bisson wrote:
> 
> > > Finally, why do you copy the bootloader as u-boot.<defconfig_name> ?  
> > 
> > That is actually what the upgrade.cmd looks for, it was wrong to copy it
> > as u-boot.imx in the first place anyway.
> > https://git.buildroot.net/buildroot/tree/board/boundarydevices/common/upgrade.cmd#n66
> 
> And so the upgrade.cmd logic is broken today, independently from the
> i.MX8 addition? If so, that definitely calls for a separate patch.

Yes, although you could set uboot_defconfig to "imx" and then it would
work(around). It became clear this wasn't the solution now that U-Boot
doesn't produce u-boot.imx for ARM64.

> (However, it's not clear to me why you had two upgrade scripts, and
> which one was used in which situation).

It was legacy, 6x_upgrade was created at the beginning of our i.MX6
journey. But since we switched to U-Boot v2017.07, we used standard
bootdistro variables and renamed the script to be more generic:
upgrade.scr.
https://git.buildroot.net/buildroot/commit/board/boundarydevices/common?id=505ae63b

Regards,
Gary
diff mbox series

Patch

diff --git a/board/boundarydevices/common/post-build.sh b/board/boundarydevices/common/post-build.sh
index b8abb26540..161ec0643f 100755
--- a/board/boundarydevices/common/post-build.sh
+++ b/board/boundarydevices/common/post-build.sh
@@ -6,20 +6,24 @@ 
 #
 
 BOARD_DIR="$(dirname $0)"
+UBOOT_DEFCONFIG="$(grep BR2_TARGET_UBOOT_BOARD_DEFCONFIG ${BR2_CONFIG} | sed 's/.*\"\(.*\)\"/\1/')"
+
+if grep -Eq "^BR2_aarch64=y$" ${BR2_CONFIG}; then
+	MKIMAGE_ARCH=arm64
+	UBOOT_BINARY=imx8-boot-sd.bin
+else
+	MKIMAGE_ARCH=arm
+	UBOOT_BINARY=u-boot.imx
+fi
 
 # bd u-boot looks for standard bootscript
-install -m 0644 -D $BINARIES_DIR/boot.scr $TARGET_DIR/boot/
-# legacy 6x_bootscript script
-$HOST_DIR/bin/mkimage -A arm -O linux -T script -C none -a 0 -e 0 \
--n "boot script" -d $BOARD_DIR/6x_bootscript.txt $TARGET_DIR/6x_bootscript
+$HOST_DIR/bin/mkimage -A $MKIMAGE_ARCH -O linux -T script -C none -a 0 -e 0 \
+    -n "boot script" -d $BOARD_DIR/boot.cmd $TARGET_DIR/boot/boot.scr
 
 # u-boot / update script for bd upgradeu command
-if [ -e $BINARIES_DIR/u-boot.imx ];
-then
-    install -D -m 0644 $BINARIES_DIR/u-boot.imx $TARGET_DIR/u-boot.imx
-    $HOST_DIR/bin/mkimage -A arm -O linux -T script -C none -a 0 -e 0 \
-    -n "upgrade script" -d $BOARD_DIR/upgrade.cmd $TARGET_DIR/upgrade.scr
-    # legacy 6x_upgrade script
-    $HOST_DIR/bin/mkimage -A arm -O linux -T script -C none -a 0 -e 0 \
-    -n "upgrade script" -d $BOARD_DIR/6x_upgrade.txt $TARGET_DIR/6x_upgrade
+if [ -e $BINARIES_DIR/$UBOOT_BINARY ]; then
+    install -D -m 0644 $BINARIES_DIR/$UBOOT_BINARY \
+        $TARGET_DIR/u-boot.$UBOOT_DEFCONFIG
+    $HOST_DIR/bin/mkimage -A $MKIMAGE_ARCH -O linux -T script -C none -a 0 -e 0 \
+        -n "upgrade script" -d $BOARD_DIR/upgrade.cmd $TARGET_DIR/upgrade.scr
 fi