Skip to contentSkip to conversation

arm: xea: Move XEA's environment variables from xea.h to xea.env

PATCH Superseded Lukasz Majewski 2 participants 8 messages Jan 11, 2024 Arm i.MX and Layerscape

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/3 arm: xea: Move XEA's environment variables from xea.h to xea.env

The default set of environment variables from CFG_EXTRA_ENV_SETTINGS has been moved to a separate file - board/liebherr/xea/xea.env

Adjustments done:
- fitImage support
- SPI-NOR layout re-organization

---

(no changes since v1)

 board/liebherr/xea/xea.env | 141 +++++++++++++++++++++++++++++++++++++
 include/configs/xea.h      | 140 ------------------------------------
 2 files changed, 141 insertions(+), 140 deletions(-)
 create mode 100644 board/liebherr/xea/xea.env
board/liebherr/xea/xea.env new file +141 -0
new file mode 100644
index 0000000000..7dcc122626
@@ -0,0 +1,141 @@
+bootmode=update
+bootpri=mmc_mmc
+bootsec=sf_swu
+consdev=ttyAMA0
+baudrate=115200
+rootdev=/dev/mmcblk0p2
+netdev=eth0
+swufile=swupdate-image-xea-upd.itb
+sf_kernel_offset=0xA0000
+sf_swu_size=0xF40000
+ethact=FEC
+arch=xea
+serverip=10.8.217.79
+nfs_serverip=10.8.218.113
+gatewayip=10.8.209.250
+lwe_env=
+	if dhcp ${loadaddr} ${hostname}/${lwe_uenv} ; then
+	source ${loadaddr};
+	fi
+lwe_uenv=env_uboot_xea.bin
+do_update_mmc=
+	if mmc rescan ; then
+	mmc dev 0 ${update_mmc_part} ;
+	if dhcp ${hostname}/${update_filename} ; then
+	setexpr fw_sz ${filesize} / 0x200 ;
+	setexpr fw_sz ${fw_sz} + 1 ;
+	mmc write ${loadaddr} ${update_offset} ${fw_sz} ;
+	fi ;
+	fi
+do_update_sf=
+	if sf probe ; then
+	if dhcp ${hostname}/${update_filename} ; then
+	sf erase ${update_offset} +${filesize} ;
+	sf write ${loadaddr} ${update_offset} ${filesize} ;
+	fi ;
+	fi
+factory_reset=
+	if sf probe ; then
+	run update_swu ;
+	setenv bootmode update ;
+	saveenv ;
+	fi
+update_spl_filename=u-boot.sb
+update_spl=
+	setenv update_filename ${update_spl_filename} ;
+	setenv update_offset 0 ;
+	run do_update_sf
+update_uboot_filename=u-boot.img
+update_uboot=
+	setenv update_filename ${update_uboot_filename} ;
+	setenv update_offset 0x10000 ;
+	run do_update_sf ;
+	setenv update_mmc_part 1 ;
+	setenv update_offset 0 ;
+	run do_update_mmc ;
+	setenv update_mmc_part 2 ;
+	run do_update_mmc
+update_kernel_filename=uImage
+update_kernel=
+	setenv update_mmc_part 1 ;
+	setenv update_filename ${update_kernel_filename} ;
+	setenv update_offset 0x800 ;
+	run do_update_mmc ;
+	setenv update_filename ${dtbfile} ;
+	setenv update_offset 0x400 ;
+	run do_update_mmc
+update_swu=
+	setenv update_filename ${swufile} ;
+	setenv update_offset ${sf_kernel_offset} ;
+	run do_update_sf
+addcons=
+	setenv bootargs ${bootargs}
+	console=${consdev},${baudrate}
+addip=
+	setenv bootargs ${bootargs}
+	ip=${ipaddr}:${serverip}:${gatewayip}:
+		${netmask}:${hostname}:${netdev}:off
+addmisc=
+	setenv bootargs ${bootargs} ${miscargs}
+addargs=run addcons addmisc
+mmcload=
+	mmc rescan ;
+	mmc dev 0 1 ;
+	mmc read ${loadaddr} 0x800 0x2000 ;
+	mmc read ${dtbaddr} 0x400 0x80
+netload=
+	dhcp ${loadaddr} ${hostname}/${bootfile} ;
+	tftp ${dtbaddr} ${hostname}/${dtbfile}
+usbload=
+	usb start ;
+	load usb 0:1 ${loadaddr} ${bootfile}
+miscargs=panic=1
+mmcargs=setenv bootargs root=${rootdev} rw rootwait
+nfsargs=
+	setenv bootargs root=/dev/nfs rw
+		nfsroot=${serverip}:${rootpath},v3,tcp
+mmc_mmc=
+	if run mmcload mmcargs addargs ; then
+	bootm ${loadaddr} - ${dtbaddr} ;
+	fi
+mmc_nfs=
+	if run mmcload nfsargs addip addargs ; then
+	bootm ${loadaddr} - ${dtbaddr} ;
+	fi
+sf_mmc=
+	if run sfload mmcargs addargs ; then
+	bootm ${loadaddr} - ${dtbaddr} ;
+	fi
+sf_swu=
+	if sf probe ; then
+	sf read ${loadaddr} ${sf_kernel_offset} ${sf_swu_size} ;
+	setenv bootargs root=/dev/ram0 rw ;
+	run addargs ;
+	bootm ${loadaddr} ;
+	fi
+net_mmc=
+	if run netload mmcargs addargs ; then
+	bootm ${loadaddr} - ${dtbaddr} ;
+	fi
+net_nfs=
+	if run netload nfsargs addip addargs ; then
+	bootm ${loadaddr} - ${dtbaddr} ;
+	fi
+prebootcmd=
+	if test ${envsaved} != y ; then ;
+	setenv envsaved y ;
+	saveenv ;
+	fi ;
+	if test ${bootmode} = normal ; then
+	setenv bootdelay 0 ;
+	setenv bootpri mmc_mmc ;
+	elif test ${bootmode} = devel ; then
+	setenv bootdelay 3 ;
+	setenv bootpri net_mmc ;
+	else
+	if test ${bootmode} != update ; then
+	echo Warning: unknown bootmode ${bootmode} ;
+	fi ;
+	setenv bootdelay 1 ;
+	setenv bootpri sf_swu ;
+	fi
include/configs/xea.h +0 -140

146 lines not on this page · raw message

Signature · 1 line
2.39.2
#1 lore raw

PATCH v2 2/3 arm: config: Enable CRC8 support in SPL on imx287 XEA board

The boot0/1 feature uses simple CRC8 to check (in SPL) if SPI-NOR content is not corrupted, hence the need to enable it.

---

(no changes since v1)

 configs/imx28_xea_defconfig | 1 +
 1 file changed, 1 insertion(+)
configs/imx28_xea_defconfig +1 -0
index c1b0487f7e..64a0561a34 100644
@@ -123,4 +123,5 @@ CONFIG_DM_SERIAL=y
 CONFIG_SPI=y
 CONFIG_DM_SPI=y
 CONFIG_MXS_SPI=y
+CONFIG_SPL_CRC8=y
 # CONFIG_SPL_OF_LIBFDT is not set
Signature · 1 line
2.39.2
#2 lore raw

PATCH v2 3/3 arm: xea: Add support for boot image source descriptor in SPL

In reply to Lukasz Majewski

From: Anatolij Gustschin <[email protected]>

We load two boot image source descriptor structures from last two sectors in the SPI NOR flash and determine the boot source for loading the kernel/DTB images, then adjust the boot order for loading image from eMMC boot0 or boot1 partition.

---

Changes in v2:
- Move XEA's env adjustments to xea.env file (from include/configs/xea.h)

 board/liebherr/xea/boot_img_scr.h | 27 ++++++++++
 board/liebherr/xea/xea.c          | 85 +++++++++++++++++++++++++++++++
 2 files changed, 112 insertions(+)
 create mode 100644 board/liebherr/xea/boot_img_scr.h
board/liebherr/xea/boot_img_scr.h new file +27 -0
new file mode 100644
index 0000000000..baa3072b49
@@ -0,0 +1,27 @@
+/* SPDX-License-Identifier:     GPL-2.0+ */
+/*
+ * Struct for boot image source description for placing in last
+ * two SPI NOR flash sectors on legcom.
+ */
+
+struct boot_img_src {
+	u8 magic;	/* Must be 'B' = 0x42 */
+	u8 flags;	/* flags to specify mmcblk[0|1] boot[0|1] */
+	u8 crc8;	/* CRC-8 over above two bytes */
+} __packed;
+
+/*
+ * Bit definition in boot_img_src.flags:
+ *  Bit 0: mmcblk device 0 or 1 (1 - if this bit set)
+ *  Bit 1: mmcblk boot partition 0 or 1.
+ *         for eMMC: boot0 if this bit is cleared, boot1 - if set
+ *         for SD-card the boot partition value will always be 0
+ *         (independent of the value of this bit)
+ *
+ */
+#define BOOT_SRC_MMC1	BIT(0)
+#define BOOT_SRC_PART1	BIT(1)
+
+/* Offset of the first boot image source descriptor in SPI NOR */
+#define SPI_FLASH_BOOT_SRC_OFFS	0xFE0000
+#define SPI_FLASH_SECTOR_SIZE	0x10000
board/liebherr/xea/xea.c +85 -0

