Skip to contentSkip to conversation

i.MX28 EVK

PATCH New Arnout Vandecappelle (Essensium/Mind) 4 participants 9 messages Mar 22, 2015 – Apr 4, 2015 Arm i.MX and Layerscape

lore
Share & tools
lore
#1 lore raw

PATCH v2 1/2 boot/uboot: add support for i.MX28 SD format

From: Vincent Stehl? <[email protected]>

Allow to generate u-boot.sd, Freescale i.MX28 SB format with a header for booting from an SD card.

U-boot includes an mxsboot tool to generate this format, starting from v2011.12.

See u-boot doc/README.mxs (or doc/README.mx28_common before 2013.07).

[Arnout:
- Wrap Config.in help text at 72 columns.
- Remove v from U-Boot version specifier.
- Refer to different README name before 2013.07.
- Depend on host-elftosb
- Add comment to clarify sb -> sd conversion.]

---
 boot/uboot/Config.in | 12 ++++++++++++
 boot/uboot/uboot.mk  |  7 +++++++
 2 files changed, 19 insertions(+)
boot/uboot/Config.in +12 -0
index 03e6acc..3f39ee8 100644
@@ -117,6 +117,18 @@ config BR2_TARGET_UBOOT_FORMAT_SB
 	depends on BR2_arm
 	bool "u-boot.sb"
 
+config BR2_TARGET_UBOOT_FORMAT_SD
+	depends on BR2_arm
+	bool "u-boot.sd"
+	help
+	  This is Freescale i.MX28 SB format, with a header for booting
+	  from an SD card.
+
+	  U-boot includes an mxsboot tool to generate this format,
+	  starting from 2011.12.
+
+	  See doc/README.mxs (or doc/README.mx28_common before 2013.07)
+
 config BR2_TARGET_UBOOT_FORMAT_CUSTOM
 	bool "Custom (specify below)"
 	help
boot/uboot/uboot.mk +7 -0
index a9ba054..630619a 100644
@@ -49,6 +49,11 @@ else ifeq ($(BR2_TARGET_UBOOT_FORMAT_SB),y)
 UBOOT_BIN = u-boot.sb
 UBOOT_MAKE_TARGET = $(UBOOT_BIN)
 UBOOT_DEPENDENCIES += host-elftosb
+else ifeq ($(BR2_TARGET_UBOOT_FORMAT_SD),y)
+# BootStream (.sb) is generated by U-Boot, we convert it to SD format
+UBOOT_BIN = u-boot.sd
+UBOOT_MAKE_TARGET = u-boot.sb
+UBOOT_DEPENDENCIES += host-elftosb
 else ifeq ($(BR2_TARGET_UBOOT_FORMAT_CUSTOM),y)
 UBOOT_BIN = $(call qstrip,$(BR2_TARGET_UBOOT_FORMAT_CUSTOM_NAME))
 else
@@ -116,6 +121,8 @@ define UBOOT_BUILD_CMDS
 	$(TARGET_CONFIGURE_OPTS) 	\
 		$(MAKE) -C $(@D) $(UBOOT_MAKE_OPTS) 		\
 		$(UBOOT_MAKE_TARGET)
+	$(if $(BR2_TARGET_UBOOT_FORMAT_SD),
+		$(@D)/tools/mxsboot sd $(@D)/u-boot.sb $(@D)/u-boot.sd)
 endef
 
 define UBOOT_BUILD_OMAP_IFT
Signature · 1 line
2.1.4
#2 lore raw

PATCH v2 1/2 boot/uboot: add support for i.MX28 SD format

Hi Arnout,

Quoted 8 lines · Arnout Vandecappelle (Essensium/Mind)

From: Vincent Stehl? <[email protected]>

Allow to generate u-boot.sd, Freescale i.MX28 SB format with a header for booting from an SD card.

U-boot includes an mxsboot tool to generate this format, starting from v2011.12.

Quoted 7 lines

See u-boot doc/README.mxs (or doc/README.mx28_common before 2013.07).

