Skip to contentSkip to conversation

board: tbs2910: disable loadb and loads commands

PATCH Superseded Denis 'GNUtoo' Carikli 4 participants 12 messages Feb 8, 2020 – Feb 28, 2020

v3 of 5 Superseded Latest is v5 →

lore
Share & tools
lore
#0 lore raw

PATCH v3 1/6 board: tbs2910: disable loadb and loads commands

The loadb and loads commands are not needed for booting.

There are also more reliable and faster alternatives to loadb and loads that can be used with the current configuration.

As that the resulting image is already very close to the size limit, removing the loadb and loads commands shouldn't hurt.

With arm-linux-gnueabi-gcc 9.2.0-1 from the Parabola GNU/Linux distribution we have the following size reduction:
- text: 6733 bytes
- data: 116 bytes
- bss: 1172 bytes
- total: 8021 bytes

---
 configs/tbs2910_defconfig | 2 ++
 1 file changed, 2 insertions(+)
configs/tbs2910_defconfig +2 -0
index 61d4c74324..570ae850e4 100644
@@ -26,6 +26,8 @@ CONFIG_CMD_BOOTZ=y
 CONFIG_CMD_MEMTEST=y
 CONFIG_CMD_GPIO=y
 CONFIG_CMD_I2C=y
+# CONFIG_CMD_LOADB is not set
+# CONFIG_CMD_LOADS is not set
 CONFIG_CMD_MMC=y
 CONFIG_CMD_PART=y
 CONFIG_CMD_PCI=y
Signature · 1 line
2.25.0
#1 lore raw

PATCH v3 2/6 board: tbs2910: disable CONFIG_GZIP

As that the resulting image is already very close to the size limit, and that CONFIG_GZIP is not strictly required, removing it shouldn't hurt.

With arm-linux-gnueabi-gcc 9.2.0-1 from the Parabola GNU/Linux distribution we have the following size reduction:
- text: 9752
- data: 0
- bss: 16
- total: 9768

---
 configs/tbs2910_defconfig | 1 +
 1 file changed, 1 insertion(+)
configs/tbs2910_defconfig +1 -0
index 570ae850e4..fcaa101044 100644
@@ -86,5 +86,6 @@ CONFIG_USB_GADGET_DOWNLOAD=y
 CONFIG_I2C_EDID=y
 CONFIG_VIDEO_IPUV3=y
 CONFIG_VIDEO=y
+# CONFIG_GZIP is not set
 CONFIG_OF_LIBFDT_ASSUME_MASK=0xff
 # CONFIG_EFI_LOADER is not set
Signature · 1 line
2.25.0
#2 lore raw

PATCH v3 3/6 board: tbs2910: move CONFIG_BOOTCOMMAND from header to defconfig

In reply to Denis 'GNUtoo' Carikli

This doesn't affect the size of the image: with arm-linux-gnueabi-gcc 9.2.0-1 from the Parabola GNU/Linux distribution, the text, data, bss and total sizes remain unchanged.

---
 configs/tbs2910_defconfig | 2 ++
 include/configs/tbs2910.h | 8 --------
 2 files changed, 2 insertions(+), 8 deletions(-)
configs/tbs2910_defconfig +2 -0
index fcaa101044..5603bef64e 100644
@@ -10,6 +10,8 @@ CONFIG_PRE_CON_BUF_ADDR=0x7c000000
 CONFIG_CMD_HDMIDETECT=y
 CONFIG_AHCI=y
 CONFIG_BOOTDELAY=3
+CONFIG_USE_BOOTCOMMAND=y
+CONFIG_BOOTCOMMAND="mmc rescan; if run bootcmd_up1; then run bootcmd_up2; else run bootcmd_mmc; fi"
 CONFIG_USE_PREBOOT=y
 CONFIG_PREBOOT="echo PCI:; pci enum; pci 1; usb start; if hdmidet; then run set_con_hdmi; else run set_con_serial; fi"
 CONFIG_PRE_CONSOLE_BUFFER=y
include/configs/tbs2910.h +0 -8
index b598fca1ec..3975f4cc8b 100644
@@ -104,12 +104,4 @@
 	"stdin=serial,usbkbd\0" \
 	"stdout=serial,vga\0"
 
-#define CONFIG_BOOTCOMMAND \
-	"mmc rescan; " \
-	"if run bootcmd_up1; then " \
-		"run bootcmd_up2; " \
-	"else " \
-		"run bootcmd_mmc; " \
-	"fi"
-
 #endif			       /* __TBS2910_CONFIG_H * */
Signature · 1 line
2.25.0
#3 lore raw

PATCH v3 4/6 board: tbs2910: enable CONFIG_DISTRO_DEFAULTS

In reply to Denis 'GNUtoo' Carikli

The side effect is that it increase the size of the resultimg image, which is already very close to the size limit.

With arm-linux-gnueabi-gcc 9.2.0-1 from the Parabola GNU/Linux distribution, we have the following size increase:
- text: 8744 bytes
- data: 132 bytes
- bss: 60 bytes
- total: 8936 bytes

---
 configs/tbs2910_defconfig | 16 ++--------------
 1 file changed, 2 insertions(+), 14 deletions(-)
configs/tbs2910_defconfig +2 -14
index 5603bef64e..1cf09bb741 100644
@@ -9,18 +9,15 @@ CONFIG_NR_DRAM_BANKS=1
 CONFIG_PRE_CON_BUF_ADDR=0x7c000000
 CONFIG_CMD_HDMIDETECT=y
 CONFIG_AHCI=y
+CONFIG_DISTRO_DEFAULTS=y
 CONFIG_BOOTDELAY=3
-CONFIG_USE_BOOTCOMMAND=y
 CONFIG_BOOTCOMMAND="mmc rescan; if run bootcmd_up1; then run bootcmd_up2; else run bootcmd_mmc; fi"
 CONFIG_USE_PREBOOT=y
 CONFIG_PREBOOT="echo PCI:; pci enum; pci 1; usb start; if hdmidet; then run set_con_hdmi; else run set_con_serial; fi"
 CONFIG_PRE_CONSOLE_BUFFER=y
-CONFIG_SUPPORT_RAW_INITRD=y
 CONFIG_BOUNCE_BUFFER=y
 CONFIG_BOARD_EARLY_INIT_F=y
-CONFIG_HUSH_PARSER=y
 CONFIG_SYS_PROMPT="Matrix U-Boot> "
-CONFIG_CMD_BOOTZ=y
 # CONFIG_BOOTM_PLAN9 is not set
 # CONFIG_BOOTM_RTEMS is not set
 # CONFIG_BOOTM_VXWORKS is not set
@@ -31,22 +28,14 @@ CONFIG_CMD_I2C=y
 # CONFIG_CMD_LOADB is not set
 # CONFIG_CMD_LOADS is not set
 CONFIG_CMD_MMC=y
-CONFIG_CMD_PART=y
 CONFIG_CMD_PCI=y
 CONFIG_CMD_SATA=y
 CONFIG_CMD_USB=y
 CONFIG_CMD_USB_MASS_STORAGE=y
-CONFIG_CMD_DHCP=y
-CONFIG_CMD_MII=y
-CONFIG_CMD_PING=y
 CONFIG_CMD_CACHE=y
 CONFIG_CMD_TIME=y
-CONFIG_CMD_EXT2=y
-CONFIG_CMD_EXT4=y
 CONFIG_CMD_EXT4_WRITE=y
-CONFIG_CMD_FAT=y
-CONFIG_CMD_FS_GENERIC=y
-CONFIG_EFI_PARTITION=y
+# CONFIG_ISO_PARTITION is not set
 CONFIG_OF_CONTROL=y
 CONFIG_OF_EMBED=y
 CONFIG_DEFAULT_DEVICE_TREE="imx6q-tbs2910"