103 lines not on this page · raw message

Signature · 1 line
2.39.2
reviewer
#3 lore raw
In reply to Lukasz Majewski

Hi Lukasz,

board/liebherr/xea/xea.env line 15

Quoted 3 lines · Lukasz Majewski
board/liebherr/xea/xea.env new file +3 -0
+serverip=10.8.217.79
+nfs_serverip=10.8.218.113
+gatewayip=10.8.209.250

These IP addresses should not be hardcoded here.

They were not present in xea.h originally. Please remove them.

reviewer
#4 lore raw
Quoted 5 lines · Fabio Estevam

Hi Lukasz,

On Thu, Jan 11, 2024 at 8:06 AM Lukasz Majewski <[email protected]> wrote:

Quoted 7 lines

board/liebherr/xea/xea.env line 15

Quoted 3 lines
board/liebherr/xea/xea.env new file +3 -0
+serverip=10.8.217.79
+nfs_serverip=10.8.218.113
+gatewayip=10.8.209.250

These IP addresses should not be hardcoded here.

They were not present in xea.h originally. Please remove them.

One more thing: xea.h had:
"dtbfile=imx28-xea.dtb\0"

but I don't see dtbfile declared inside the new xea.env.

#5 lore raw

Hi Fabio,

Quoted 13 lines
Quoted 11 lines · Fabio Estevam

Hi Lukasz,

board/liebherr/xea/xea.env line 15

Quoted 3 lines · Lukasz Majewski
board/liebherr/xea/xea.env new file +3 -0
+serverip=10.8.217.79
+nfs_serverip=10.8.218.113
+gatewayip=10.8.209.250  

These IP addresses should not be hardcoded here.

Quoted 6 lines
Quoted 1 line

They were not present in xea.h originally. Please remove them.

One more thing: xea.h had:
"dtbfile=imx28-xea.dtb\0"

but I don't see dtbfile declared inside the new xea.env.

Thanks for spotting it - I've forgotten to remove it after moving forward to fitImage.

I will remove it.

Best regards,

Lukasz Majewski

--

DENX Software Engineering GmbH, Managing Director: Erika Unter
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-59 Fax: (+49)-8142-66989-80 Email: [email protected]

#6 lore raw

Hi Fabio,

Quoted 20 lines

Hi Fabio,

Quoted 18 lines
Quoted 5 lines · Fabio Estevam

Hi Lukasz,

On Thu, Jan 11, 2024 at 8:06 AM Lukasz Majewski <[email protected]> wrote:

Quoted 7 lines

board/liebherr/xea/xea.env line 15

Quoted 3 lines
board/liebherr/xea/xea.env new file +3 -0
+serverip=10.8.217.79
+nfs_serverip=10.8.218.113
+gatewayip=10.8.209.250    

These IP addresses should not be hardcoded here.

They were not present in xea.h originally. Please remove them.

One more thing: xea.h had:
"dtbfile=imx28-xea.dtb\0"

Quoted 7 lines
Quoted 1 line

but I don't see dtbfile declared inside the new xea.env.

Thanks for spotting it - I've forgotten to remove it after moving forward to fitImage.

I will remove it.

This will be added not removed...

Quoted 11 lines

Best regards,

Lukasz Majewski

--

DENX Software Engineering GmbH, Managing Director: Erika Unter
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-59 Fax: (+49)-8142-66989-80 Email:
[email protected]

Best regards,

Lukasz Majewski

--

DENX Software Engineering GmbH, Managing Director: Erika Unter
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-59 Fax: (+49)-8142-66989-80 Email: [email protected]

#7 lore raw
In reply to Fabio Estevam

Hi Fabio,

Quoted 11 lines

Hi Lukasz,

board/liebherr/xea/xea.env line 15

Quoted 3 lines · Lukasz Majewski
board/liebherr/xea/xea.env new file +3 -0
+serverip=10.8.217.79
+nfs_serverip=10.8.218.113
+gatewayip=10.8.209.250  

These IP addresses should not be hardcoded here.

They were not present in xea.h originally. Please remove them.

Those are the IP's for customer's production setup. In that way I could just point to mainline SHA1 and just use the sources without any further adjustments.

I can agree, that on "common devel board" (like e.g. beaglebone) it would be problematic to have it hardcoded, but as this one is customer specific HW ...

Best regards,

Lukasz Majewski

--

DENX Software Engineering GmbH, Managing Director: Erika Unter
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-59 Fax: (+49)-8142-66989-80 Email: [email protected]