[Arnout:
- Wrap Config.in help text at 72 columns.
- Remove v from U-Boot version specifier.
- Refer to different README name before 2013.07.
- Depend on host-elftosb

host-elftosb is not necessary anymore. BootStream support has been merged upstream and it's not necessary to convert the u-boot binary with elftosb. This should be removed for u-boot.sb make target as well.

Quoted 16 lines

- Add comment to clarify sb -> sd conversion.]

---
 boot/uboot/Config.in | 12 ++++++++++++
 boot/uboot/uboot.mk  |  7 +++++++
 2 files changed, 19 insertions(+)
boot/uboot/Config.in +0 -0
index 03e6acc..3f39ee8 100644

boot/uboot/Config.in config BR2_TARGET_UBOOT_FORMAT_SB · line 124

Quoted 8 lines
boot/uboot/Config.in +5 -0
@@ -117,6 +117,18 @@ config BR2_TARGET_UBOOT_FORMAT_SB
 	depends on BR2_arm
 	bool "u-boot.sb"
 
+config BR2_TARGET_UBOOT_FORMAT_SD
+	depends on BR2_arm
+	bool "u-boot.sd"
+	help
+	  This is Freescale i.MX28 SB format, with a header for booting

i.MX28 BootStream (.sb) format

Quoted 27 lines
boot/uboot/Config.in +7 -0
+	  from an SD card.
+
+	  U-boot includes an mxsboot tool to generate this format,
+	  starting from 2011.12.
+
+	  See doc/README.mxs (or doc/README.mx28_common before 2013.07)
+
 config BR2_TARGET_UBOOT_FORMAT_CUSTOM
 	bool "Custom (specify below)"
 	help
boot/uboot/uboot.mk +5 -0
index a9ba054..630619a 100644
@@ -49,6 +49,11 @@ else ifeq ($(BR2_TARGET_UBOOT_FORMAT_SB),y)
 UBOOT_BIN = u-boot.sb
 UBOOT_MAKE_TARGET = $(UBOOT_BIN)
 UBOOT_DEPENDENCIES += host-elftosb
+else ifeq ($(BR2_TARGET_UBOOT_FORMAT_SD),y)
+# BootStream (.sb) is generated by U-Boot, we convert it to SD format
+UBOOT_BIN = u-boot.sd
+UBOOT_MAKE_TARGET = u-boot.sb
+UBOOT_DEPENDENCIES += host-elftosb
 else ifeq ($(BR2_TARGET_UBOOT_FORMAT_CUSTOM),y)
 UBOOT_BIN = $(call qstrip,$(BR2_TARGET_UBOOT_FORMAT_CUSTOM_NAME))
 else

boot/uboot/uboot.mk define UBOOT_BUILD_CMDS · line 128

Quoted 8 lines
boot/uboot/uboot.mk +2 -0
@@ -116,6 +121,8 @@ define UBOOT_BUILD_CMDS
 	$(TARGET_CONFIGURE_OPTS) 	\
 		$(MAKE) -C $(@D) $(UBOOT_MAKE_OPTS) 		\
 		$(UBOOT_MAKE_TARGET)
+	$(if $(BR2_TARGET_UBOOT_FORMAT_SD),
+		$(@D)/tools/mxsboot sd $(@D)/u-boot.sb $(@D)/u-boot.sd)
 endef
 
 define UBOOT_BUILD_OMAP_IFT

Best regards
J?rg

#3 lore raw

PATCH v2 1/2 boot/uboot: add support for i.MX28 SD format

Hi Arnout,

Quoted 20 lines · J?rg Krause

Hi Arnout,

Quoted 8 lines · Arnout Vandecappelle (Essensium/Mind)

From: Vincent Stehl? <[email protected]>

Allow to generate u-boot.sd, Freescale i.MX28 SB format with a header for booting from an SD card.

U-boot includes an mxsboot tool to generate this format, starting from v2011.12.

Quoted 7 lines

See u-boot doc/README.mxs (or doc/README.mx28_common before 2013.07).