@@ -76,7 +65,6 @@ CONFIG_RTC_DS1307=y
 CONFIG_DM_THERMAL=y
 CONFIG_USB=y
 CONFIG_DM_USB=y
-CONFIG_USB_STORAGE=y
 CONFIG_USB_KEYBOARD=y
 CONFIG_SYS_USB_EVENT_POLL_VIA_INT_QUEUE=y
 CONFIG_USB_GADGET=y
Signature · 1 line
2.25.0
#4 lore raw

PATCH v3 4/6 board: tbs2910: enable CONFIG_DISTRO_DEFAULTS

Quoted 12 lines · Denis 'GNUtoo' Carikli

The side effect is that it increase the size of the resultimg image, which is already very close to the size limit.

With arm-linux-gnueabi-gcc 9.2.0-1 from the Parabola GNU/Linux distribution, we have the following size increase:
- text: 8744 bytes
- data: 132 bytes
- bss: 60 bytes
- total: 8936 bytes

Quoted 1 line

Thank you very much for splitting up the patches and for your thorough size analysis. This makes it very easy to understand the size contributions of the several parts.

It was really surprising for me that CONFIG_DISTRO_DEFAULTS brings so much additional text. I thought this would only enable CONFIG_CMD_SYSBOOT, but we also get PXE support. I wasn't aware of this before.

As you already noticed, we are quite close to the size limit of the u-boot binary. So I would prefer to omit PXE.

Do you really want to use PXE boot on this board? Or would it be OK to only enable CMD_SYSBOOT instead of DISTRO_DEFAULTS (and remove DHCP and PXE boot targets in patch 5/6)?

Sorry for not bringing up this earlier,
Soeren

#5 lore raw

PATCH v3 4/6 board: tbs2910: enable CONFIG_DISTRO_DEFAULTS

Quoted 14 lines · Soeren Moch
Quoted 12 lines · Denis 'GNUtoo' Carikli

The side effect is that it increase the size of the resultimg image, which is already very close to the size limit.

With arm-linux-gnueabi-gcc 9.2.0-1 from the Parabola GNU/Linux distribution, we have the following size increase:
- text: 8744 bytes
- data: 132 bytes
- bss: 60 bytes
- total: 8936 bytes

Quoted 1 line
Quoted 8 lines

Thank you very much for splitting up the patches and for your thorough size analysis. This makes it very easy to understand the size contributions of the several parts.

It was really surprising for me that CONFIG_DISTRO_DEFAULTS brings so much additional text. I thought this would only enable CONFIG_CMD_SYSBOOT, but we also get PXE support. I wasn't aware of this before.

Distro boot brings in a ton of "support booting via any supported IO device" code.

That said, the "bring in PXE" part of DISTRO_DEFAULTS predates sysboot being pulled out of the PXE code, where it was historically introduced. I would like to see a patch to change this part, stand-alone and CC'ing the distribution folks that might have something to say about this. I know there are use-cases for it, but I don't know how critical they are to be everywhere by default vs opt-in. Thanks all!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <https://lists.denx.de/pipermail/u-boot/attachments/20200210/8ca8d96c/attachment.sig>
#6 lore raw

PATCH v3 4/6 board: tbs2910: enable CONFIG_DISTRO_DEFAULTS

Quoted 7 lines · On Mon, 10 Feb 2020 09:40:50 -0500 Tom Rini <[email protected]> wrote:

That said, the "bring in PXE" part of DISTRO_DEFAULTS predates sysboot being pulled out of the PXE code, where it was historically introduced. I would like to see a patch to change this part, stand-alone and CC'ing the distribution folks that might have something to say about this. I know there are use-cases for it, but I don't know how critical they are to be everywhere by default vs opt-in. Thanks all!

I've done the patch, but I've not sent it yet.

