boot/uboot: add support for i.MX28 SD format
PATCH 1/2 boot/uboot: add support for i.MX28 SD format
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.
--- boot/uboot/Config.in | 12 ++++++++++++ boot/uboot/uboot.mk | 5 +++++ 2 files changed, 17 insertions(+)
boot/uboot/Config.in +12 -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 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
boot/uboot/uboot.mk +5 -0
@@ -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
Signature · 1 line
2.1.4
PATCH 2/2 config: Add defconfig for Freescale i.MX28 EVK
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.
--- 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
board/freescale/imx28evk/create-boot-sd.sh new file +97 -0
@@ -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 +18 -0
@@ -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
Signature · 1 line
2.1.4
PATCH 2/2 config: Add defconfig for Freescale i.MX28 EVK
Quoted 11 lines · Vincent Stehl?
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? <[email protected]>Cc Luca Ceresoli <[email protected]>---
[snip]
Quoted 9 lines
configs/freescale_imx28evk_defconfig new file +3
-0@@ -0,0 +1,18 @@ +# architecture +BR2_arm=y +BR2_arm926t=y
configs/freescale_imx28evk_defconfig line 13
Quoted 10 lines
configs/freescale_imx28evk_defconfig new file +10
-0+ +# 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
Quoted 6 lines
configs/freescale_imx28evk_defconfig new file +5
-0+ +# bootloader +BR2_TARGET_UBOOT=y +BR2_TARGET_UBOOT_BOARDNAME="mx28evk" +BR2_TARGET_UBOOT_FORMAT_SD=y
Signature · 6 lines
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
PATCH 1/2 boot/uboot: add support for i.MX28 SD format
In reply to Vincent StehléQuoted 52 lines · Vincent Stehl?
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? <[email protected]>--- boot/uboot/Config.in | 12 ++++++++++++ boot/uboot/uboot.mk | 5 +++++ 2 files changed, 17 insertions(+)boot/uboot/Config.in +12
-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 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)" helpboot/uboot/uboot.mk +3
-0@@ -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
boot/uboot/uboot.mk define UBOOT_BUILD_CMDS · line 126
Quoted 8 lines
boot/uboot/uboot.mk +2
-0@@ -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.
PATCH 1/2 boot/uboot: add support for i.MX28 SD format
In reply to Vincent StehléQuoted 19 lines · Vincent Stehl?
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? <[email protected]>--- boot/uboot/Config.in | 12 ++++++++++++ boot/uboot/uboot.mk | 5 +++++ 2 files changed, 17 insertions(+)boot/uboot/Config.in +0
-0
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 from an
Lines should wrap at 72 columns.
boot/uboot/Config.in config BR2_TARGET_UBOOT_FORMAT_SB · line 128
Quoted 4 lines
boot/uboot/Config.in +4
-0+ 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.
boot/uboot/Config.in config BR2_TARGET_UBOOT_FORMAT_SB · line 130
Quoted 2 lines
boot/uboot/Config.in +2
-0+ + 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.
Quoted 9 lines
boot/uboot/Config.in +1
-0+ config BR2_TARGET_UBOOT_FORMAT_CUSTOM bool "Custom (specify below)" helpboot/uboot/uboot.mk +0
-0
boot/uboot/uboot.mk else ifeq ($(BR2_TARGET_UBOOT_FORMAT_SB),y) · line 54
Quoted 6 lines
boot/uboot/uboot.mk +3
-0@@ -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
Quoted 13 lines
boot/uboot/uboot.mk +2
-0else 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
Signature · 6 lines
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