[Arnout:
- Wrap Config.in help text at 72 columns.
- Remove v from U-Boot version specifier.
- Refer to different README name before 2013.07.
- Depend on host-elftosb

Quoted 3 lines

host-elftosb is not necessary anymore. BootStream support has been merged upstream and it's not necessary to convert the u-boot binary with elftosb. This should be removed for u-boot.sb make target as well.

Sorry, I just saw your comment on this in the other mail. Would it make sense to extract the version from the Makefile in uboots build directory?

Best regards
J?rg

#4 lore raw

PATCH v2 1/2 boot/uboot: add support for i.MX28 SD format

Hi Arnout,

Quoted 23 lines · J?rg Krause

Hi Arnout,

Quoted 20 lines · J?rg Krause

Hi Arnout,

Quoted 15 lines · Arnout Vandecappelle (Essensium/Mind)

From: Vincent Stehl? <[email protected]>

Allow to generate u-boot.sd, Freescale i.MX28 SB format with a header for booting from an SD card.

U-boot includes an mxsboot tool to generate this format, starting from v2011.12.

See u-boot doc/README.mxs (or doc/README.mx28_common before 2013.07).

[Arnout:
- Wrap Config.in help text at 72 columns.
- Remove v from U-Boot version specifier.
- Refer to different README name before 2013.07.
- Depend on host-elftosb

Quoted 8 lines
Quoted 3 lines

host-elftosb is not necessary anymore. BootStream support has been merged upstream and it's not necessary to convert the u-boot binary with elftosb. This should be removed for u-boot.sb make target as well.

Sorry, I just saw your comment on this in the other mail. Would it make sense to extract the version from the Makefile in uboots build directory?

Stupid idea from me, it's about build dependency. Please, forget this :)

#5 lore raw

PATCH v2 1/2 boot/uboot: add support for i.MX28 SD format

In reply to Arnout Vandecappelle (Essensium/Mind)
Quoted 66 lines · Arnout Vandecappelle (Essensium/Mind)

From: Vincent Stehl? <[email protected]>

Allow to generate u-boot.sd, Freescale i.MX28 SB format with a header for booting from an SD card.

U-boot includes an mxsboot tool to generate this format, starting from v2011.12.

See u-boot doc/README.mxs (or doc/README.mx28_common before 2013.07).

[Arnout:
- Wrap Config.in help text at 72 columns.
- Remove v from U-Boot version specifier.
- Refer to different README name before 2013.07.
- Depend on host-elftosb
- Add comment to clarify sb -> sd conversion.]

---
 boot/uboot/Config.in | 12 ++++++++++++
 boot/uboot/uboot.mk  |  7 +++++++
 2 files changed, 19 insertions(+)
boot/uboot/Config.in +12 -0
index 03e6acc..3f39ee8 100644
@@ -117,6 +117,18 @@ config BR2_TARGET_UBOOT_FORMAT_SB
 	depends on BR2_arm
 	bool "u-boot.sb"
 
+config BR2_TARGET_UBOOT_FORMAT_SD
+	depends on BR2_arm
+	bool "u-boot.sd"
+	help
+	  This is Freescale i.MX28 SB format, with a header for booting
+	  from an SD card.
+
+	  U-boot includes an mxsboot tool to generate this format,
+	  starting from 2011.12.
+
+	  See doc/README.mxs (or doc/README.mx28_common before 2013.07)
+
 config BR2_TARGET_UBOOT_FORMAT_CUSTOM
 	bool "Custom (specify below)"
 	help
boot/uboot/uboot.mk +5 -0
index a9ba054..630619a 100644
@@ -49,6 +49,11 @@ else ifeq ($(BR2_TARGET_UBOOT_FORMAT_SB),y)
 UBOOT_BIN = u-boot.sb
 UBOOT_MAKE_TARGET = $(UBOOT_BIN)
 UBOOT_DEPENDENCIES += host-elftosb
+else ifeq ($(BR2_TARGET_UBOOT_FORMAT_SD),y)
+# BootStream (.sb) is generated by U-Boot, we convert it to SD format
+UBOOT_BIN = u-boot.sd
+UBOOT_MAKE_TARGET = u-boot.sb
+UBOOT_DEPENDENCIES += host-elftosb
 else ifeq ($(BR2_TARGET_UBOOT_FORMAT_CUSTOM),y)
 UBOOT_BIN = $(call qstrip,$(BR2_TARGET_UBOOT_FORMAT_CUSTOM_NAME))
 else

boot/uboot/uboot.mk define UBOOT_BUILD_CMDS · line 128

Quoted 8 lines
boot/uboot/uboot.mk +2 -0
@@ -116,6 +121,8 @@ define UBOOT_BUILD_CMDS
 	$(TARGET_CONFIGURE_OPTS) 	\
 		$(MAKE) -C $(@D) $(UBOOT_MAKE_OPTS) 		\
 		$(UBOOT_MAKE_TARGET)
+	$(if $(BR2_TARGET_UBOOT_FORMAT_SD),
+		$(@D)/tools/mxsboot sd $(@D)/u-boot.sb $(@D)/u-boot.sd)
 endef
 
 define UBOOT_BUILD_OMAP_IFT

After understanding that host-elftosb is needed for older U-Boot versions:

#6 lore raw

PATCH v2 2/2 config: Add defconfig for Freescale i.MX28 EVK

In reply to Arnout Vandecappelle (Essensium/Mind)

From: Vincent Stehl? <[email protected]>

The i.MX28 Evaluation Kit (or EVK) is Freescale's evaluation board based on the i.MX287 Applications Processor.

This defconfig is based on mainline u-boot and Linux kernel.

Also, we add an SD card creation script and documentation, shamelessly based on the ones for i.MX5/6 by Luca Ceresoli.

[Arnout: fixate U-Boot and kernel (headers) versions]

---
 board/freescale/imx28evk/create-boot-sd.sh | 97 ++++++++++++++++++++++++++++++
 board/freescale/imx28evk/readme.txt        | 58 ++++++++++++++++++
 configs/freescale_imx28evk_defconfig       | 25 ++++++++
 3 files changed, 180 insertions(+)
 create mode 100755 board/freescale/imx28evk/create-boot-sd.sh
 create mode 100644 board/freescale/imx28evk/readme.txt
 create mode 100644 configs/freescale_imx28evk_defconfig
board/freescale/imx28evk/create-boot-sd.sh new file +97 -0
new file mode 100755
index 0000000..5e050cb
@@ -0,0 +1,97 @@
+#!/bin/sh
+
+set -u
+set -e
+
+PROGNAME=$(basename $0)
+
+usage()
+{
+    echo "Create an SD card that boots on an i.MX28 EVK board."
+    echo
+    echo "Note: all data on the the card will be completely deleted!"
+    echo "Use with care!"
+    echo "Superuser permissions may be required to write to the device."
+    echo
+    echo "Usage: ${PROGNAME} <sd_block_device>"
+    echo "Arguments:"
+    echo "  <sd_block_device>     The device to be written to"
+    echo
+    echo "Example: ${PROGNAME} /dev/mmcblk0"
+    echo
+}
+
+if [ $# -ne 1 ]; then
+    usage
+    exit 1
+fi
+
+if [ $(id -u) -ne 0 ]; then
+    echo "${PROGNAME} must be run as root"
+    exit 1
+fi
+
+DEV=${1}
+
+# The partition name prefix depends on the device name:
+# - /dev/sde -> /dev/sde1
+# - /dev/mmcblk0 -> /dev/mmcblk0p1
+if echo ${DEV}|grep -q mmcblk ; then
+    PART="p"
+else
+    PART=""
+fi
+
+PART1=${DEV}${PART}1
+PART2=${DEV}${PART}2
+PART3=${DEV}${PART}3
+
+# Unmount the partitions if mounted
+umount ${PART1} || true
+umount ${PART2} || true
+umount ${PART3} || true
+
+# First, clear the card
+dd if=/dev/zero of=${DEV} bs=1M count=20
+
+sync
+
+# Partition the card.
+# SD layout for i.MX28 boot:
+# - Special partition type 53 at sector 2048, containing an SD-SB-encapsulated u-boot
+# - FAT partition containing zImage
+# - ext2/3 partition formatted as ext2 or ext3, containing the root filesystem.
+sfdisk --force -u S ${DEV} <<EOF
+2048,2000,53
+4048,16000,b
+20048,,L
+EOF
+
+sync
+
+# Copy the bootloader@offset 2048
+# (We need to skip the partition table in the .sd, too.)
+dd if=output/images/u-boot.sd of=${DEV}1 bs=1M
+
+# Prepare a temp dir for mounting partitions
+TMPDIR=$(mktemp -d)
+ 
+# FAT partition: kernel
+mkfs.vfat ${PART2}
+mount ${PART2} ${TMPDIR}
+cp output/images/*Image ${TMPDIR}/
+cp output/images/*.dtb  ${TMPDIR}/ || true
+sync
+umount ${TMPDIR}
+
+# ext2 partition: root filesystem
+mkfs.ext2 ${PART3}
+mount ${PART3} ${TMPDIR}
+tar -C ${TMPDIR}/ -xf output/images/rootfs.tar
+sync
+umount ${TMPDIR}
+
+# Cleanup
+rmdir ${TMPDIR}
+sync
+echo Done
board/freescale/imx28evk/readme.txt new file +58 -0

58 lines not on this page · raw message

configs/freescale_imx28evk_defconfig new file +25 -0
new file mode 100644
index 0000000..7125cec
@@ -0,0 +1,25 @@
+# architecture
+BR2_arm=y
+BR2_arm926t=y
+
+# toolchain
+BR2_KERNEL_HEADERS_VERSION=y
+BR2_DEFAULT_KERNEL_VERSION="3.19.2"
+
+# system
+BR2_TARGET_GENERIC_GETTY_PORT="ttyAMA0"
+
+# kernel
+BR2_LINUX_KERNEL=y
+BR2_LINUX_KERNEL_SAME_AS_HEADERS=y
+BR2_LINUX_KERNEL_DEFCONFIG="mxs"
+BR2_LINUX_KERNEL_ZIMAGE=y
+BR2_LINUX_KERNEL_DTS_SUPPORT=y
+BR2_LINUX_KERNEL_INTREE_DTS_NAME="imx28-evk"
+
+# bootloader
+BR2_TARGET_UBOOT=y
+BR2_TARGET_UBOOT_BOARDNAME="mx28evk"
+BR2_TARGET_UBOOT_CUSTOM_VERSION=y
+BR2_TARGET_UBOOT_CUSTOM_VERSION_VALUE="2015.01"
+BR2_TARGET_UBOOT_FORMAT_SD=y
Signature · 1 line
2.1.4
#7 lore raw

PATCH 1/1 freescale_imx28evk_defconfig: select headers 3.19

From: Vincent Stehl? <[email protected]>

We use a manually specified custom version 3.19.2 of the linux kernel for i.MX28, but linux-headers defaults to a 2.6.x family.

Select custom headers family 3.19.x explicitely, to repair linux-headers "build".

Cc Arnout Vandecappelle (Essensium/Mind) <[email protected]>
---
 configs/freescale_imx28evk_defconfig | 1 +
 1 file changed, 1 insertion(+)
configs/freescale_imx28evk_defconfig +1 -0
index 7125cec..9ce5217 100644
@@ -5,6 +5,7 @@ BR2_arm926t=y
 # toolchain
 BR2_KERNEL_HEADERS_VERSION=y
 BR2_DEFAULT_KERNEL_VERSION="3.19.2"
+BR2_PACKAGE_HOST_LINUX_HEADERS_CUSTOM_3_19=y
 
 # system
 BR2_TARGET_GENERIC_GETTY_PORT="ttyAMA0"
Signature · 1 line
2.1.4
#8 lore raw

v2 cover i.MX28 EVK

In reply to Arnout Vandecappelle (Essensium/Mind)

Dear Arnout Vandecappelle (Essensium/Mind),

Quoted 1 line · Arnout Vandecappelle (Essensium/Mind)

This is a repost of the series by Vincent Stehl_ with some minor fixes.

Both patches applied, thanks!

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com