With it, if board are using things like func(PXE, pxe, na) in BOOT_TARGET_DEVICES, it will breaks the compilation, and we would have an error that looks like that:

Quoted 8 lines

In file included from include/configs/tbs2910.h:19,

                 from include/config.h:5,
                 from include/common.h:16,
                 from env/common.c:10:

include/config_distro_bootcmd.h:398:2: error: expected '}' before 'BOOT_TARGET_DEVICES_references_PXE_without_CONFIG_CMD_DHCP_or_PXE' 398 | BOOT_TARGET_DEVICES_references_PXE_without_CONFIG_CMD_DHCP_or_PXE

Should I still send the patch as-is by mentioning that issue somehow, in order to start a discussion on the topic?

Or would I need to do more in depth changes before sending the patch?

In the later case I would also need to find some time to do that, so it might not be done that fast.

Denis.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 833 bytes
Desc: OpenPGP digital signature
URL: <https://lists.denx.de/pipermail/u-boot/attachments/20200227/1ecd9091/attachment.sig>

#7 lore raw

PATCH v3 4/6 board: tbs2910: enable CONFIG_DISTRO_DEFAULTS

Quoted 23 lines · Denis 'GNUtoo' Carikli
Quoted 7 lines · On Mon, 10 Feb 2020 09:40:50 -0500 Tom Rini <[email protected]> wrote:

That said, the "bring in PXE" part of DISTRO_DEFAULTS predates sysboot being pulled out of the PXE code, where it was historically introduced. I would like to see a patch to change this part, stand-alone and CC'ing the distribution folks that might have something to say about this. I know there are use-cases for it, but I don't know how critical they are to be everywhere by default vs opt-in. Thanks all!

I've done the patch, but I've not sent it yet.

With it, if board are using things like func(PXE, pxe, na) in BOOT_TARGET_DEVICES, it will breaks the compilation, and we would have an error that looks like that:

Quoted 8 lines

In file included from include/configs/tbs2910.h:19,

                 from include/config.h:5,
                 from include/common.h:16,
                 from env/common.c:10:

include/config_distro_bootcmd.h:398:2: error: expected '}' before 'BOOT_TARGET_DEVICES_references_PXE_without_CONFIG_CMD_DHCP_or_PXE' 398 | BOOT_TARGET_DEVICES_references_PXE_without_CONFIG_CMD_DHCP_or_PXE

Quoted 2 lines

Should I still send the patch as-is by mentioning that issue somehow, in order to start a discussion on the topic?

Sounds like some of the logic needs updating. If a board is saying func(PXE,...) then it should be enabling CMD_PXE. So yes, I'd like to see things get a bit farther if you can, thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 659 bytes
Desc: not available
URL: <https://lists.denx.de/pipermail/u-boot/attachments/20200228/e0b768e7/attachment.sig>
#8 lore raw

PATCH v3 5/6 board: tbs2910: Enable distro_boot support.

In reply to Denis 'GNUtoo' Carikli

This keeps the compatibility with the old bootcmd.

The fdtfile environment variable also needed to be set to imx6q-tbs2910.dtb to enable booting mainline kernels otherwise with extlinux.conf it tries to load mx6-tbs2910.dtb instead.

With arm-linux-gnueabi-gcc 9.2.0-1 from the Parabola GNU/Linux distribution, we have the following size differences:
- text: +2271 bytes
- data: 0 bytes
- bss: -32 bytes
- total: 2239 bytes

---
 configs/tbs2910_defconfig |  3 ++-
 include/configs/tbs2910.h | 20 +++++++++++++++++++-
 2 files changed, 21 insertions(+), 2 deletions(-)
configs/tbs2910_defconfig +2 -1
index 1cf09bb741..b3a8e11a57 100644
@@ -11,10 +11,11 @@ CONFIG_CMD_HDMIDETECT=y
 CONFIG_AHCI=y
 CONFIG_DISTRO_DEFAULTS=y
 CONFIG_BOOTDELAY=3
