Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [PATCH 1/2] boot/uboot: add support for i.MX28 SD format
@ 2015-03-18 18:06 Vincent Stehlé
  2015-03-18 18:06 ` [Buildroot] [PATCH 2/2] config: Add defconfig for Freescale i.MX28 EVK Vincent Stehlé
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Vincent Stehlé @ 2015-03-18 18:06 UTC (permalink / raw)
  To: buildroot

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.

Signed-off-by: Vincent Stehl? <vincent.stehle@freescale.com>
---
 boot/uboot/Config.in | 12 ++++++++++++
 boot/uboot/uboot.mk  |  5 +++++
 2 files changed, 17 insertions(+)

diff --git a/boot/uboot/Config.in b/boot/uboot/Config.in
index 03e6acc..cea993a 100644
--- a/boot/uboot/Config.in
+++ b/boot/uboot/Config.in
@@ -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 v2011.12.
+
+	  See doc/README.mxs.
+
 config BR2_TARGET_UBOOT_FORMAT_CUSTOM
 	bool "Custom (specify below)"
 	help
diff --git a/boot/uboot/uboot.mk b/boot/uboot/uboot.mk
index a9ba054..8fad5b4 100644
--- a/boot/uboot/uboot.mk
+++ b/boot/uboot/uboot.mk
@@ -49,6 +49,9 @@ 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)
+UBOOT_BIN = u-boot.sd
+UBOOT_MAKE_TARGET = u-boot.sb
 else ifeq ($(BR2_TARGET_UBOOT_FORMAT_CUSTOM),y)
 UBOOT_BIN = $(call qstrip,$(BR2_TARGET_UBOOT_FORMAT_CUSTOM_NAME))
 else
@@ -116,6 +119,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
-- 
2.1.4

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [Buildroot] [PATCH 2/2] config: Add defconfig for Freescale i.MX28 EVK
  2015-03-18 18:06 [Buildroot] [PATCH 1/2] boot/uboot: add support for i.MX28 SD format Vincent Stehlé
@ 2015-03-18 18:06 ` Vincent Stehlé
  2015-03-22 13:12   ` Arnout Vandecappelle
  2015-03-18 19:53 ` [Buildroot] [PATCH 1/2] boot/uboot: add support for i.MX28 SD format Jörg Krause
  2015-03-22 13:02 ` Arnout Vandecappelle
  2 siblings, 1 reply; 5+ messages in thread
From: Vincent Stehlé @ 2015-03-18 18:06 UTC (permalink / raw)
  To: buildroot

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.

Signed-off-by: Vincent Stehl? <vincent.stehle@freescale.com>
Cc: Luca Ceresoli <luca@lucaceresoli.net>
---
 board/freescale/imx28evk/create-boot-sd.sh | 97 ++++++++++++++++++++++++++++++
 board/freescale/imx28evk/readme.txt        | 58 ++++++++++++++++++
 configs/freescale_imx28evk_defconfig       | 18 ++++++
 3 files changed, 173 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

diff --git a/board/freescale/imx28evk/create-boot-sd.sh b/board/freescale/imx28evk/create-boot-sd.sh
new file mode 100755
index 0000000..5e050cb
--- /dev/null
+++ b/board/freescale/imx28evk/create-boot-sd.sh
@@ -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
diff --git a/board/freescale/imx28evk/readme.txt b/board/freescale/imx28evk/readme.txt
new file mode 100644
index 0000000..cbf6aae
--- /dev/null
+++ b/board/freescale/imx28evk/readme.txt
@@ -0,0 +1,58 @@
+**************************
+Freescale i.MX28 EVK board
+**************************
+
+This file documents the Buildroot support for the Freescale i.MX28 EVK board.
+
+Read the i.MX28 Evaluation Kit Quick Start Guide [1] for an introduction to the
+board.
+
+Build
+=====
+
+First, configure Buildroot for your i.MX28 EVK board:
+
+  make freescale_imx28evk_defconfig
+
+Build all components:
+
+  make
+
+You will find in ./output/images/ the following files:
+  - imx28-evk.dtb
+  - rootfs.tar
+  - u-boot.sd
+  - zImage
+
+Create a bootable SD card
+=========================
+
+To determine the device associated to the SD card have a look in the
+/proc/partitions file:
+
+  cat /proc/partitions
+
+Run the following script as root on your SD card. This will partition the card
+and copy the bootloader, kernel and root filesystem as needed.
+
+*** WARNING! The script will destroy all the card content. Use with care! ***
+
+  ./board/freescale/imx28evk/create-boot-sd.sh <your-sd-device>
+
+Boot the i.MX28 EVK board
+=========================
+
+To boot your newly created system (refer to the i.MX28 EVK Quick Start Guide
+[1] for guidance):
+- insert the SD card in the SD Card Socket 0 of the board;
+- verify that your i.MX28 EVK board jumpers and switches are set as mentioned
+  in the i.MX28 EVK Quick Start Guide [1];
+- connect an RS232 UART cable to the Debug UART Port and connect using a
+  terminal emulator at 115200 bps, 8n1;
+- power on the board.
+
+Enjoy!
+
+References
+==========
+[1] http://cache.freescale.com/files/32bit/doc/user_guide/EVK_imx28_QuickStart.pdf
diff --git a/configs/freescale_imx28evk_defconfig b/configs/freescale_imx28evk_defconfig
new file mode 100644
index 0000000..15cedeb
--- /dev/null
+++ b/configs/freescale_imx28evk_defconfig
@@ -0,0 +1,18 @@
+# architecture
+BR2_arm=y
+BR2_arm926t=y
+
+# system
+BR2_TARGET_GENERIC_GETTY_PORT="ttyAMA0"
+
+# kernel
+BR2_LINUX_KERNEL=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_FORMAT_SD=y
-- 
2.1.4

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [Buildroot] [PATCH 1/2] boot/uboot: add support for i.MX28 SD format
  2015-03-18 18:06 [Buildroot] [PATCH 1/2] boot/uboot: add support for i.MX28 SD format Vincent Stehlé
  2015-03-18 18:06 ` [Buildroot] [PATCH 2/2] config: Add defconfig for Freescale i.MX28 EVK Vincent Stehlé
