Skip to contentSkip to conversation

configs/freescale_imx6dlsabresd: add defconfig for iMX6DL SabreSD

PATCH New Luca Ceresoli 3 participants 6 messages Aug 14, 2014 – Aug 26, 2014 Arm i.MX and Layerscape

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/2 configs/freescale_imx6dlsabresd: add defconfig for iMX6DL SabreSD

This is very similar to freescale_imx6sabresd_defconfig, which supports the i.MX6Q ("Quad", quad core CPU) version of the board, except it supports the i.MX6DL (DualLite, dual core CPU) version.

The differences are in the U-boot configuration and the device tree file.

Cc Gilles Talis <[email protected]>
Cc Gary Bisson <[email protected]>
Cc Vincent Stehl? <[email protected]>

---

Changes since v1: nothing.

---
 configs/freescale_imx6dlsabresd_defconfig | 27 +++++++++++++++++++++++++++
 1 file changed, 27 insertions(+)
 create mode 100644 configs/freescale_imx6dlsabresd_defconfig
configs/freescale_imx6dlsabresd_defconfig new file +27 -0
new file mode 100644
index 0000000..4177e16
@@ -0,0 +1,27 @@
+# architecture
+BR2_arm=y
+BR2_cortex_a9=y
+
+# system
+BR2_TARGET_GENERIC_GETTY_PORT="ttymxc0"
+
+# kernel
+BR2_LINUX_KERNEL=y
+BR2_LINUX_KERNEL_CUSTOM_GIT=y
+BR2_LINUX_KERNEL_CUSTOM_REPO_URL="git://git.freescale.com/imx/linux-2.6-imx.git"
+BR2_LINUX_KERNEL_CUSTOM_REPO_VERSION="rel_imx_3.10.17_1.0.0_ga"
+BR2_LINUX_KERNEL_DEFCONFIG="imx_v7"
+BR2_LINUX_KERNEL_UIMAGE_LOADADDR="0x10008000"
+BR2_LINUX_KERNEL_DTS_SUPPORT=y
+BR2_LINUX_KERNEL_INTREE_DTS_NAME="imx6dl-sabresd"
+
+# filesystem
+BR2_TARGET_ROOTFS_EXT2=y
+
+# bootloader
+BR2_TARGET_UBOOT=y
+BR2_TARGET_UBOOT_BOARDNAME="mx6dlsabresd"
+BR2_TARGET_UBOOT_FORMAT_IMX=y
+BR2_TARGET_UBOOT_CUSTOM_GIT=y
+BR2_TARGET_UBOOT_CUSTOM_REPO_URL="git://git.freescale.com/imx/uboot-imx.git"
+BR2_TARGET_UBOOT_CUSTOM_REPO_VERSION="rel_imx_3.10.17_1.0.0_ga"
Signature · 1 line
1.9.1
#1 lore raw

PATCH v2 2/2 freescale/imx6-sabresd: document how to create a bootable SD

Document how to create a bootable SD card for the two supported SABRESD cards:
i.MX6Q and i.MX6DL.

The SD card creation relies on an ad-hoc script.

Cc Gilles Talis <[email protected]>
Cc Gary Bisson <[email protected]>
Cc Vincent Stehl? <[email protected]>

---

Changes since v1:
- properly handle SD/MMC devices that don't need the "p" prefix before the partition number (reported by Vincent Stehl?);
- mention serial terminal parameters in readme.txt (suggested by Vincent Stehl?).

---
 board/freescale/imx6sabresd/create-boot-sd.sh | 95 +++++++++++++++++++++++++++
 board/freescale/imx6sabresd/readme.txt        | 67 +++++++++++++++++++
 2 files changed, 162 insertions(+)
 create mode 100755 board/freescale/imx6sabresd/create-boot-sd.sh
 create mode 100644 board/freescale/imx6sabresd/readme.txt
board/freescale/imx6sabresd/create-boot-sd.sh new file +95 -0
new file mode 100755
index 0000000..f82f7b3
@@ -0,0 +1,95 @@
+#!/bin/sh
+
+set -u
+set -e
+
+PROGNAME=$(basename $0)
+
+usage()
+{
+    echo "Create an SD card that boots on an i.MX6DL SABRESD board."
+    echo "It is supposed to work also for the i.MX6Q SABRESD board, but"
+    echo "it this is not tested."
+    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
+
+# Unmount the partitions if mounted
+umount ${PART1} || true
+umount ${PART2} || true
+
+# First, clear the card
+dd if=/dev/zero of=${DEV} bs=1M count=2
+
+sync
+
+# Partition the card.
+# SD layout for i.MX6 boot:
+# - Bootloader at offset 1024
+# - FAT partition starting at 1MB offset, containing uImage and *.dtb
+# - ext2/3 partition formatted as ext2 or ext3, containing the root filesystem.
+sfdisk ${DEV} <<EOF
+32,480,b
+512,,L
+EOF
+
+sync
+
+# Copy the bootloader@offset 1024
+dd if=output/images/u-boot.imx of=${DEV} obs=512 seek=2
+
+# Prepare a temp dir for mounting partitions
+TMPDIR=$(mktemp -d)
+
+# FAT partition: kernel and DTBs
+mkfs.vfat ${PART1}
+mount ${PART1} ${TMPDIR}
+cp output/images/uImage ${TMPDIR}/
+cp output/images/*.dtb  ${TMPDIR}/
+sync
+umount ${TMPDIR}
+
+# ext2 partition: root filesystem
+mkfs.ext2 ${PART2}
+mount ${PART2} ${TMPDIR}
+tar -C ${TMPDIR}/ -xf output/images/rootfs.tar
+sync
+umount ${TMPDIR}
+
+# Cleanup
+rmdir ${TMPDIR}
+sync
+echo Done
board/freescale/imx6sabresd/readme.txt new file +67 -0

67 lines not on this page · raw message

Signature · 1 line
1.9.1
#2 lore raw

PATCH v2 2/2 freescale/imx6-sabresd: document how to create a bootable SD

Quoted 2 lines · Luca Ceresoli

Document how to create a bootable SD card for the two supported SABRESD cards:
i.MX6Q and i.MX6DL.

Hi,

Thanks for such a fast update.

It works for me on i.MX6Q Sabre SD, thanks.

Best regards,

V.

#3 lore raw

PATCH v2 2/2 freescale/imx6-sabresd: document how to create a bootable SD

In reply to Luca Ceresoli

Hi,

I noticed a little annoyance with this version of the script when it processes an SD that it had already processed before. This may happen for example after the user has activated more target packages, rebuilt and wants to recreate SD with the new root filesystem.

See below for a description of what happens.

Quoted 5 lines · Luca Ceresoli
board/freescale/imx6sabresd/create-boot-sd.sh new file +0 -0
new file mode 100755
index 0000000..f82f7b3

[...]

board/freescale/imx6sabresd/create-boot-sd.sh line 55

Quoted 6 lines
board/freescale/imx6sabresd/create-boot-sd.sh new file +6 -0
+# Unmount the partitions if mounted
+umount ${PART1} || true
+umount ${PART2} || true
+
+# First, clear the card
+dd if=/dev/zero of=${DEV} bs=1M count=2

This erases the first 2 MB of the SD, which include the partition table, the bootloader and the beginning of the FAT partition. It does not touch the ext2 partition.

board/freescale/imx6sabresd/create-boot-sd.sh line 67

Quoted 12 lines
board/freescale/imx6sabresd/create-boot-sd.sh new file +12 -0
+
+sync
+
+# Partition the card.
+# SD layout for i.MX6 boot:
+# - Bootloader at offset 1024
+# - FAT partition starting at 1MB offset, containing uImage and *.dtb
+# - ext2/3 partition formatted as ext2 or ext3, containing the root filesystem.
+sfdisk ${DEV} <<EOF
+32,480,b
+512,,L
+EOF

Here the host system detects the newly created partitions. Since the ext2 has not been touched it contains valid data, and a desktop-oriented automounter "might" want to mount it right away (mine does of course).

Waiting some time and then umounting it just-in-case is an option, but I preferred to just change the 'dd' command above to erase 20 MB, not 2, so it also invalidates the ext2 partition.

I'll resubmit with this change.

Signature · 1 line
Luca
#4 lore raw

PATCH v2 1/2 configs/freescale_imx6dlsabresd: add defconfig for iMX6DL SabreSD

In reply to Luca Ceresoli

Hi Luca,

Quoted 6 lines · Luca Ceresoli

This is very similar to freescale_imx6sabresd_defconfig, which supports the i.MX6Q ("Quad", quad core CPU) version of the board, except it supports the i.MX6DL (DualLite, dual core CPU) version.

The differences are in the U-boot configuration and the device tree file.

Looks good to me, however I would then rename the previous freescale_imx6sabresd_defconfig to freescale_imx6qsabresd_defconfig in order for it to be clear.

Thanks,
Gary
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.busybox.net/pipermail/buildroot/attachments/20140825/174bc795/attachment.html>

#5 lore raw

PATCH v2 1/2 configs/freescale_imx6dlsabresd: add defconfig for iMX6DL SabreSD

Dear Gary,

Quoted 11 lines · Gary Bisson

Hi Luca,

On Thu, Aug 14, 2014 at 5:36 AM, Luca Ceresoli <[email protected] <mailto:[email protected]>> wrote:

This is very similar to freescale_imx6sabresd_defconfig, which supports the
i.MX6Q ("Quad", quad core CPU) version of the board, except it supports the
i.MX6DL (DualLite, dual core CPU) version.

Quoted 7 lines

The differences are in the U-boot configuration and the device tree file.

Looks good to me, however I would then rename the previous freescale_imx6sabresd_defconfig to freescale_imx6qsabresd_defconfig in order for it to be clear.

I was not sure it's a good idea to rename a defconfig, but I see we've done it before at least once:

     commit 094d8ec896ef0c447a4bfb884753bf8984d67dbc
     Author: mathieu benoit <[email protected]>
     Date:   Sun Nov 10 13:16:22 2013 +0100

         configs: rename rpi_defconfig for consistency

     [...]

      board/raspberrypi/readme.txt  |  8 ++++----
      configs/raspberrypi_defconfig | 23 +++++++++++++++++++++++
      configs/rpi_defconfig         | 23 -----------------------
      3 files changed, 27 insertions(+), 27 deletions(-)

So I'll resubmit my patchset with this added.

Thanks,

Signature · 1 line
Luca