-CONFIG_BOOTCOMMAND="mmc rescan; if run bootcmd_up1; then run bootcmd_up2; else run bootcmd_mmc; fi"
+CONFIG_BOOTCOMMAND="mmc rescan; if run bootcmd_up1; then run bootcmd_up2; else run bootcmd_mmc || run distro_bootcmd; fi"
 CONFIG_USE_PREBOOT=y
 CONFIG_PREBOOT="echo PCI:; pci enum; pci 1; usb start; if hdmidet; then run set_con_hdmi; else run set_con_serial; fi"
 CONFIG_PRE_CONSOLE_BUFFER=y
+CONFIG_DEFAULT_FDT_FILE="imx6q-tbs2910.dtb"
 CONFIG_BOUNCE_BUFFER=y
 CONFIG_BOARD_EARLY_INIT_F=y
 CONFIG_SYS_PROMPT="Matrix U-Boot> "
include/configs/tbs2910.h +19 -1
index 3975f4cc8b..534500116d 100644
@@ -8,6 +8,16 @@
 #ifndef __TBS2910_CONFIG_H
 #define __TBS2910_CONFIG_H
 
+#define BOOT_TARGET_DEVICES(func) \
+	func(MMC, mmc, 0) \
+	func(MMC, mmc, 1) \
+	func(MMC, mmc, 2) \
+	func(SATA, sata, 0) \
+	func(USB, usb, 0) \
+	func(PXE, pxe, na) \
+	func(DHCP, dhcp, na)
+#include <config_distro_bootcmd.h>
+
 #include "mx6_common.h"
 
 /* General configuration */
@@ -80,6 +90,12 @@
 #define CONFIG_BOARD_SIZE_LIMIT		392192 /* (CONFIG_ENV_OFFSET - 1024) */
 
 #define CONFIG_EXTRA_ENV_SETTINGS \
+	"fdt_addr=0x13000000\0" \
+	"fdt_addr_r=0x13000000\0" \
+	"kernel_addr_r=0x10008000\0" \
+	"pxefile_addr_r=0x10008000\0" \
+	"ramdisk_addr_r=0x18000000\0" \
+	"scriptaddr=0x14000000\0" \
 	"bootargs_mmc1=console=ttymxc0,115200 di0_primary console=tty1\0" \
 	"bootargs_mmc2=video=mxcfb0:dev=hdmi,1920x1080M at 60 " \
 			"video=mxcfb1:off video=mxcfb2:off fbmem=28M\0" \
@@ -102,6 +118,8 @@
 			"setenv stderr serial,vga\0" \
 	"stderr=serial,vga\0" \
 	"stdin=serial,usbkbd\0" \
-	"stdout=serial,vga\0"
+	"stdout=serial,vga\0" \
+	"fdtfile=" CONFIG_DEFAULT_FDT_FILE "\0" \
+	BOOTENV
 
 #endif			       /* __TBS2910_CONFIG_H * */
Signature · 1 line
2.25.0
#9 lore raw

PATCH v3 6/6 boards: tbs2910: add README

In reply to Denis 'GNUtoo' Carikli

The installation documentation make use of the "BOOT/UPDATE" mechanism that is documented in the TBS2910 OS installation manual[1].

This is to make sure that they work on the different PCB revisions of this board.

There is also a boot configuration switch (SW6) but the one described in the v2.1 schematics has 8 switches whereas the one present on the v2.3 board has only 4.

Only the v2.1 board schematics are available.

[1]https://www.tbsdtv.com/download/document/tbs2910/How-to-burn-a-new-OS-into-eMMC-on-Matrix-V2.0.pdf

---
 board/tbs/tbs2910/README | 37 +++++++++++++++++++++++++++++++++++++
 1 file changed, 37 insertions(+)
 create mode 100644 board/tbs/tbs2910/README