@ 2015-03-18 19:53 ` Jörg Krause
  2015-03-22 13:02 ` Arnout Vandecappelle
  2 siblings, 0 replies; 5+ messages in thread
From: Jörg Krause @ 2015-03-18 19:53 UTC (permalink / raw)
  To: buildroot

On Mi, 2015-03-18 at 19:06 +0100, Vincent Stehl? wrote:
> 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.
> 
> Signed-off-by: Vincent Stehl? <vincent.stehle@freescale.com>
> ---
>  boot/uboot/Config.in | 12 ++++++++++++
>  boot/uboot/uboot.mk  |  5 +++++
>  2 files changed, 17 insertions(+)
> 
> diff --git a/boot/uboot/Config.in b/boot/uboot/Config.in
> index 03e6acc..cea993a 100644
> --- a/boot/uboot/Config.in
> +++ b/boot/uboot/Config.in
> @@ -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 v2011.12.
> +
> +	  See doc/README.mxs.
> +
>  config BR2_TARGET_UBOOT_FORMAT_CUSTOM
>  	bool "Custom (specify below)"
>  	help
> diff --git a/boot/uboot/uboot.mk b/boot/uboot/uboot.mk
> index a9ba054..8fad5b4 100644
> --- a/boot/uboot/uboot.mk
> +++ b/boot/uboot/uboot.mk
> @@ -49,6 +49,9 @@ 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)
> +UBOOT_BIN = u-boot.sd
> +UBOOT_MAKE_TARGET = u-boot.sb
>  else ifeq ($(BR2_TARGET_UBOOT_FORMAT_CUSTOM),y)
>  UBOOT_BIN = $(call qstrip,$(BR2_TARGET_UBOOT_FORMAT_CUSTOM_NAME))
>  else
> @@ -116,6 +119,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

Happy to see Freescale patches here. Tested for a custom i.MX28 board.

Tested-by: J?rg Krause <joerg.krause@embedded.rocks>

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Buildroot] [PATCH 1/2] boot/uboot: add support for i.MX28 SD format
  2015-03-18 18:06 [Buildroot] [PATCH 1/2] boot/uboot: add support for i.MX28 SD format Vincent Stehlé
  2015-03-18 18:06 ` [Buildroot] [PATCH 2/2] config: Add defconfig for Freescale i.MX28 EVK Vincent Stehlé
  2015-03-18 19:53 ` [Buildroot] [PATCH 1/2] boot/uboot: add support for i.MX28 SD format Jörg Krause