board/tbs/tbs2910/README new file +37 -0
new file mode 100644
index 0000000000..6562897e21
@@ -0,0 +1,37 @@
+How to use U-Boot on the TBS2910
+--------------------------------
+
+Configure and build U-boot for the TBS2910:
+    $ make mrproper
+    $ make tbs2910_defconfig
+    $ make
+
+This will generate the u-boot.imx image.
+
+UART:
+- The UART voltage is at 3.3V and its settings are 115200bps 8N1
+
+Boot from eMMC:
+- Once the board is booted, flash u-boot.imx to mmcblk0boot0:
+    $ sudo echo 0 >/sys/block/mmcblk0boot0/force_ro
+    $ sudo dd if=u-boot.imx of=/dev/mmcblk0boot0 bs=1k seek=1; sync
+  Note that the eMMC card node may vary, so adjust this as needed.
+- Power off the board
+- Make sure that the boot switch is set to "BOOT"
+- Connect the UART cable to the host PC
+- Power up the board and U-Boot messages will appear in the serial console.
+
+Boot from USB:
+- Build imx_usb_loader
+    $ git clone git://github.com/boundarydevices/imx_usb_loader.git
+    $ cd imx_usb_loader
+    $ make
+- Copy u-boot.imx in the imx_usb_loader directory
+- Power off the board
+- Make sure that the boot switch is set to "UPDATE"
+- Connect an USB cable to the host PC
+- Connect the UART cable to the host PC
+- Power on the board
+- Load u-boot.img through USB with imx_usb:
+  $ sudo ./imx_usb -v u-boot.imx
+- U-Boot messages will appear in the serial console
\ No newline at end of file
Signature · 1 line
2.25.0
#10 lore raw

PATCH v3 6/6 boards: tbs2910: add README

Quoted 11 lines · Denis 'GNUtoo' Carikli

The installation documentation make use of the "BOOT/UPDATE" mechanism that is documented in the TBS2910 OS installation manual[1].

This is to make sure that they work on the different PCB revisions of this board.

There is also a boot configuration switch (SW6) but the one described in the v2.1 schematics has 8 switches whereas the one present on the v2.3 board has only 4.

Quoted 5 lines

Only the v2.1 board schematics are available.

[1]https://www.tbsdtv.com/download/document/tbs2910/How-to-burn-a-new-OS-into-eMMC-on-Matrix-V2.0.pdf

Thanks for adding this README.
You mentioned the boot configuration switch (SW6) in the commit message, but not in the README itself. Does this mean you planned to include a description of the boot switch settings (what I think would be a good idea)?For board version V2.3 the switch settings are:
switch 1 2 3 4
eMMC   1 1 1 1
SD2    1 0 0 0
SD3    0 1 0 0

Loading u-boot from SATA unfortunately is not possible on V2.3 .

Quoted 2 lines

[...]
\ No newline at end of file

Please add the newline when resending this patch.

Soeren

#11 lore raw

PATCH v3 6/6 boards: tbs2910: add README

In reply to Denis 'GNUtoo' Carikli

Hi,

Quoted 12 lines · Denis 'GNUtoo' Carikli

The installation documentation make use of the "BOOT/UPDATE" mechanism that is documented in the TBS2910 OS installation manual[1].

This is to make sure that they work on the different PCB revisions of this board.

There is also a boot configuration switch (SW6) but the one described in the v2.1 schematics has 8 switches whereas the one present on the v2.3 board has only 4.

Quoted 7 lines

Only the v2.1 board schematics are available.

[1]https://www.tbsdtv.com/download/document/tbs2910/How-to-burn-a-new-OS-into-eMMC-on-Matrix-V2.0.pdf

---
 board/tbs/tbs2910/README | 37 +++++++++++++++++++++++++++++++++++++

Could you please convert the board readme to reST format, and put it under doc/board/tbs/tbs2910.rst?

Quoted 3 lines
 1 file changed, 37 insertions(+)
 create mode 100644 board/tbs/tbs2910/README

Regards,
Bin