@ 2015-03-22 13:02 ` Arnout Vandecappelle
  2 siblings, 0 replies; 5+ messages in thread
From: Arnout Vandecappelle @ 2015-03-22 13:02 UTC (permalink / raw)
  To: buildroot

On 18/03/15 19:06, Vincent Stehl? wrote:
> 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.
> 
> Signed-off-by: Vincent Stehl? <vincent.stehle@freescale.com>
> ---
>  boot/uboot/Config.in | 12 ++++++++++++
>  boot/uboot/uboot.mk  |  5 +++++
>  2 files changed, 17 insertions(+)
> 
> diff --git a/boot/uboot/Config.in b/boot/uboot/Config.in
> index 03e6acc..cea993a 100644
> --- a/boot/uboot/Config.in
> +++ b/boot/uboot/Config.in
> @@ -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

 Lines should wrap at 72 columns.

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

 U-Boot doesn't use v in its version specifiers.

> +
> +	  See doc/README.mxs.

 Before 2013.07, it was called README.mx28_common

 Before 2014.01, you needed elftosb to generate the BootStream image.
Unfortunately we can't automatically add that dependency because we can't detect
the U-Boot version. So, add this dependency unconditionally like is done for the
SB format.

> +
>  config BR2_TARGET_UBOOT_FORMAT_CUSTOM
>  	bool "Custom (specify below)"
>  	help
> diff --git a/boot/uboot/uboot.mk b/boot/uboot/uboot.mk
> index a9ba054..8fad5b4 100644
> --- a/boot/uboot/uboot.mk
> +++ b/boot/uboot/uboot.mk
> @@ -49,6 +49,9 @@ 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)
> +UBOOT_BIN = u-boot.sd
> +UBOOT_MAKE_TARGET = u-boot.sb

 Since sb and sd are visually so similar, I think it's worthwhile to add a small
comment here to say which is which. E.g.

# BootStream (.sb) file is built by U-Boot, we convert it to SD file

 I'll send an updated series with these changes.

 Regards,
 Arnout

>  else ifeq ($(BR2_TARGET_UBOOT_FORMAT_CUSTOM),y)
>  UBOOT_BIN = $(call qstrip,$(BR2_TARGET_UBOOT_FORMAT_CUSTOM_NAME))
>  else
> @@ -116,6 +119,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
> 


-- 
Arnout Vandecappelle                          arnout at mind be
Senior Embedded Software Architect            +32-16-286500
Essensium/Mind                                http://www.mind.be
G.Geenslaan 9, 3001 Leuven, Belgium           BE 872 984 063 RPR Leuven
LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle
GPG fingerprint:  7CB5 E4CC 6C2E EFD4 6E3D A754 F963 ECAB 2450 2F1F

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Buildroot] [PATCH 2/2] config: Add defconfig for Freescale i.MX28 EVK
  2015-03-18 18:06 ` [Buildroot] [PATCH 2/2] config: Add defconfig for Freescale i.MX28 EVK Vincent Stehlé
@ 2015-03-22 13:12   ` Arnout Vandecappelle
  0 siblings, 0 replies; 5+ messages in thread
From: Arnout Vandecappelle @ 2015-03-22 13:12 UTC (permalink / raw)
  To: buildroot

On 18/03/15 19:06, Vincent Stehl? wrote:
> 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.
> 
> Signed-off-by: Vincent Stehl? <vincent.stehle@freescale.com>
> Cc: Luca Ceresoli <luca@lucaceresoli.net>
> ---
[snip]
> diff --git a/configs/freescale_imx28evk_defconfig b/configs/freescale_imx28evk_defconfig
> new file mode 100644
> index 0000000..15cedeb
> --- /dev/null
> +++ b/configs/freescale_imx28evk_defconfig
> @@ -0,0 +1,18 @@
> +# architecture
> +BR2_arm=y
> +BR2_arm926t=y
> +
> +# system
> +BR2_TARGET_GENERIC_GETTY_PORT="ttyAMA0"
> +
> +# kernel
> +BR2_LINUX_KERNEL=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"

 For reproducible builds, the kernel and bootloader versions should be fixed to
something that you tested.

 I'll assume that that's 3.19.2 and 2015.01 and resubmit.

 Regards,
 Arnout

> +
> +# bootloader
> +BR2_TARGET_UBOOT=y
> +BR2_TARGET_UBOOT_BOARDNAME="mx28evk"
> +BR2_TARGET_UBOOT_FORMAT_SD=y
> 


-- 
Arnout Vandecappelle                          arnout at mind be
Senior Embedded Software Architect            +32-16-286500
Essensium/Mind                                http://www.mind.be
G.Geenslaan 9, 3001 Leuven, Belgium           BE 872 984 063 RPR Leuven
LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle
GPG fingerprint:  7CB5 E4CC 6C2E EFD4 6E3D A754 F963 ECAB 2450 2F1F

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2015-03-22 13:12 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-03-18 18:06 [Buildroot] [PATCH 1/2] boot/uboot: add support for i.MX28 SD format Vincent Stehlé
2015-03-18 18:06 ` [Buildroot] [PATCH 2/2] config: Add defconfig for Freescale i.MX28 EVK Vincent Stehlé
2015-03-22 13:12   ` Arnout Vandecappelle
2015-03-18 19:53 ` [Buildroot] [PATCH 1/2] boot/uboot: add support for i.MX28 SD format Jörg Krause
2015-03-22 13:02 ` Arnout Vandecappelle

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox