* [Buildroot] [PATCH v2 1/1] Solid-Run HummingBoard i2eX defconfig and bootable microSD Bash script
@ 2015-06-01 21:56 Jonathan Ben-Avraham
2015-06-01 22:00 ` Jonathan Ben Avraham
2016-01-12 21:48 ` Yann E. MORIN
0 siblings, 2 replies; 9+ messages in thread
From: Jonathan Ben-Avraham @ 2015-06-01 21:56 UTC (permalink / raw)
To: buildroot
Solid-Run HummingBoard i2eX defconfig and bootable microSD Bash script
Fixed various
Signed-off-by: Jonathan Ben-Avraham <yba@tkos.co.il>
---
board/solid-run/hummingboard-i2eX/readme.txt | 19 ++
board/solid-run/make_sd_card.sh | 259 +++++++++++++++++++++++++++
configs/hummingboard_i2eX_defconfig | 25 +++
3 files changed, 303 insertions(+)
create mode 100644 board/solid-run/hummingboard-i2eX/readme.txt
create mode 100755 board/solid-run/make_sd_card.sh
create mode 100644 configs/hummingboard_i2eX_defconfig
diff --git a/board/solid-run/hummingboard-i2eX/readme.txt b/board/solid-run/hummingboard-i2eX/readme.txt
new file mode 100644
index 0000000..d7995f4
--- /dev/null
+++ b/board/solid-run/hummingboard-i2eX/readme.txt
@@ -0,0 +1,19 @@
+Solid-Run HummingBoard-i2eX minimal defconfig, without WiFi or OpenGL firmware
+is provided in configs/hummingboard_i2eX_defconfig
+
+Bash script for creating bootable microSD cards is in
+board/solid-run/make_sd_card.sh
+
+Example usage:
+
+sudo make_sd_card.sh sde output HummingBoard-i2eX 256
+
+where:
+ "sde" is the basename of the device file "/dev/sde'
+ "output" is the Buildroot output directory, in this case for an in-tree build
+ "HummingBoard-i2eX" is the board model
+ 256 is the size of the rootfs partition in MiB (default 128 MiB)
+
+See also the USAGE variable in the make_sd_card.sh.
+
+Maintainer: yba at tkos.co.il
diff --git a/board/solid-run/make_sd_card.sh b/board/solid-run/make_sd_card.sh
new file mode 100755
index 0000000..c15427a
--- /dev/null
+++ b/board/solid-run/make_sd_card.sh
@@ -0,0 +1,259 @@
+#!/bin/bash -eu
+# @(#) Create a bootable SD card from Buildroot tree for Solid-Run boards
+#
+# Copyright (c) 2015 Tk Open Systems Ltd. all rights reserved
+#
+# When distributed as part of Buildroot, this file is licensed to the public
+# under the terms of the GNU General Public License version 2, as published by
+# the Free Software Foundation. See http://www.gnu.org/licenses.
+#
+# When received from the copyright holder, this file is licensed under the
+# terms of the "Attribution-ShareAlike 4.0 International" license, See full
+# text at https://creativecommons.org/licenses/by-sa/4.0/legalcode
+#
+# Maintainer: yba at tkos.co.il
+# See: configs/hummingboard_i2eX_defconfig
+
+ME=$(basename ${0})
+
+! read -d '' USAGE << EOM
+USAGE: ${ME} <SD device> <BR output> <board model> [<rootfs size>]
+where:
+ <SD device> is the basename of the device file, e.g. "sdb", "mmcblk0"
+ <BR output> is the Buildroot output directory, e.g. "/home/yba/buildroot/output"
+ <board model> is "hummingboard_i2eX" or the DTB filename in the images directory
+ <rootfs size> is the size of the rootfs partition in MiB (default 128 MiB)
+EOM
+
+ERROR=0
+
+if [ -z "${1+x}" ]
+then
+ if [ -z "${DEVICE+x}" ]
+ then
+ echo "${ME} ERROR: No DEVICE env var or device specification in first parameter"
+ ERROR=$((${ERROR}+1))
+ fi
+ if [ -z "${BUILDROOT_OUTPUT_DIR+x}" ]
+ then
+ echo "${ME} ERROR: No BUILDROOT_OUTPUT_DIR directory specification env var or in second parameter"
+ ERROR=$((${ERROR}+1))
+ fi
+ if [ -z "${BOARD_MODEL+x}" ]
+ then
+ echo "${ME} ERROR: No BOARD_MODEL specification env var or in third parameter"
+ ERROR=$((${ERROR}+1))
+ fi
+else
+ DEVICE=${1}
+ if [ -z "${2+x}" ]
+ then
+ if [ -z "${BUILDROOT_OUTPUT_DIR+x}" ]
+ then
+ echo "${ME} ERROR: No BUILDROOT_OUTPUT_DIR directory specification env var or in second parameter"
+ ERROR=$((${ERROR}+1))
+ fi
+ else
+ BUILDROOT_OUTPUT_DIR=${2}
+ if [ -z "${3+x}" ]
+ then
+ if [ -z "${BOARD_MODEL+x}" ]
+ then
+ echo "${ME} ERROR: No BOARD_MODEL specification env var or in third parameter"
+ ERROR=$((${ERROR}+1))
+ fi
+ else
+ BOARD_MODEL=${3}
+ fi
+ fi
+fi
+if [ 0 -ne ${EUID} ]
+then
+ echo "${ME} ERROR: You need to run this script as root or using 'sudo'."
+ ERROR=$((${ERROR}+1))
+fi
+
+[ 0 -lt ${ERROR} ] && { echo "${USAGE}"; exit 1; }
+
+if [ -z "${4+x}" ]
+then
+ if [ -z "${ROOTFS_PARTITION_SIZE+x}" ]
+ then
+ ROOTFS_PARTITION_SIZE=128
+ fi
+else
+ ROOTFS_PARTITION_SIZE=${4}
+fi
+
+# The SD DEVICE could be specified as "mmcblk[0-9]+" or "sd[a-z]" and the SD partitions
+# as "mmcblk[0-9]+p[1-2]" or "sd[a-z][1-2]" so we need to check if the "p" is needed
+
+if echo ${DEVICE} | grep -q mmcblk
+then
+ P="p"
+else
+ P=""
+fi
+
+PART1=/dev/${DEVICE}${P}1
+PART2=/dev/${DEVICE}${P}2
+
+if [ -z "${DEVICE}" ]
+then
+ echo "${ME} ERROR: You need to specify a non-empty SD device name as the"
+ echo "first command line parameter to this script or in the DEVICE env var."
+ echo "For example 'sdb' or 'mmcblk0'. Be careful not to do something silly"
+ echo "like specifying your system hard drive device."
+ ERROR=$((${ERROR}+1))
+else
+ if [ ! -b /dev/${DEVICE} ]
+ then
+ echo "${ME} ERROR: /dev/${DEVICE} is not a block device file"
+ ERROR=$((${ERROR}+1))
+ fi
+fi
+
+if [ -f /etc/multipath.conf ]
+then
+ if grep -q blacklist /etc/multipath.conf && ! grep -q ${DEVICE} /etc/multipath.conf
+ then
+ echo
+ echo "==> WARNING: You probably want to blacklist ${DEVICE} in /etc/multipath.conf"
+ echo "==> Otherwise the kernel will not be notified of partition changes"
+ echo
+ sleep 5
+ fi
+fi
+
+if [ -z "${BUILDROOT_OUTPUT_DIR}" ]
+then
+ echo "${ME} ERROR: You need to specify the Buildroot output directory as"
+ echo "the third command line parameter to this script or in the BUILDROOT_OUTPUT_DIR"
+ echo "env var."
+ ERROR=$((${ERROR}+1))
+else
+ if [ ! -d "${BUILDROOT_OUTPUT_DIR}" ]
+ then
+ echo "${ME} ERROR: The [${BUILDROOT_OUTPUT_DIR}] directory does not"
+ echo "exist."
+ ERROR=$((${ERROR}+1))
+ fi
+fi
+
+if [ ! -f ${BUILDROOT_OUTPUT_DIR}/images/rootfs.tar ]
+then
+ echo "${ME} ERROR: The rootfs image file "
+ echo "[${BUILDROOT_OUTPUT_DIR}/images/rootfs.tar]"
+ echo "was not found."
+ echo "Check that the second parameter is the fully qualified directory."
+ ERROR=$((${ERROR}+1))
+fi
+
+PATH=${BUILDROOT_OUTPUT_DIR}/host/usr/sbin/:${PATH}
+
+for BIN in "sfdisk mkfs.ext4 mount umount dd mktemp partprobe"
+do
+ if ! which ${BIN} >/dev/null
+ then
+ echo "${ME} ERROR: Required executable ${BIN} is not in PATH [${PATH}]"
+ ERROR=$((${ERROR}+1))
+ fi
+done
+
+MOUNT_POINT=$(mktemp -d /tmp/solid-run.XXXX)
+if [ ! -d "${MOUNT_POINT}" ]
+then
+ echo "${ME} ERROR: Can't create mount point"
+ exit 1
+fi
+
+[ 0 -lt ${ERROR} ] && exit 1
+
+# The devices might have already been mounted somewhere else by the automounter
+# so unmount them here
+while umount ${PART2}
+do
+ echo "${ME} Notice: Unmounted ${PART2}"
+done
+
+while umount ${PART1}
+do
+ echo "${ME} Notice: Unmounted ${PART1}"
+done
+
+# Zap any partition table on the SD
+dd if=/dev/zero of=/dev/${DEVICE} bs=1024 count=32
+
+# 1MiB = 2048 Sectors of 512B
+P1_SIZE=$((2048*32))
+P2_START=$((2048+${P1_SIZE}+1))
+P2_SIZE=$((2048*${ROOTFS_PARTITION_SIZE}))
+
+# Start the first partition at 1MiB = 2048*512
+# Use -u S to get predictable partition sizes and placement
+printf "2028,${P1_SIZE},b,*\n${P2_START},${P2_SIZE},L,-\n" | \
+ sfdisk -u S --no-reread /dev/${DEVICE}
+
+sync
+partprobe /dev/${DEVICE}
+
+[ ! -b ${PART2} ] && printf "Waiting for partitions to be updated"
+while [ ! -b ${PART2} ]
+do
+ sleep 1
+ printf " ."
+done
+echo
+
+# Hat tip to hste and jas for this recipe
+if ! mkfs.ext4 -F -O ^has_journal -E stride=2,stripe-width=1024 -b 4096 ${PART2}
+then
+ echo "${ME} ERROR: Failed to create ext4 filesystem on ${PART2}"
+ exit 1
+fi
+
+if ! mount ${PART2} ${MOUNT_POINT}
+then
+ echo "${ME} ERROR: Cannot mount ${PART2} on ${MOUNT_POINT}"
+ exit 1
+fi
+
+tar xvf ${BUILDROOT_OUTPUT_DIR}/images/rootfs.tar -C ${MOUNT_POINT}
+umount ${MOUNT_POINT}
+
+if ! mkfs.ext4 -F -O ^has_journal -E stride=2,stripe-width=1024 -b 4096 ${PART1}
+then
+ echo "${ME} ERROR: Failed to create ext4 filesystem on ${PART1}"
+ exit 1
+fi
+
+if ! mount ${PART1} ${MOUNT_POINT}
+then
+ echo "${ME} ERROR: Cannot mount ${PART1} on ${MOUNT_POINT}"
+ exit 1
+fi
+
+cp ${BUILDROOT_OUTPUT_DIR}/images/zImage ${MOUNT_POINT}
+
+case ${BOARD_MODEL} in
+ HummingBoard-i2eX)
+ cp ${BUILDROOT_OUTPUT_DIR}/images/imx6q-hummingboard.dtb \
+ ${MOUNT_POINT}
+ ;;
+ *)
+ if [ -f ${BUILDROOT_OUTPUT_DIR}/images/${BOARD_MODEL} ]
+ then
+ cp ${BUILDROOT_OUTPUT_DIR}/images/${BOARD_MODEL} \
+ ${MOUNT_POINT}
+ else
+ echo "${ME} WARNING: No dtb file found"
+ fi
+ ;;
+esac
+
+umount ${MOUNT_POINT}
+
+dd if=${BUILDROOT_OUTPUT_DIR}/images/SPL of=/dev/${DEVICE} bs=1K seek=1
+dd if=${BUILDROOT_OUTPUT_DIR}/images/u-boot.img of=/dev/${DEVICE} bs=1K seek=42
+sync
+rmdir ${MOUNT_POINT}
diff --git a/configs/hummingboard_i2eX_defconfig b/configs/hummingboard_i2eX_defconfig
new file mode 100644
index 0000000..cd359fc
--- /dev/null
+++ b/configs/hummingboard_i2eX_defconfig
@@ -0,0 +1,25 @@
+BR2_arm=y
+BR2_cortex_a9=y
+BR2_ARM_EABIHF=y
+BR2_ARM_FPU_VFPV3=y
+BR2_TOOLCHAIN_EXTERNAL=y
+BR2_TARGET_GENERIC_HOSTNAME="HummingBoard"
+BR2_TARGET_GENERIC_ISSUE="Welcome to HummingBoard i2eX"
+BR2_LINUX_KERNEL=y
+BR2_LINUX_KERNEL_CUSTOM_GIT=y
+BR2_LINUX_KERNEL_CUSTOM_REPO_URL="https://github.com/SolidRun/linux-imx6-3.14.git"
+BR2_LINUX_KERNEL_CUSTOM_REPO_VERSION="ea83bda1b403d745c67fbf6ea307d05ca138577f"
+BR2_LINUX_KERNEL_DEFCONFIG="imx_v7_cbi_hb"
+BR2_LINUX_KERNEL_ZIMAGE=y
+BR2_LINUX_KERNEL_DTS_SUPPORT=y
+BR2_LINUX_KERNEL_INTREE_DTS_NAME="imx6q-hummingboard"
+BR2_LINUX_KERNEL_INSTALL_TARGET=y
+BR2_TARGET_UBOOT=y
+BR2_TARGET_UBOOT_BOARDNAME="mx6_cubox-i"
+BR2_TARGET_UBOOT_CUSTOM_GIT=y
+BR2_TARGET_UBOOT_CUSTOM_REPO_URL="https://github.com/SolidRun/u-boot-imx6.git"
+BR2_TARGET_UBOOT_CUSTOM_REPO_VERSION="e817fa3165a607b581433a6abfe37e095a5d1dc9"
+BR2_TARGET_UBOOT_FORMAT_IMG=y
+BR2_TARGET_UBOOT_SPL=y
+BR2_TARGET_UBOOT_SPL_NAME="SPL"
+BR2_PACKAGE_HOST_UBOOT_TOOLS=y
--
2.1.4
^ permalink raw reply related [flat|nested] 9+ messages in thread* [Buildroot] [PATCH v2 1/1] Solid-Run HummingBoard i2eX defconfig and bootable microSD Bash script
2015-06-01 21:56 [Buildroot] [PATCH v2 1/1] Solid-Run HummingBoard i2eX defconfig and bootable microSD Bash script Jonathan Ben-Avraham
@ 2015-06-01 22:00 ` Jonathan Ben Avraham
2016-01-12 21:48 ` Yann E. MORIN
1 sibling, 0 replies; 9+ messages in thread
From: Jonathan Ben Avraham @ 2015-06-01 22:00 UTC (permalink / raw)
To: buildroot
Should read "v3".
- yba
On Tue, 2 Jun 2015, Jonathan Ben-Avraham wrote:
> Date: Tue, 2 Jun 2015 00:56:02 +0300
> From: Jonathan Ben-Avraham <yba@tkos.co.il>
> To: buildroot at buildroot.org
> Cc: Jonathan Ben-Avraham <yba@tkos.co.il>
> Subject: [PATCH v2 1/1] Solid-Run HummingBoard i2eX defconfig and bootable
> microSD Bash script
>
> Solid-Run HummingBoard i2eX defconfig and bootable microSD Bash script
>
> Fixed various
>
> Signed-off-by: Jonathan Ben-Avraham <yba@tkos.co.il>
> ---
> board/solid-run/hummingboard-i2eX/readme.txt | 19 ++
> board/solid-run/make_sd_card.sh | 259 +++++++++++++++++++++++++++
> configs/hummingboard_i2eX_defconfig | 25 +++
> 3 files changed, 303 insertions(+)
> create mode 100644 board/solid-run/hummingboard-i2eX/readme.txt
> create mode 100755 board/solid-run/make_sd_card.sh
> create mode 100644 configs/hummingboard_i2eX_defconfig
>
> diff --git a/board/solid-run/hummingboard-i2eX/readme.txt b/board/solid-run/hummingboard-i2eX/readme.txt
> new file mode 100644
> index 0000000..d7995f4
> --- /dev/null
> +++ b/board/solid-run/hummingboard-i2eX/readme.txt
> @@ -0,0 +1,19 @@
> +Solid-Run HummingBoard-i2eX minimal defconfig, without WiFi or OpenGL firmware
> +is provided in configs/hummingboard_i2eX_defconfig
> +
> +Bash script for creating bootable microSD cards is in
> +board/solid-run/make_sd_card.sh
> +
> +Example usage:
> +
> +sudo make_sd_card.sh sde output HummingBoard-i2eX 256
> +
> +where:
> + "sde" is the basename of the device file "/dev/sde'
> + "output" is the Buildroot output directory, in this case for an in-tree build
> + "HummingBoard-i2eX" is the board model
> + 256 is the size of the rootfs partition in MiB (default 128 MiB)
> +
> +See also the USAGE variable in the make_sd_card.sh.
> +
> +Maintainer: yba at tkos.co.il
> diff --git a/board/solid-run/make_sd_card.sh b/board/solid-run/make_sd_card.sh
> new file mode 100755
> index 0000000..c15427a
> --- /dev/null
> +++ b/board/solid-run/make_sd_card.sh
> @@ -0,0 +1,259 @@
> +#!/bin/bash -eu
> +# @(#) Create a bootable SD card from Buildroot tree for Solid-Run boards
> +#
> +# Copyright (c) 2015 Tk Open Systems Ltd. all rights reserved
> +#
> +# When distributed as part of Buildroot, this file is licensed to the public
> +# under the terms of the GNU General Public License version 2, as published by
> +# the Free Software Foundation. See http://www.gnu.org/licenses.
> +#
> +# When received from the copyright holder, this file is licensed under the
> +# terms of the "Attribution-ShareAlike 4.0 International" license, See full
> +# text at https://creativecommons.org/licenses/by-sa/4.0/legalcode
> +#
> +# Maintainer: yba at tkos.co.il
> +# See: configs/hummingboard_i2eX_defconfig
> +
> +ME=$(basename ${0})
> +
> +! read -d '' USAGE << EOM
> +USAGE: ${ME} <SD device> <BR output> <board model> [<rootfs size>]
> +where:
> + <SD device> is the basename of the device file, e.g. "sdb", "mmcblk0"
> + <BR output> is the Buildroot output directory, e.g. "/home/yba/buildroot/output"
> + <board model> is "hummingboard_i2eX" or the DTB filename in the images directory
> + <rootfs size> is the size of the rootfs partition in MiB (default 128 MiB)
> +EOM
> +
> +ERROR=0
> +
> +if [ -z "${1+x}" ]
> +then
> + if [ -z "${DEVICE+x}" ]
> + then
> + echo "${ME} ERROR: No DEVICE env var or device specification in first parameter"
> + ERROR=$((${ERROR}+1))
> + fi
> + if [ -z "${BUILDROOT_OUTPUT_DIR+x}" ]
> + then
> + echo "${ME} ERROR: No BUILDROOT_OUTPUT_DIR directory specification env var or in second parameter"
> + ERROR=$((${ERROR}+1))
> + fi
> + if [ -z "${BOARD_MODEL+x}" ]
> + then
> + echo "${ME} ERROR: No BOARD_MODEL specification env var or in third parameter"
> + ERROR=$((${ERROR}+1))
> + fi
> +else
> + DEVICE=${1}
> + if [ -z "${2+x}" ]
> + then
> + if [ -z "${BUILDROOT_OUTPUT_DIR+x}" ]
> + then
> + echo "${ME} ERROR: No BUILDROOT_OUTPUT_DIR directory specification env var or in second parameter"
> + ERROR=$((${ERROR}+1))
> + fi
> + else
> + BUILDROOT_OUTPUT_DIR=${2}
> + if [ -z "${3+x}" ]
> + then
> + if [ -z "${BOARD_MODEL+x}" ]
> + then
> + echo "${ME} ERROR: No BOARD_MODEL specification env var or in third parameter"
> + ERROR=$((${ERROR}+1))
> + fi
> + else
> + BOARD_MODEL=${3}
> + fi
> + fi
> +fi
> +if [ 0 -ne ${EUID} ]
> +then
> + echo "${ME} ERROR: You need to run this script as root or using 'sudo'."
> + ERROR=$((${ERROR}+1))
> +fi
> +
> +[ 0 -lt ${ERROR} ] && { echo "${USAGE}"; exit 1; }
> +
> +if [ -z "${4+x}" ]
> +then
> + if [ -z "${ROOTFS_PARTITION_SIZE+x}" ]
> + then
> + ROOTFS_PARTITION_SIZE=128
> + fi
> +else
> + ROOTFS_PARTITION_SIZE=${4}
> +fi
> +
> +# The SD DEVICE could be specified as "mmcblk[0-9]+" or "sd[a-z]" and the SD partitions
> +# as "mmcblk[0-9]+p[1-2]" or "sd[a-z][1-2]" so we need to check if the "p" is needed
> +
> +if echo ${DEVICE} | grep -q mmcblk
> +then
> + P="p"
> +else
> + P=""
> +fi
> +
> +PART1=/dev/${DEVICE}${P}1
> +PART2=/dev/${DEVICE}${P}2
> +
> +if [ -z "${DEVICE}" ]
> +then
> + echo "${ME} ERROR: You need to specify a non-empty SD device name as the"
> + echo "first command line parameter to this script or in the DEVICE env var."
> + echo "For example 'sdb' or 'mmcblk0'. Be careful not to do something silly"
> + echo "like specifying your system hard drive device."
> + ERROR=$((${ERROR}+1))
> +else
> + if [ ! -b /dev/${DEVICE} ]
> + then
> + echo "${ME} ERROR: /dev/${DEVICE} is not a block device file"
> + ERROR=$((${ERROR}+1))
> + fi
> +fi
> +
> +if [ -f /etc/multipath.conf ]
> +then
> + if grep -q blacklist /etc/multipath.conf && ! grep -q ${DEVICE} /etc/multipath.conf
> + then
> + echo
> + echo "==> WARNING: You probably want to blacklist ${DEVICE} in /etc/multipath.conf"
> + echo "==> Otherwise the kernel will not be notified of partition changes"
> + echo
> + sleep 5
> + fi
> +fi
> +
> +if [ -z "${BUILDROOT_OUTPUT_DIR}" ]
> +then
> + echo "${ME} ERROR: You need to specify the Buildroot output directory as"
> + echo "the third command line parameter to this script or in the BUILDROOT_OUTPUT_DIR"
> + echo "env var."
> + ERROR=$((${ERROR}+1))
> +else
> + if [ ! -d "${BUILDROOT_OUTPUT_DIR}" ]
> + then
> + echo "${ME} ERROR: The [${BUILDROOT_OUTPUT_DIR}] directory does not"
> + echo "exist."
> + ERROR=$((${ERROR}+1))
> + fi
> +fi
> +
> +if [ ! -f ${BUILDROOT_OUTPUT_DIR}/images/rootfs.tar ]
> +then
> + echo "${ME} ERROR: The rootfs image file "
> + echo "[${BUILDROOT_OUTPUT_DIR}/images/rootfs.tar]"
> + echo "was not found."
> + echo "Check that the second parameter is the fully qualified directory."
> + ERROR=$((${ERROR}+1))
> +fi
> +
> +PATH=${BUILDROOT_OUTPUT_DIR}/host/usr/sbin/:${PATH}
> +
> +for BIN in "sfdisk mkfs.ext4 mount umount dd mktemp partprobe"
> +do
> + if ! which ${BIN} >/dev/null
> + then
> + echo "${ME} ERROR: Required executable ${BIN} is not in PATH [${PATH}]"
> + ERROR=$((${ERROR}+1))
> + fi
> +done
> +
> +MOUNT_POINT=$(mktemp -d /tmp/solid-run.XXXX)
> +if [ ! -d "${MOUNT_POINT}" ]
> +then
> + echo "${ME} ERROR: Can't create mount point"
> + exit 1
> +fi
> +
> +[ 0 -lt ${ERROR} ] && exit 1
> +
> +# The devices might have already been mounted somewhere else by the automounter
> +# so unmount them here
> +while umount ${PART2}
> +do
> + echo "${ME} Notice: Unmounted ${PART2}"
> +done
> +
> +while umount ${PART1}
> +do
> + echo "${ME} Notice: Unmounted ${PART1}"
> +done
> +
> +# Zap any partition table on the SD
> +dd if=/dev/zero of=/dev/${DEVICE} bs=1024 count=32
> +
> +# 1MiB = 2048 Sectors of 512B
> +P1_SIZE=$((2048*32))
> +P2_START=$((2048+${P1_SIZE}+1))
> +P2_SIZE=$((2048*${ROOTFS_PARTITION_SIZE}))
> +
> +# Start the first partition at 1MiB = 2048*512
> +# Use -u S to get predictable partition sizes and placement
> +printf "2028,${P1_SIZE},b,*\n${P2_START},${P2_SIZE},L,-\n" | \
> + sfdisk -u S --no-reread /dev/${DEVICE}
> +
> +sync
> +partprobe /dev/${DEVICE}
> +
> +[ ! -b ${PART2} ] && printf "Waiting for partitions to be updated"
> +while [ ! -b ${PART2} ]
> +do
> + sleep 1
> + printf " ."
> +done
> +echo
> +
> +# Hat tip to hste and jas for this recipe
> +if ! mkfs.ext4 -F -O ^has_journal -E stride=2,stripe-width=1024 -b 4096 ${PART2}
> +then
> + echo "${ME} ERROR: Failed to create ext4 filesystem on ${PART2}"
> + exit 1
> +fi
> +
> +if ! mount ${PART2} ${MOUNT_POINT}
> +then
> + echo "${ME} ERROR: Cannot mount ${PART2} on ${MOUNT_POINT}"
> + exit 1
> +fi
> +
> +tar xvf ${BUILDROOT_OUTPUT_DIR}/images/rootfs.tar -C ${MOUNT_POINT}
> +umount ${MOUNT_POINT}
> +
> +if ! mkfs.ext4 -F -O ^has_journal -E stride=2,stripe-width=1024 -b 4096 ${PART1}
> +then
> + echo "${ME} ERROR: Failed to create ext4 filesystem on ${PART1}"
> + exit 1
> +fi
> +
> +if ! mount ${PART1} ${MOUNT_POINT}
> +then
> + echo "${ME} ERROR: Cannot mount ${PART1} on ${MOUNT_POINT}"
> + exit 1
> +fi
> +
> +cp ${BUILDROOT_OUTPUT_DIR}/images/zImage ${MOUNT_POINT}
> +
> +case ${BOARD_MODEL} in
> + HummingBoard-i2eX)
> + cp ${BUILDROOT_OUTPUT_DIR}/images/imx6q-hummingboard.dtb \
> + ${MOUNT_POINT}
> + ;;
> + *)
> + if [ -f ${BUILDROOT_OUTPUT_DIR}/images/${BOARD_MODEL} ]
> + then
> + cp ${BUILDROOT_OUTPUT_DIR}/images/${BOARD_MODEL} \
> + ${MOUNT_POINT}
> + else
> + echo "${ME} WARNING: No dtb file found"
> + fi
> + ;;
> +esac
> +
> +umount ${MOUNT_POINT}
> +
> +dd if=${BUILDROOT_OUTPUT_DIR}/images/SPL of=/dev/${DEVICE} bs=1K seek=1
> +dd if=${BUILDROOT_OUTPUT_DIR}/images/u-boot.img of=/dev/${DEVICE} bs=1K seek=42
> +sync
> +rmdir ${MOUNT_POINT}
> diff --git a/configs/hummingboard_i2eX_defconfig b/configs/hummingboard_i2eX_defconfig
> new file mode 100644
> index 0000000..cd359fc
> --- /dev/null
> +++ b/configs/hummingboard_i2eX_defconfig
> @@ -0,0 +1,25 @@
> +BR2_arm=y
> +BR2_cortex_a9=y
> +BR2_ARM_EABIHF=y
> +BR2_ARM_FPU_VFPV3=y
> +BR2_TOOLCHAIN_EXTERNAL=y
> +BR2_TARGET_GENERIC_HOSTNAME="HummingBoard"
> +BR2_TARGET_GENERIC_ISSUE="Welcome to HummingBoard i2eX"
> +BR2_LINUX_KERNEL=y
> +BR2_LINUX_KERNEL_CUSTOM_GIT=y
> +BR2_LINUX_KERNEL_CUSTOM_REPO_URL="https://github.com/SolidRun/linux-imx6-3.14.git"
> +BR2_LINUX_KERNEL_CUSTOM_REPO_VERSION="ea83bda1b403d745c67fbf6ea307d05ca138577f"
> +BR2_LINUX_KERNEL_DEFCONFIG="imx_v7_cbi_hb"
> +BR2_LINUX_KERNEL_ZIMAGE=y
> +BR2_LINUX_KERNEL_DTS_SUPPORT=y
> +BR2_LINUX_KERNEL_INTREE_DTS_NAME="imx6q-hummingboard"
> +BR2_LINUX_KERNEL_INSTALL_TARGET=y
> +BR2_TARGET_UBOOT=y
> +BR2_TARGET_UBOOT_BOARDNAME="mx6_cubox-i"
> +BR2_TARGET_UBOOT_CUSTOM_GIT=y
> +BR2_TARGET_UBOOT_CUSTOM_REPO_URL="https://github.com/SolidRun/u-boot-imx6.git"
> +BR2_TARGET_UBOOT_CUSTOM_REPO_VERSION="e817fa3165a607b581433a6abfe37e095a5d1dc9"
> +BR2_TARGET_UBOOT_FORMAT_IMG=y
> +BR2_TARGET_UBOOT_SPL=y
> +BR2_TARGET_UBOOT_SPL_NAME="SPL"
> +BR2_PACKAGE_HOST_UBOOT_TOOLS=y
>
--
9590 8E58 D30D 1660 C349 673D B205 4FC4 B8F5 B7F9 ~. .~ Tk Open Systems
=}-------- Jonathan Ben-Avraham ("yba") ----------ooO--U--Ooo------------{=
mailto:yba at tkos.co.il tel:+972.52.486.3386 http://tkos.co.il skype:benavrhm
^ permalink raw reply [flat|nested] 9+ messages in thread* [Buildroot] [PATCH v2 1/1] Solid-Run HummingBoard i2eX defconfig and bootable microSD Bash script
2015-06-01 21:56 [Buildroot] [PATCH v2 1/1] Solid-Run HummingBoard i2eX defconfig and bootable microSD Bash script Jonathan Ben-Avraham
2015-06-01 22:00 ` Jonathan Ben Avraham
@ 2016-01-12 21:48 ` Yann E. MORIN
2016-01-13 5:58 ` Jonathan Ben Avraham
1 sibling, 1 reply; 9+ messages in thread
From: Yann E. MORIN @ 2016-01-12 21:48 UTC (permalink / raw)
To: buildroot
Jonathan, All,
On 2015-06-02 00:56 +0300, Jonathan Ben-Avraham spake thusly:
> Solid-Run HummingBoard i2eX defconfig and bootable microSD Bash script
We have started to use genimage to generate images without requiring to
be root.
See for example how it is done for the Raspberry Pi:
board/raspberrypi/
Otherwise, your script is really complex just to create two aprtitions
and put a bumch of files on the first and extract the rootfs on the
econd. genimage does that quite nicely.
The only "drawback" top genimage is that the generated image is just the
size required to put the rootfs. Not much additional space is available,
and you'll have to resize the FS afterwards (either on firt run or
manually after dumping the image on the device).
Would you care to have a look at using genimage instead?
I'm marking this patch as "changes requested" in the patchwork.
Thanks!
Regards,
Yann E. MORIN.
> Signed-off-by: Jonathan Ben-Avraham <yba@tkos.co.il>
> ---
> board/solid-run/hummingboard-i2eX/readme.txt | 19 ++
> board/solid-run/make_sd_card.sh | 259 +++++++++++++++++++++++++++
> configs/hummingboard_i2eX_defconfig | 25 +++
> 3 files changed, 303 insertions(+)
> create mode 100644 board/solid-run/hummingboard-i2eX/readme.txt
> create mode 100755 board/solid-run/make_sd_card.sh
> create mode 100644 configs/hummingboard_i2eX_defconfig
>
> diff --git a/board/solid-run/hummingboard-i2eX/readme.txt b/board/solid-run/hummingboard-i2eX/readme.txt
> new file mode 100644
> index 0000000..d7995f4
> --- /dev/null
> +++ b/board/solid-run/hummingboard-i2eX/readme.txt
> @@ -0,0 +1,19 @@
> +Solid-Run HummingBoard-i2eX minimal defconfig, without WiFi or OpenGL firmware
> +is provided in configs/hummingboard_i2eX_defconfig
> +
> +Bash script for creating bootable microSD cards is in
> +board/solid-run/make_sd_card.sh
> +
> +Example usage:
> +
> +sudo make_sd_card.sh sde output HummingBoard-i2eX 256
> +
> +where:
> + "sde" is the basename of the device file "/dev/sde'
> + "output" is the Buildroot output directory, in this case for an in-tree build
> + "HummingBoard-i2eX" is the board model
> + 256 is the size of the rootfs partition in MiB (default 128 MiB)
> +
> +See also the USAGE variable in the make_sd_card.sh.
> +
> +Maintainer: yba at tkos.co.il
> diff --git a/board/solid-run/make_sd_card.sh b/board/solid-run/make_sd_card.sh
> new file mode 100755
> index 0000000..c15427a
> --- /dev/null
> +++ b/board/solid-run/make_sd_card.sh
> @@ -0,0 +1,259 @@
> +#!/bin/bash -eu
> +# @(#) Create a bootable SD card from Buildroot tree for Solid-Run boards
> +#
> +# Copyright (c) 2015 Tk Open Systems Ltd. all rights reserved
> +#
> +# When distributed as part of Buildroot, this file is licensed to the public
> +# under the terms of the GNU General Public License version 2, as published by
> +# the Free Software Foundation. See http://www.gnu.org/licenses.
> +#
> +# When received from the copyright holder, this file is licensed under the
> +# terms of the "Attribution-ShareAlike 4.0 International" license, See full
> +# text at https://creativecommons.org/licenses/by-sa/4.0/legalcode
> +#
> +# Maintainer: yba at tkos.co.il
> +# See: configs/hummingboard_i2eX_defconfig
> +
> +ME=$(basename ${0})
> +
> +! read -d '' USAGE << EOM
> +USAGE: ${ME} <SD device> <BR output> <board model> [<rootfs size>]
> +where:
> + <SD device> is the basename of the device file, e.g. "sdb", "mmcblk0"
> + <BR output> is the Buildroot output directory, e.g. "/home/yba/buildroot/output"
> + <board model> is "hummingboard_i2eX" or the DTB filename in the images directory
> + <rootfs size> is the size of the rootfs partition in MiB (default 128 MiB)
> +EOM
> +
> +ERROR=0
> +
> +if [ -z "${1+x}" ]
> +then
> + if [ -z "${DEVICE+x}" ]
> + then
> + echo "${ME} ERROR: No DEVICE env var or device specification in first parameter"
> + ERROR=$((${ERROR}+1))
> + fi
> + if [ -z "${BUILDROOT_OUTPUT_DIR+x}" ]
> + then
> + echo "${ME} ERROR: No BUILDROOT_OUTPUT_DIR directory specification env var or in second parameter"
> + ERROR=$((${ERROR}+1))
> + fi
> + if [ -z "${BOARD_MODEL+x}" ]
> + then
> + echo "${ME} ERROR: No BOARD_MODEL specification env var or in third parameter"
> + ERROR=$((${ERROR}+1))
> + fi
> +else
> + DEVICE=${1}
> + if [ -z "${2+x}" ]
> + then
> + if [ -z "${BUILDROOT_OUTPUT_DIR+x}" ]
> + then
> + echo "${ME} ERROR: No BUILDROOT_OUTPUT_DIR directory specification env var or in second parameter"
> + ERROR=$((${ERROR}+1))
> + fi
> + else
> + BUILDROOT_OUTPUT_DIR=${2}
> + if [ -z "${3+x}" ]
> + then
> + if [ -z "${BOARD_MODEL+x}" ]
> + then
> + echo "${ME} ERROR: No BOARD_MODEL specification env var or in third parameter"
> + ERROR=$((${ERROR}+1))
> + fi
> + else
> + BOARD_MODEL=${3}
> + fi
> + fi
> +fi
> +if [ 0 -ne ${EUID} ]
> +then
> + echo "${ME} ERROR: You need to run this script as root or using 'sudo'."
> + ERROR=$((${ERROR}+1))
> +fi
> +
> +[ 0 -lt ${ERROR} ] && { echo "${USAGE}"; exit 1; }
> +
> +if [ -z "${4+x}" ]
> +then
> + if [ -z "${ROOTFS_PARTITION_SIZE+x}" ]
> + then
> + ROOTFS_PARTITION_SIZE=128
> + fi
> +else
> + ROOTFS_PARTITION_SIZE=${4}
> +fi
> +
> +# The SD DEVICE could be specified as "mmcblk[0-9]+" or "sd[a-z]" and the SD partitions
> +# as "mmcblk[0-9]+p[1-2]" or "sd[a-z][1-2]" so we need to check if the "p" is needed
> +
> +if echo ${DEVICE} | grep -q mmcblk
> +then
> + P="p"
> +else
> + P=""
> +fi
> +
> +PART1=/dev/${DEVICE}${P}1
> +PART2=/dev/${DEVICE}${P}2
> +
> +if [ -z "${DEVICE}" ]
> +then
> + echo "${ME} ERROR: You need to specify a non-empty SD device name as the"
> + echo "first command line parameter to this script or in the DEVICE env var."
> + echo "For example 'sdb' or 'mmcblk0'. Be careful not to do something silly"
> + echo "like specifying your system hard drive device."
> + ERROR=$((${ERROR}+1))
> +else
> + if [ ! -b /dev/${DEVICE} ]
> + then
> + echo "${ME} ERROR: /dev/${DEVICE} is not a block device file"
> + ERROR=$((${ERROR}+1))
> + fi
> +fi
> +
> +if [ -f /etc/multipath.conf ]
> +then
> + if grep -q blacklist /etc/multipath.conf && ! grep -q ${DEVICE} /etc/multipath.conf
> + then
> + echo
> + echo "==> WARNING: You probably want to blacklist ${DEVICE} in /etc/multipath.conf"
> + echo "==> Otherwise the kernel will not be notified of partition changes"
> + echo
> + sleep 5
> + fi
> +fi
> +
> +if [ -z "${BUILDROOT_OUTPUT_DIR}" ]
> +then
> + echo "${ME} ERROR: You need to specify the Buildroot output directory as"
> + echo "the third command line parameter to this script or in the BUILDROOT_OUTPUT_DIR"
> + echo "env var."
> + ERROR=$((${ERROR}+1))
> +else
> + if [ ! -d "${BUILDROOT_OUTPUT_DIR}" ]
> + then
> + echo "${ME} ERROR: The [${BUILDROOT_OUTPUT_DIR}] directory does not"
> + echo "exist."
> + ERROR=$((${ERROR}+1))
> + fi
> +fi
> +
> +if [ ! -f ${BUILDROOT_OUTPUT_DIR}/images/rootfs.tar ]
> +then
> + echo "${ME} ERROR: The rootfs image file "
> + echo "[${BUILDROOT_OUTPUT_DIR}/images/rootfs.tar]"
> + echo "was not found."
> + echo "Check that the second parameter is the fully qualified directory."
> + ERROR=$((${ERROR}+1))
> +fi
> +
> +PATH=${BUILDROOT_OUTPUT_DIR}/host/usr/sbin/:${PATH}
> +
> +for BIN in "sfdisk mkfs.ext4 mount umount dd mktemp partprobe"
> +do
> + if ! which ${BIN} >/dev/null
> + then
> + echo "${ME} ERROR: Required executable ${BIN} is not in PATH [${PATH}]"
> + ERROR=$((${ERROR}+1))
> + fi
> +done
> +
> +MOUNT_POINT=$(mktemp -d /tmp/solid-run.XXXX)
> +if [ ! -d "${MOUNT_POINT}" ]
> +then
> + echo "${ME} ERROR: Can't create mount point"
> + exit 1
> +fi
> +
> +[ 0 -lt ${ERROR} ] && exit 1
> +
> +# The devices might have already been mounted somewhere else by the automounter
> +# so unmount them here
> +while umount ${PART2}
> +do
> + echo "${ME} Notice: Unmounted ${PART2}"
> +done
> +
> +while umount ${PART1}
> +do
> + echo "${ME} Notice: Unmounted ${PART1}"
> +done
> +
> +# Zap any partition table on the SD
> +dd if=/dev/zero of=/dev/${DEVICE} bs=1024 count=32
> +
> +# 1MiB = 2048 Sectors of 512B
> +P1_SIZE=$((2048*32))
> +P2_START=$((2048+${P1_SIZE}+1))
> +P2_SIZE=$((2048*${ROOTFS_PARTITION_SIZE}))
> +
> +# Start the first partition at 1MiB = 2048*512
> +# Use -u S to get predictable partition sizes and placement
> +printf "2028,${P1_SIZE},b,*\n${P2_START},${P2_SIZE},L,-\n" | \
> + sfdisk -u S --no-reread /dev/${DEVICE}
> +
> +sync
> +partprobe /dev/${DEVICE}
> +
> +[ ! -b ${PART2} ] && printf "Waiting for partitions to be updated"
> +while [ ! -b ${PART2} ]
> +do
> + sleep 1
> + printf " ."
> +done
> +echo
> +
> +# Hat tip to hste and jas for this recipe
> +if ! mkfs.ext4 -F -O ^has_journal -E stride=2,stripe-width=1024 -b 4096 ${PART2}
> +then
> + echo "${ME} ERROR: Failed to create ext4 filesystem on ${PART2}"
> + exit 1
> +fi
> +
> +if ! mount ${PART2} ${MOUNT_POINT}
> +then
> + echo "${ME} ERROR: Cannot mount ${PART2} on ${MOUNT_POINT}"
> + exit 1
> +fi
> +
> +tar xvf ${BUILDROOT_OUTPUT_DIR}/images/rootfs.tar -C ${MOUNT_POINT}
> +umount ${MOUNT_POINT}
> +
> +if ! mkfs.ext4 -F -O ^has_journal -E stride=2,stripe-width=1024 -b 4096 ${PART1}
> +then
> + echo "${ME} ERROR: Failed to create ext4 filesystem on ${PART1}"
> + exit 1
> +fi
> +
> +if ! mount ${PART1} ${MOUNT_POINT}
> +then
> + echo "${ME} ERROR: Cannot mount ${PART1} on ${MOUNT_POINT}"
> + exit 1
> +fi
> +
> +cp ${BUILDROOT_OUTPUT_DIR}/images/zImage ${MOUNT_POINT}
> +
> +case ${BOARD_MODEL} in
> + HummingBoard-i2eX)
> + cp ${BUILDROOT_OUTPUT_DIR}/images/imx6q-hummingboard.dtb \
> + ${MOUNT_POINT}
> + ;;
> + *)
> + if [ -f ${BUILDROOT_OUTPUT_DIR}/images/${BOARD_MODEL} ]
> + then
> + cp ${BUILDROOT_OUTPUT_DIR}/images/${BOARD_MODEL} \
> + ${MOUNT_POINT}
> + else
> + echo "${ME} WARNING: No dtb file found"
> + fi
> + ;;
> +esac
> +
> +umount ${MOUNT_POINT}
> +
> +dd if=${BUILDROOT_OUTPUT_DIR}/images/SPL of=/dev/${DEVICE} bs=1K seek=1
> +dd if=${BUILDROOT_OUTPUT_DIR}/images/u-boot.img of=/dev/${DEVICE} bs=1K seek=42
> +sync
> +rmdir ${MOUNT_POINT}
> diff --git a/configs/hummingboard_i2eX_defconfig b/configs/hummingboard_i2eX_defconfig
> new file mode 100644
> index 0000000..cd359fc
> --- /dev/null
> +++ b/configs/hummingboard_i2eX_defconfig
> @@ -0,0 +1,25 @@
> +BR2_arm=y
> +BR2_cortex_a9=y
> +BR2_ARM_EABIHF=y
> +BR2_ARM_FPU_VFPV3=y
> +BR2_TOOLCHAIN_EXTERNAL=y
> +BR2_TARGET_GENERIC_HOSTNAME="HummingBoard"
> +BR2_TARGET_GENERIC_ISSUE="Welcome to HummingBoard i2eX"
> +BR2_LINUX_KERNEL=y
> +BR2_LINUX_KERNEL_CUSTOM_GIT=y
> +BR2_LINUX_KERNEL_CUSTOM_REPO_URL="https://github.com/SolidRun/linux-imx6-3.14.git"
> +BR2_LINUX_KERNEL_CUSTOM_REPO_VERSION="ea83bda1b403d745c67fbf6ea307d05ca138577f"
> +BR2_LINUX_KERNEL_DEFCONFIG="imx_v7_cbi_hb"
> +BR2_LINUX_KERNEL_ZIMAGE=y
> +BR2_LINUX_KERNEL_DTS_SUPPORT=y
> +BR2_LINUX_KERNEL_INTREE_DTS_NAME="imx6q-hummingboard"
> +BR2_LINUX_KERNEL_INSTALL_TARGET=y
> +BR2_TARGET_UBOOT=y
> +BR2_TARGET_UBOOT_BOARDNAME="mx6_cubox-i"
> +BR2_TARGET_UBOOT_CUSTOM_GIT=y
> +BR2_TARGET_UBOOT_CUSTOM_REPO_URL="https://github.com/SolidRun/u-boot-imx6.git"
> +BR2_TARGET_UBOOT_CUSTOM_REPO_VERSION="e817fa3165a607b581433a6abfe37e095a5d1dc9"
> +BR2_TARGET_UBOOT_FORMAT_IMG=y
> +BR2_TARGET_UBOOT_SPL=y
> +BR2_TARGET_UBOOT_SPL_NAME="SPL"
> +BR2_PACKAGE_HOST_UBOOT_TOOLS=y
> --
> 2.1.4
>
> _______________________________________________
> buildroot mailing list
> buildroot at busybox.net
> http://lists.busybox.net/mailman/listinfo/buildroot
--
.-----------------.--------------------.------------------.--------------------.
| Yann E. MORIN | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software Designer | \ / CAMPAIGN | ___ |
| +33 223 225 172 `------------.-------: X AGAINST | \e/ There is no |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL | v conspiracy. |
'------------------------------^-------^------------------^--------------------'
^ permalink raw reply [flat|nested] 9+ messages in thread* [Buildroot] [PATCH v2 1/1] Solid-Run HummingBoard i2eX defconfig and bootable microSD Bash script
2016-01-12 21:48 ` Yann E. MORIN
@ 2016-01-13 5:58 ` Jonathan Ben Avraham
0 siblings, 0 replies; 9+ messages in thread
From: Jonathan Ben Avraham @ 2016-01-13 5:58 UTC (permalink / raw)
To: buildroot
Hi Yann,
I'll change the state to "rejected".
Thanks,
- yba
On Tue, 12 Jan 2016, Yann E. MORIN wrote:
> Date: Tue, 12 Jan 2016 22:48:10 +0100
> From: Yann E. MORIN <yann.morin.1998@free.fr>
> To: Jonathan Ben-Avraham <yba@tkos.co.il>
> Cc: buildroot at buildroot.org
> Subject: Re: [Buildroot] [PATCH v2 1/1] Solid-Run HummingBoard i2eX defconfig
> and bootable microSD Bash script
>
> Jonathan, All,
>
> On 2015-06-02 00:56 +0300, Jonathan Ben-Avraham spake thusly:
>> Solid-Run HummingBoard i2eX defconfig and bootable microSD Bash script
>
> We have started to use genimage to generate images without requiring to
> be root.
>
> See for example how it is done for the Raspberry Pi:
> board/raspberrypi/
>
> Otherwise, your script is really complex just to create two aprtitions
> and put a bumch of files on the first and extract the rootfs on the
> econd. genimage does that quite nicely.
>
> The only "drawback" top genimage is that the generated image is just the
> size required to put the rootfs. Not much additional space is available,
> and you'll have to resize the FS afterwards (either on firt run or
> manually after dumping the image on the device).
>
> Would you care to have a look at using genimage instead?
>
> I'm marking this patch as "changes requested" in the patchwork.
>
> Thanks!
>
> Regards,
> Yann E. MORIN.
>
>> Signed-off-by: Jonathan Ben-Avraham <yba@tkos.co.il>
>> ---
>> board/solid-run/hummingboard-i2eX/readme.txt | 19 ++
>> board/solid-run/make_sd_card.sh | 259 +++++++++++++++++++++++++++
>> configs/hummingboard_i2eX_defconfig | 25 +++
>> 3 files changed, 303 insertions(+)
>> create mode 100644 board/solid-run/hummingboard-i2eX/readme.txt
>> create mode 100755 board/solid-run/make_sd_card.sh
>> create mode 100644 configs/hummingboard_i2eX_defconfig
>>
>> diff --git a/board/solid-run/hummingboard-i2eX/readme.txt b/board/solid-run/hummingboard-i2eX/readme.txt
>> new file mode 100644
>> index 0000000..d7995f4
>> --- /dev/null
>> +++ b/board/solid-run/hummingboard-i2eX/readme.txt
>> @@ -0,0 +1,19 @@
>> +Solid-Run HummingBoard-i2eX minimal defconfig, without WiFi or OpenGL firmware
>> +is provided in configs/hummingboard_i2eX_defconfig
>> +
>> +Bash script for creating bootable microSD cards is in
>> +board/solid-run/make_sd_card.sh
>> +
>> +Example usage:
>> +
>> +sudo make_sd_card.sh sde output HummingBoard-i2eX 256
>> +
>> +where:
>> + "sde" is the basename of the device file "/dev/sde'
>> + "output" is the Buildroot output directory, in this case for an in-tree build
>> + "HummingBoard-i2eX" is the board model
>> + 256 is the size of the rootfs partition in MiB (default 128 MiB)
>> +
>> +See also the USAGE variable in the make_sd_card.sh.
>> +
>> +Maintainer: yba at tkos.co.il
>> diff --git a/board/solid-run/make_sd_card.sh b/board/solid-run/make_sd_card.sh
>> new file mode 100755
>> index 0000000..c15427a
>> --- /dev/null
>> +++ b/board/solid-run/make_sd_card.sh
>> @@ -0,0 +1,259 @@
>> +#!/bin/bash -eu
>> +# @(#) Create a bootable SD card from Buildroot tree for Solid-Run boards
>> +#
>> +# Copyright (c) 2015 Tk Open Systems Ltd. all rights reserved
>> +#
>> +# When distributed as part of Buildroot, this file is licensed to the public
>> +# under the terms of the GNU General Public License version 2, as published by
>> +# the Free Software Foundation. See http://www.gnu.org/licenses.
>> +#
>> +# When received from the copyright holder, this file is licensed under the
>> +# terms of the "Attribution-ShareAlike 4.0 International" license, See full
>> +# text at https://creativecommons.org/licenses/by-sa/4.0/legalcode
>> +#
>> +# Maintainer: yba at tkos.co.il
>> +# See: configs/hummingboard_i2eX_defconfig
>> +
>> +ME=$(basename ${0})
>> +
>> +! read -d '' USAGE << EOM
>> +USAGE: ${ME} <SD device> <BR output> <board model> [<rootfs size>]
>> +where:
>> + <SD device> is the basename of the device file, e.g. "sdb", "mmcblk0"
>> + <BR output> is the Buildroot output directory, e.g. "/home/yba/buildroot/output"
>> + <board model> is "hummingboard_i2eX" or the DTB filename in the images directory
>> + <rootfs size> is the size of the rootfs partition in MiB (default 128 MiB)
>> +EOM
>> +
>> +ERROR=0
>> +
>> +if [ -z "${1+x}" ]
>> +then
>> + if [ -z "${DEVICE+x}" ]
>> + then
>> + echo "${ME} ERROR: No DEVICE env var or device specification in first parameter"
>> + ERROR=$((${ERROR}+1))
>> + fi
>> + if [ -z "${BUILDROOT_OUTPUT_DIR+x}" ]
>> + then
>> + echo "${ME} ERROR: No BUILDROOT_OUTPUT_DIR directory specification env var or in second parameter"
>> + ERROR=$((${ERROR}+1))
>> + fi
>> + if [ -z "${BOARD_MODEL+x}" ]
>> + then
>> + echo "${ME} ERROR: No BOARD_MODEL specification env var or in third parameter"
>> + ERROR=$((${ERROR}+1))
>> + fi
>> +else
>> + DEVICE=${1}
>> + if [ -z "${2+x}" ]
>> + then
>> + if [ -z "${BUILDROOT_OUTPUT_DIR+x}" ]
>> + then
>> + echo "${ME} ERROR: No BUILDROOT_OUTPUT_DIR directory specification env var or in second parameter"
>> + ERROR=$((${ERROR}+1))
>> + fi
>> + else
>> + BUILDROOT_OUTPUT_DIR=${2}
>> + if [ -z "${3+x}" ]
>> + then
>> + if [ -z "${BOARD_MODEL+x}" ]
>> + then
>> + echo "${ME} ERROR: No BOARD_MODEL specification env var or in third parameter"
>> + ERROR=$((${ERROR}+1))
>> + fi
>> + else
>> + BOARD_MODEL=${3}
>> + fi
>> + fi
>> +fi
>> +if [ 0 -ne ${EUID} ]
>> +then
>> + echo "${ME} ERROR: You need to run this script as root or using 'sudo'."
>> + ERROR=$((${ERROR}+1))
>> +fi
>> +
>> +[ 0 -lt ${ERROR} ] && { echo "${USAGE}"; exit 1; }
>> +
>> +if [ -z "${4+x}" ]
>> +then
>> + if [ -z "${ROOTFS_PARTITION_SIZE+x}" ]
>> + then
>> + ROOTFS_PARTITION_SIZE=128
>> + fi
>> +else
>> + ROOTFS_PARTITION_SIZE=${4}
>> +fi
>> +
>> +# The SD DEVICE could be specified as "mmcblk[0-9]+" or "sd[a-z]" and the SD partitions
>> +# as "mmcblk[0-9]+p[1-2]" or "sd[a-z][1-2]" so we need to check if the "p" is needed
>> +
>> +if echo ${DEVICE} | grep -q mmcblk
>> +then
>> + P="p"
>> +else
>> + P=""
>> +fi
>> +
>> +PART1=/dev/${DEVICE}${P}1
>> +PART2=/dev/${DEVICE}${P}2
>> +
>> +if [ -z "${DEVICE}" ]
>> +then
>> + echo "${ME} ERROR: You need to specify a non-empty SD device name as the"
>> + echo "first command line parameter to this script or in the DEVICE env var."
>> + echo "For example 'sdb' or 'mmcblk0'. Be careful not to do something silly"
>> + echo "like specifying your system hard drive device."
>> + ERROR=$((${ERROR}+1))
>> +else
>> + if [ ! -b /dev/${DEVICE} ]
>> + then
>> + echo "${ME} ERROR: /dev/${DEVICE} is not a block device file"
>> + ERROR=$((${ERROR}+1))
>> + fi
>> +fi
>> +
>> +if [ -f /etc/multipath.conf ]
>> +then
>> + if grep -q blacklist /etc/multipath.conf && ! grep -q ${DEVICE} /etc/multipath.conf
>> + then
>> + echo
>> + echo "==> WARNING: You probably want to blacklist ${DEVICE} in /etc/multipath.conf"
>> + echo "==> Otherwise the kernel will not be notified of partition changes"
>> + echo
>> + sleep 5
>> + fi
>> +fi
>> +
>> +if [ -z "${BUILDROOT_OUTPUT_DIR}" ]
>> +then
>> + echo "${ME} ERROR: You need to specify the Buildroot output directory as"
>> + echo "the third command line parameter to this script or in the BUILDROOT_OUTPUT_DIR"
>> + echo "env var."
>> + ERROR=$((${ERROR}+1))
>> +else
>> + if [ ! -d "${BUILDROOT_OUTPUT_DIR}" ]
>> + then
>> + echo "${ME} ERROR: The [${BUILDROOT_OUTPUT_DIR}] directory does not"
>> + echo "exist."
>> + ERROR=$((${ERROR}+1))
>> + fi
>> +fi
>> +
>> +if [ ! -f ${BUILDROOT_OUTPUT_DIR}/images/rootfs.tar ]
>> +then
>> + echo "${ME} ERROR: The rootfs image file "
>> + echo "[${BUILDROOT_OUTPUT_DIR}/images/rootfs.tar]"
>> + echo "was not found."
>> + echo "Check that the second parameter is the fully qualified directory."
>> + ERROR=$((${ERROR}+1))
>> +fi
>> +
>> +PATH=${BUILDROOT_OUTPUT_DIR}/host/usr/sbin/:${PATH}
>> +
>> +for BIN in "sfdisk mkfs.ext4 mount umount dd mktemp partprobe"
>> +do
>> + if ! which ${BIN} >/dev/null
>> + then
>> + echo "${ME} ERROR: Required executable ${BIN} is not in PATH [${PATH}]"
>> + ERROR=$((${ERROR}+1))
>> + fi
>> +done
>> +
>> +MOUNT_POINT=$(mktemp -d /tmp/solid-run.XXXX)
>> +if [ ! -d "${MOUNT_POINT}" ]
>> +then
>> + echo "${ME} ERROR: Can't create mount point"
>> + exit 1
>> +fi
>> +
>> +[ 0 -lt ${ERROR} ] && exit 1
>> +
>> +# The devices might have already been mounted somewhere else by the automounter
>> +# so unmount them here
>> +while umount ${PART2}
>> +do
>> + echo "${ME} Notice: Unmounted ${PART2}"
>> +done
>> +
>> +while umount ${PART1}
>> +do
>> + echo "${ME} Notice: Unmounted ${PART1}"
>> +done
>> +
>> +# Zap any partition table on the SD
>> +dd if=/dev/zero of=/dev/${DEVICE} bs=1024 count=32
>> +
>> +# 1MiB = 2048 Sectors of 512B
>> +P1_SIZE=$((2048*32))
>> +P2_START=$((2048+${P1_SIZE}+1))
>> +P2_SIZE=$((2048*${ROOTFS_PARTITION_SIZE}))
>> +
>> +# Start the first partition at 1MiB = 2048*512
>> +# Use -u S to get predictable partition sizes and placement
>> +printf "2028,${P1_SIZE},b,*\n${P2_START},${P2_SIZE},L,-\n" | \
>> + sfdisk -u S --no-reread /dev/${DEVICE}
>> +
>> +sync
>> +partprobe /dev/${DEVICE}
>> +
>> +[ ! -b ${PART2} ] && printf "Waiting for partitions to be updated"
>> +while [ ! -b ${PART2} ]
>> +do
>> + sleep 1
>> + printf " ."
>> +done
>> +echo
>> +
>> +# Hat tip to hste and jas for this recipe
>> +if ! mkfs.ext4 -F -O ^has_journal -E stride=2,stripe-width=1024 -b 4096 ${PART2}
>> +then
>> + echo "${ME} ERROR: Failed to create ext4 filesystem on ${PART2}"
>> + exit 1
>> +fi
>> +
>> +if ! mount ${PART2} ${MOUNT_POINT}
>> +then
>> + echo "${ME} ERROR: Cannot mount ${PART2} on ${MOUNT_POINT}"
>> + exit 1
>> +fi
>> +
>> +tar xvf ${BUILDROOT_OUTPUT_DIR}/images/rootfs.tar -C ${MOUNT_POINT}
>> +umount ${MOUNT_POINT}
>> +
>> +if ! mkfs.ext4 -F -O ^has_journal -E stride=2,stripe-width=1024 -b 4096 ${PART1}
>> +then
>> + echo "${ME} ERROR: Failed to create ext4 filesystem on ${PART1}"
>> + exit 1
>> +fi
>> +
>> +if ! mount ${PART1} ${MOUNT_POINT}
>> +then
>> + echo "${ME} ERROR: Cannot mount ${PART1} on ${MOUNT_POINT}"
>> + exit 1
>> +fi
>> +
>> +cp ${BUILDROOT_OUTPUT_DIR}/images/zImage ${MOUNT_POINT}
>> +
>> +case ${BOARD_MODEL} in
>> + HummingBoard-i2eX)
>> + cp ${BUILDROOT_OUTPUT_DIR}/images/imx6q-hummingboard.dtb \
>> + ${MOUNT_POINT}
>> + ;;
>> + *)
>> + if [ -f ${BUILDROOT_OUTPUT_DIR}/images/${BOARD_MODEL} ]
>> + then
>> + cp ${BUILDROOT_OUTPUT_DIR}/images/${BOARD_MODEL} \
>> + ${MOUNT_POINT}
>> + else
>> + echo "${ME} WARNING: No dtb file found"
>> + fi
>> + ;;
>> +esac
>> +
>> +umount ${MOUNT_POINT}
>> +
>> +dd if=${BUILDROOT_OUTPUT_DIR}/images/SPL of=/dev/${DEVICE} bs=1K seek=1
>> +dd if=${BUILDROOT_OUTPUT_DIR}/images/u-boot.img of=/dev/${DEVICE} bs=1K seek=42
>> +sync
>> +rmdir ${MOUNT_POINT}
>> diff --git a/configs/hummingboard_i2eX_defconfig b/configs/hummingboard_i2eX_defconfig
>> new file mode 100644
>> index 0000000..cd359fc
>> --- /dev/null
>> +++ b/configs/hummingboard_i2eX_defconfig
>> @@ -0,0 +1,25 @@
>> +BR2_arm=y
>> +BR2_cortex_a9=y
>> +BR2_ARM_EABIHF=y
>> +BR2_ARM_FPU_VFPV3=y
>> +BR2_TOOLCHAIN_EXTERNAL=y
>> +BR2_TARGET_GENERIC_HOSTNAME="HummingBoard"
>> +BR2_TARGET_GENERIC_ISSUE="Welcome to HummingBoard i2eX"
>> +BR2_LINUX_KERNEL=y
>> +BR2_LINUX_KERNEL_CUSTOM_GIT=y
>> +BR2_LINUX_KERNEL_CUSTOM_REPO_URL="https://github.com/SolidRun/linux-imx6-3.14.git"
>> +BR2_LINUX_KERNEL_CUSTOM_REPO_VERSION="ea83bda1b403d745c67fbf6ea307d05ca138577f"
>> +BR2_LINUX_KERNEL_DEFCONFIG="imx_v7_cbi_hb"
>> +BR2_LINUX_KERNEL_ZIMAGE=y
>> +BR2_LINUX_KERNEL_DTS_SUPPORT=y
>> +BR2_LINUX_KERNEL_INTREE_DTS_NAME="imx6q-hummingboard"
>> +BR2_LINUX_KERNEL_INSTALL_TARGET=y
>> +BR2_TARGET_UBOOT=y
>> +BR2_TARGET_UBOOT_BOARDNAME="mx6_cubox-i"
>> +BR2_TARGET_UBOOT_CUSTOM_GIT=y
>> +BR2_TARGET_UBOOT_CUSTOM_REPO_URL="https://github.com/SolidRun/u-boot-imx6.git"
>> +BR2_TARGET_UBOOT_CUSTOM_REPO_VERSION="e817fa3165a607b581433a6abfe37e095a5d1dc9"
>> +BR2_TARGET_UBOOT_FORMAT_IMG=y
>> +BR2_TARGET_UBOOT_SPL=y
>> +BR2_TARGET_UBOOT_SPL_NAME="SPL"
>> +BR2_PACKAGE_HOST_UBOOT_TOOLS=y
>> --
>> 2.1.4
>>
>> _______________________________________________
>> buildroot mailing list
>> buildroot at busybox.net
>> http://lists.busybox.net/mailman/listinfo/buildroot
>
>
--
9590 8E58 D30D 1660 C349 673D B205 4FC4 B8F5 B7F9 ~. .~ Tk Open Systems
=}-------- Jonathan Ben-Avraham ("yba") ----------ooO--U--Ooo------------{=
mailto:yba at tkos.co.il tel:+972.52.486.3386 http://tkos.co.il skype:benavrhm
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Buildroot] [PATCH v2 1/1] Solid-Run HummingBoard i2eX defconfig and bootable microSD Bash script
@ 2015-05-30 22:31 Jonathan Ben-Avraham
2015-05-31 7:08 ` Baruch Siach
0 siblings, 1 reply; 9+ messages in thread
From: Jonathan Ben-Avraham @ 2015-05-30 22:31 UTC (permalink / raw)
To: buildroot
Solid-Run HummingBoard i2eX defconfig and bootable microSD Bash script
Signed-off-by: Jonathan Ben-Avraham <yba@tkos.co.il>
---
board/solid-run/hummingboard-i2eX/readme.txt | 11 ++
board/solid-run/make_sd_card.sh | 278 +++++++++++++++++++++++++++
configs/hummingboard_i2eX_defconfig | 25 +++
3 files changed, 314 insertions(+)
create mode 100644 board/solid-run/hummingboard-i2eX/readme.txt
create mode 100755 board/solid-run/make_sd_card.sh
create mode 100644 configs/hummingboard_i2eX_defconfig
diff --git a/board/solid-run/hummingboard-i2eX/readme.txt b/board/solid-run/hummingboard-i2eX/readme.txt
new file mode 100644
index 0000000..4e25179
--- /dev/null
+++ b/board/solid-run/hummingboard-i2eX/readme.txt
@@ -0,0 +1,11 @@
+Solid-Run HummingBoard-i2eX minimal defconfig, without WiFi or OpenGL firmware
+is provided in configs/hummingboard_i2eX_defconfig
+
+Bash script for creating bootable microSD cards is in
+board/solid-run/make_sd_card.sh
+
+Example usage:
+
+sudo make_sd_card.sh sde output HummingBoard-i2eX 256
+
+Maintainer: yba at tkos.co.il
diff --git a/board/solid-run/make_sd_card.sh b/board/solid-run/make_sd_card.sh
new file mode 100755
index 0000000..8586ff6
--- /dev/null
+++ b/board/solid-run/make_sd_card.sh
@@ -0,0 +1,278 @@
+#!/bin/bash -eu
+# @(#) Create a bootable SD card from Buildroot tree for Solid-Run boards
+#
+# Copyright (c) 2015 Tk Open Systems Ltd. all rights reserved
+# License granted for public use under the terms of the "Attribution-ShareAlike
+# 4.0 International" license, See full text at
+# https://creativecommons.org/licenses/by-sa/4.0/legalcode
+# Maintainer: yba at tkos.co.il
+# See: configs/hummingboard_i2eX_defconfig
+
+ME=$(basename ${0})
+
+! read -d '' USAGE << EOM
+USAGE: ${ME} <SD device> <BR output> <board model> [<rootfs size>]
+where:
+ <SD device> is the basename of the device file, e.g. "sdb", "mmcblk0"
+ <BR output> is the Buildroot output directory, e.g. "/home/yba/buildroot/output"
+ <board model> is "hummingboard_i2eX" or the DTB filename in the images directory
+ <rootfs size> is the size of the rootfs partition in MiB (default 128 MiB)
+EOM
+
+ERROR=0
+
+if [ -z "${1+x}" ]
+then
+ if [ -z "${DEVICE+x}" ]
+ then
+ echo "${ME} ERROR: No DEVICE env var or device specification in first parameter"
+ ERROR=$((${ERROR}+1))
+ fi
+ if [ -z "${BUILDROOT_OUTPUT_DIR+x}" ]
+ then
+ echo "${ME} ERROR: No BUILDROOT_OUTPUT_DIR directory specification env var or in second parameter"
+ ERROR=$((${ERROR}+1))
+ fi
+ if [ -z "${BOARD_MODEL+x}" ]
+ then
+ echo "${ME} ERROR: No BOARD_MODEL specification env var or in third parameter"
+ ERROR=$((${ERROR}+1))
+ fi
+else
+ DEVICE=${1}
+ if [ -z "${2+x}" ]
+ then
+ if [ -z "${BUILDROOT_OUTPUT_DIR+x}" ]
+ then
+ echo "${ME} ERROR: No BUILDROOT_OUTPUT_DIR directory specification env var or in second parameter"
+ ERROR=$((${ERROR}+1))
+ fi
+ else
+ BUILDROOT_OUTPUT_DIR=${2}
+ if [ -z "${3+x}" ]
+ then
+ if [ -z "${BOARD_MODEL+x}" ]
+ then
+ echo "${ME} ERROR: No BOARD_MODEL specification env var or in third parameter"
+ ERROR=$((${ERROR}+1))
+ fi
+ else
+ BOARD_MODEL=${3}
+ fi
+ fi
+fi
+[ 0 -lt ${ERROR} ] && { echo "${USAGE}"; exit 1; }
+ERROR=0
+
+if [ -z "${4+x}" ]
+then
+ if [ -z "${ROOTFS_PARTITION_SIZE+x}" ]
+ then
+ ROOTFS_PARTITION_SIZE=128
+ fi
+else
+ ROOTFS_PARTITION_SIZE=${4}
+fi
+
+
+# rootfs partition starting at 1MB with size of ROOTFS_PARTITION_SIZE
+ROOTFS_PARTITION="n\np\n1\n2048\n+16M\nn\np\n2\n\n+${ROOTFS_PARTITION_SIZE}M\na\n\nw\n"
+
+# Not so cool - I will have to maintain this script every time Rabeeh pushes
+# new code
+if [ -z "${KERNEL_DIR+x}" ]
+then
+ KERNEL_DIR=${BUILDROOT_OUTPUT_DIR}/build/linux-ea83bda1b403d745c67fbf6ea307d05ca138577f
+fi
+
+if [ -z "${UBOOT_DIR+x}" ]
+then
+ UBOOT_DIR=${BUILDROOT_OUTPUT_DIR}/build/uboot-e817fa3165a607b581433a6abfe37e095a5d1dc9
+fi
+
+# Handle Ubuntu fdisk silliness
+if echo $(uname -a) | grep -q Ubuntu
+then
+ FDISK="fdisk -c -u"
+else
+ FDISK="fdisk -u=sectors"
+fi
+
+# The SD DEVICE could be specified as "mmcblk[0-9]+" or "sd[a-z]" and the SD partitions
+# as "mmcblk[0-9]+p[1-2]" or "sd[a-z][1-2]" so we need to check if the "p" is needed
+
+if echo ${DEVICE} | grep -q mmcblk
+then
+ P="p"
+else
+ P=""
+fi
+
+PART1=/dev/${DEVICE}${P}1
+PART2=/dev/${DEVICE}${P}2
+
+if [ 0 -ne ${EUID} ]
+then
+ echo "${ME} ERROR: You need to run this script as root or using 'sudo'."
+ exit 1
+fi
+
+if [ -z "${DEVICE}" ]
+then
+ echo "${ME} ERROR: You need to specify a non-empty SD device name as the"
+ echo "first command line parameter to this script or in the DEVICE env var."
+ echo "For example 'sdb' or 'mmcblk0'. Be careful not to do something silly"
+ echo "like specifying your system hard drive device."
+ ERROR=$((${ERROR}+1))
+else
+ if [ ! -b /dev/${DEVICE} ]
+ then
+ echo "${ME} ERROR: /dev/${DEVICE} is not a block device file"
+ ERROR=$((${ERROR}+1))
+ fi
+fi
+
+if [ -f /etc/multipath.conf ]
+then
+ if grep -q blacklist /etc/multipath.conf && ! grep -q ${DEVICE} /etc/multipath.conf
+ then
+ echo
+ echo "==> WARNING: You probably want to blacklist ${DEVICE} in /etc/multipath.conf"
+ echo "==> Otherwise the kernel will not be notified of partition changes"
+ echo
+ sleep 5
+ fi
+fi
+
+if [ -z "${BUILDROOT_OUTPUT_DIR}" ]
+then
+ echo "${ME} ERROR: You need to specify the Buildroot output directory as"
+ echo "the third command line parameter to this script or in the BUILDROOT_OUTPUT_DIR"
+ echo "env var."
+ ERROR=$((${ERROR}+1))
+else
+ if [ ! -d "${BUILDROOT_OUTPUT_DIR}" ]
+ then
+ echo "${ME} ERROR: The [${BUILDROOT_OUTPUT_DIR}] directory does not"
+ echo "exist."
+ ERROR=$((${ERROR}+1))
+ fi
+fi
+
+if [ ! -d ${KERNEL_DIR} ]
+then
+ echo "${ME} INTERNAL ERROR: The kernel dir ${KERNEL_DIR} does not exist."
+ echo "The kernel version has probably been changed."
+ ERROR=$((${ERROR}+1))
+fi
+
+if [ ! -d ${UBOOT_DIR} ]
+then
+ echo "${ME} INTERNAL ERROR: The U-Boot dir ${UBOOT_DIR} does not exist."
+ echo "The kernel version has probably been changed."
+ ERROR=$((${ERROR}+1))
+fi
+
+if [ ! -f ${BUILDROOT_OUTPUT_DIR}/images/rootfs.tar ]
+then
+ echo "${ME} ERROR: The rootfs image file "
+ echo "[${BUILDROOT_OUTPUT_DIR}/images/rootfs.tar]"
+ echo "was not found."
+ echo "Check that the second parameter is the fully qualified directory."
+ ERROR=$((${ERROR}+1))
+fi
+
+
+BINS="fdisk mkfs.ext4 mount umount dd mktemp partprobe"
+for BIN in ${BINS}
+do
+ if ! which ${BIN} >/dev/null
+ then
+ echo "${ME} ERROR: Required executable ${BIN} is not in PATH"
+ ERROR=$((${ERROR}+1))
+ fi
+done
+
+MOUNT_POINT=$(mktemp -d /tmp/solid-run.XXXX)
+if [ ! -d "${MOUNT_POINT}" ]
+then
+ echo "${ME} ERROR: Can't create mount point"
+ exit 1
+fi
+
+[ 0 -lt ${ERROR} ] && exit 1
+
+# The devices might have already been mounted somewhere else by the automounter
+# so unmount them here
+while umount ${PART2}
+do
+ echo "${ME} Notice: Unmounted ${PART2}"
+done
+
+while umount ${PART1}
+do
+ echo "${ME} Notice: Unmounted ${PART1}"
+done
+
+# Zap any partition table on the SD
+dd if=/dev/zero of=/dev/${DEVICE} bs=1024 count=32
+
+printf ${ROOTFS_PARTITION} | ${FDISK} /dev/${DEVICE} || partprobe /dev/${DEVICE}
+sleep 2
+
+if [ ! -b ${PART2} ]
+then
+ echo "${ME} ERROR: ${PART2} partition not recognized"
+ exit 1
+fi
+
+# Hat tip to hste and jas for this recipe
+if ! mkfs.ext4 -F -O ^has_journal -E stride=2,stripe-width=1024 -b 4096 ${PART2}
+then
+ echo "${ME} ERROR: Failed to create ext4 filesystem on ${PART2}"
+ exit 1
+fi
+
+if ! mount ${PART2} ${MOUNT_POINT}
+then
+ echo "${ME} ERROR: Cannot mount ${PART2} on ${MOUNT_POINT}"
+ exit 1
+fi
+
+tar xvf ${BUILDROOT_OUTPUT_DIR}/images/rootfs.tar -C ${MOUNT_POINT}
+umount ${MOUNT_POINT}
+
+if ! mkfs.ext4 -F -O ^has_journal -E stride=2,stripe-width=1024 -b 4096 ${PART1}
+then
+ echo "${ME} ERROR: Failed to create ext4 filesystem on ${PART1}"
+ exit 1
+fi
+
+if ! mount ${PART1} ${MOUNT_POINT}
+then
+ echo "${ME} ERROR: Cannot mount ${PART1} on ${MOUNT_POINT}"
+ exit 1
+fi
+
+cp ${BUILDROOT_OUTPUT_DIR}/images/zImage ${MOUNT_POINT}
+
+case ${BOARD_MODEL} in
+ HummingBoard-i2eX)
+ cp ${BUILDROOT_OUTPUT_DIR}/images/imx6q-hummingboard.dtb ${MOUNT_POINT}
+ ;;
+ *)
+ if [ -f ${BUILDROOT_OUTPUT_DIR}/images/${BOARD_MODEL} ]
+ then
+ cp ${BUILDROOT_OUTPUT_DIR}/images/${BOARD_MODEL} ${MOUNT_POINT}
+ else
+ echo "${ME} WARNING: No dtb file found"
+ fi
+ ;;
+esac
+
+umount ${MOUNT_POINT}
+
+dd if=${BUILDROOT_OUTPUT_DIR}/images/SPL of=/dev/${DEVICE} bs=1K seek=1
+dd if=${BUILDROOT_OUTPUT_DIR}/images/u-boot.img of=/dev/${DEVICE} bs=1K seek=42
+sync
+rmdir ${MOUNT_POINT}
diff --git a/configs/hummingboard_i2eX_defconfig b/configs/hummingboard_i2eX_defconfig
new file mode 100644
index 0000000..cd359fc
--- /dev/null
+++ b/configs/hummingboard_i2eX_defconfig
@@ -0,0 +1,25 @@
+BR2_arm=y
+BR2_cortex_a9=y
+BR2_ARM_EABIHF=y
+BR2_ARM_FPU_VFPV3=y
+BR2_TOOLCHAIN_EXTERNAL=y
+BR2_TARGET_GENERIC_HOSTNAME="HummingBoard"
+BR2_TARGET_GENERIC_ISSUE="Welcome to HummingBoard i2eX"
+BR2_LINUX_KERNEL=y
+BR2_LINUX_KERNEL_CUSTOM_GIT=y
+BR2_LINUX_KERNEL_CUSTOM_REPO_URL="https://github.com/SolidRun/linux-imx6-3.14.git"
+BR2_LINUX_KERNEL_CUSTOM_REPO_VERSION="ea83bda1b403d745c67fbf6ea307d05ca138577f"
+BR2_LINUX_KERNEL_DEFCONFIG="imx_v7_cbi_hb"
+BR2_LINUX_KERNEL_ZIMAGE=y
+BR2_LINUX_KERNEL_DTS_SUPPORT=y
+BR2_LINUX_KERNEL_INTREE_DTS_NAME="imx6q-hummingboard"
+BR2_LINUX_KERNEL_INSTALL_TARGET=y
+BR2_TARGET_UBOOT=y
+BR2_TARGET_UBOOT_BOARDNAME="mx6_cubox-i"
+BR2_TARGET_UBOOT_CUSTOM_GIT=y
+BR2_TARGET_UBOOT_CUSTOM_REPO_URL="https://github.com/SolidRun/u-boot-imx6.git"
+BR2_TARGET_UBOOT_CUSTOM_REPO_VERSION="e817fa3165a607b581433a6abfe37e095a5d1dc9"
+BR2_TARGET_UBOOT_FORMAT_IMG=y
+BR2_TARGET_UBOOT_SPL=y
+BR2_TARGET_UBOOT_SPL_NAME="SPL"
+BR2_PACKAGE_HOST_UBOOT_TOOLS=y
--
2.1.4
^ permalink raw reply related [flat|nested] 9+ messages in thread* [Buildroot] [PATCH v2 1/1] Solid-Run HummingBoard i2eX defconfig and bootable microSD Bash script
2015-05-30 22:31 Jonathan Ben-Avraham
@ 2015-05-31 7:08 ` Baruch Siach
2015-05-31 7:40 ` Jonathan Ben Avraham
0 siblings, 1 reply; 9+ messages in thread
From: Baruch Siach @ 2015-05-31 7:08 UTC (permalink / raw)
To: buildroot
Hi Yonatan,
On Sun, May 31, 2015 at 01:31:24AM +0300, Jonathan Ben-Avraham wrote:
> Solid-Run HummingBoard i2eX defconfig and bootable microSD Bash script
>
> Signed-off-by: Jonathan Ben-Avraham <yba@tkos.co.il>
> ---
> board/solid-run/hummingboard-i2eX/readme.txt | 11 ++
> board/solid-run/make_sd_card.sh | 278 +++++++++++++++++++++++++++
> configs/hummingboard_i2eX_defconfig | 25 +++
> 3 files changed, 314 insertions(+)
> create mode 100644 board/solid-run/hummingboard-i2eX/readme.txt
> create mode 100755 board/solid-run/make_sd_card.sh
> create mode 100644 configs/hummingboard_i2eX_defconfig
>
> diff --git a/board/solid-run/hummingboard-i2eX/readme.txt b/board/solid-run/hummingboard-i2eX/readme.txt
> new file mode 100644
> index 0000000..4e25179
> --- /dev/null
> +++ b/board/solid-run/hummingboard-i2eX/readme.txt
> @@ -0,0 +1,11 @@
> +Solid-Run HummingBoard-i2eX minimal defconfig, without WiFi or OpenGL firmware
> +is provided in configs/hummingboard_i2eX_defconfig
> +
> +Bash script for creating bootable microSD cards is in
> +board/solid-run/make_sd_card.sh
> +
> +Example usage:
> +
> +sudo make_sd_card.sh sde output HummingBoard-i2eX 256
A short description of script parameters would be nice.
> +
> +Maintainer: yba at tkos.co.il
> diff --git a/board/solid-run/make_sd_card.sh b/board/solid-run/make_sd_card.sh
> new file mode 100755
> index 0000000..8586ff6
> --- /dev/null
> +++ b/board/solid-run/make_sd_card.sh
> @@ -0,0 +1,278 @@
> +#!/bin/bash -eu
[...]
> +# rootfs partition starting at 1MB with size of ROOTFS_PARTITION_SIZE
> +ROOTFS_PARTITION="n\np\n1\n2048\n+16M\nn\np\n2\n\n+${ROOTFS_PARTITION_SIZE}M\na\n\nw\n"
> +
> +# Not so cool - I will have to maintain this script every time Rabeeh pushes
> +# new code
> +if [ -z "${KERNEL_DIR+x}" ]
> +then
> + KERNEL_DIR=${BUILDROOT_OUTPUT_DIR}/build/linux-ea83bda1b403d745c67fbf6ea307d05ca138577f
> +fi
> +
> +if [ -z "${UBOOT_DIR+x}" ]
> +then
> + UBOOT_DIR=${BUILDROOT_OUTPUT_DIR}/build/uboot-e817fa3165a607b581433a6abfe37e095a5d1dc9
> +fi
These variables are set here but are only used below for kernel and U-Boot
directory existence check.
> +
> +# Handle Ubuntu fdisk silliness
> +if echo $(uname -a) | grep -q Ubuntu
> +then
> + FDISK="fdisk -c -u"
> +else
> + FDISK="fdisk -u=sectors"
> +fi
AFAIK fdisk behaviour changed between versions. This is no Ubuntu specific.
Anyway, sfdisk is better suited for scripted use.
[...]
> +BINS="fdisk mkfs.ext4 mount umount dd mktemp partprobe"
> +for BIN in ${BINS}
> +do
> + if ! which ${BIN} >/dev/null
> + then
> + echo "${ME} ERROR: Required executable ${BIN} is not in PATH"
> + ERROR=$((${ERROR}+1))
> + fi
> +done
Buildroot can build host versions of util-linux (fdisk, mount, umount),
e2fsprogs (mkfs.ext4), and parted (partprobe). In that case you should find
these utilities under ${BUILDROOT_OUTPUT_DIR}/host/usr/sbin/.
[...]
> +if ! mount ${PART2} ${MOUNT_POINT}
> +then
> + echo "${ME} ERROR: Cannot mount ${PART2} on ${MOUNT_POINT}"
> + exit 1
> +fi
> +
> +tar xvf ${BUILDROOT_OUTPUT_DIR}/images/rootfs.tar -C ${MOUNT_POINT}
> +umount ${MOUNT_POINT}
> +
> +if ! mkfs.ext4 -F -O ^has_journal -E stride=2,stripe-width=1024 -b 4096 ${PART1}
> +then
> + echo "${ME} ERROR: Failed to create ext4 filesystem on ${PART1}"
> + exit 1
> +fi
Buildroot can create ready made ext{2,3,4} images itself. See 'Filesystem
images -> ext2/3/4 root filesystem' in menuconfig.
> +
> +if ! mount ${PART1} ${MOUNT_POINT}
> +then
> + echo "${ME} ERROR: Cannot mount ${PART1} on ${MOUNT_POINT}"
> + exit 1
> +fi
> +
> +cp ${BUILDROOT_OUTPUT_DIR}/images/zImage ${MOUNT_POINT}
Buildroot can do that for you as well. See 'Kernel -> Install kernel image to
/boot in target' in menuconfig.
> +
> +case ${BOARD_MODEL} in
> + HummingBoard-i2eX)
> + cp ${BUILDROOT_OUTPUT_DIR}/images/imx6q-hummingboard.dtb ${MOUNT_POINT}
Ditto.
> + ;;
> + *)
> + if [ -f ${BUILDROOT_OUTPUT_DIR}/images/${BOARD_MODEL} ]
> + then
> + cp ${BUILDROOT_OUTPUT_DIR}/images/${BOARD_MODEL} ${MOUNT_POINT}
> + else
> + echo "${ME} WARNING: No dtb file found"
> + fi
> + ;;
> +esac
> +
> +umount ${MOUNT_POINT}
baruch
--
http://baruch.siach.name/blog/ ~. .~ Tk Open Systems
=}------------------------------------------------ooO--U--Ooo------------{=
- baruch at tkos.co.il - tel: +972.2.679.5364, http://www.tkos.co.il -
^ permalink raw reply [flat|nested] 9+ messages in thread* [Buildroot] [PATCH v2 1/1] Solid-Run HummingBoard i2eX defconfig and bootable microSD Bash script
2015-05-31 7:08 ` Baruch Siach
@ 2015-05-31 7:40 ` Jonathan Ben Avraham
2015-05-31 9:02 ` Baruch Siach
0 siblings, 1 reply; 9+ messages in thread
From: Jonathan Ben Avraham @ 2015-05-31 7:40 UTC (permalink / raw)
To: buildroot
Hi Baruch,
See inline comments. I think that there is a misunderstanding regarding
the cp of the images to the mounted microSD partitions, see below.
On Sun, 31 May 2015, Baruch Siach wrote:
> Date: Sun, 31 May 2015 10:08:42 +0300
> From: Baruch Siach <baruch@tkos.co.il>
> To: Jonathan Ben-Avraham <yba@tkos.co.il>
> Cc: buildroot at buildroot.org
> Subject: Re: [Buildroot] [PATCH v2 1/1] Solid-Run HummingBoard i2eX defconfig
> and bootable microSD Bash script
>
> Hi Yonatan,
>
> On Sun, May 31, 2015 at 01:31:24AM +0300, Jonathan Ben-Avraham wrote:
>> Solid-Run HummingBoard i2eX defconfig and bootable microSD Bash script
>>
>> Signed-off-by: Jonathan Ben-Avraham <yba@tkos.co.il>
>> ---
>> board/solid-run/hummingboard-i2eX/readme.txt | 11 ++
>> board/solid-run/make_sd_card.sh | 278 +++++++++++++++++++++++++++
>> configs/hummingboard_i2eX_defconfig | 25 +++
>> 3 files changed, 314 insertions(+)
>> create mode 100644 board/solid-run/hummingboard-i2eX/readme.txt
>> create mode 100755 board/solid-run/make_sd_card.sh
>> create mode 100644 configs/hummingboard_i2eX_defconfig
>>
>> diff --git a/board/solid-run/hummingboard-i2eX/readme.txt b/board/solid-run/hummingboard-i2eX/readme.txt
>> new file mode 100644
>> index 0000000..4e25179
>> --- /dev/null
>> +++ b/board/solid-run/hummingboard-i2eX/readme.txt
>> @@ -0,0 +1,11 @@
>> +Solid-Run HummingBoard-i2eX minimal defconfig, without WiFi or OpenGL firmware
>> +is provided in configs/hummingboard_i2eX_defconfig
>> +
>> +Bash script for creating bootable microSD cards is in
>> +board/solid-run/make_sd_card.sh
>> +
>> +Example usage:
>> +
>> +sudo make_sd_card.sh sde output HummingBoard-i2eX 256
>
> A short description of script parameters would be nice.
I'll copy it from the USAGE in the make_sd_card.sh.
>> +
>> +Maintainer: yba at tkos.co.il
>> diff --git a/board/solid-run/make_sd_card.sh b/board/solid-run/make_sd_card.sh
>> new file mode 100755
>> index 0000000..8586ff6
>> --- /dev/null
>> +++ b/board/solid-run/make_sd_card.sh
>> @@ -0,0 +1,278 @@
>> +#!/bin/bash -eu
>
> [...]
>
>> +# rootfs partition starting at 1MB with size of ROOTFS_PARTITION_SIZE
>> +ROOTFS_PARTITION="n\np\n1\n2048\n+16M\nn\np\n2\n\n+${ROOTFS_PARTITION_SIZE}M\na\n\nw\n"
>> +
>> +# Not so cool - I will have to maintain this script every time Rabeeh pushes
>> +# new code
>> +if [ -z "${KERNEL_DIR+x}" ]
>> +then
>> + KERNEL_DIR=${BUILDROOT_OUTPUT_DIR}/build/linux-ea83bda1b403d745c67fbf6ea307d05ca138577f
>> +fi
>> +
>> +if [ -z "${UBOOT_DIR+x}" ]
>> +then
>> + UBOOT_DIR=${BUILDROOT_OUTPUT_DIR}/build/uboot-e817fa3165a607b581433a6abfe37e095a5d1dc9
>> +fi
>
> These variables are set here but are only used below for kernel and U-Boot
> directory existence check.
Yes, v1 of this script used them. In this version they could be removed.
>> +
>> +# Handle Ubuntu fdisk silliness
>> +if echo $(uname -a) | grep -q Ubuntu
>> +then
>> + FDISK="fdisk -c -u"
>> +else
>> + FDISK="fdisk -u=sectors"
>> +fi
>
> AFAIK fdisk behaviour changed between versions. This is no Ubuntu specific.
> Anyway, sfdisk is better suited for scripted use.
>
> [...]
>
>> +BINS="fdisk mkfs.ext4 mount umount dd mktemp partprobe"
>> +for BIN in ${BINS}
>> +do
>> + if ! which ${BIN} >/dev/null
>> + then
>> + echo "${ME} ERROR: Required executable ${BIN} is not in PATH"
>> + ERROR=$((${ERROR}+1))
>> + fi
>> +done
>
> Buildroot can build host versions of util-linux (fdisk, mount, umount),
> e2fsprogs (mkfs.ext4), and parted (partprobe). In that case you should find
> these utilities under ${BUILDROOT_OUTPUT_DIR}/host/usr/sbin/.
For fdisk it might be better to use the Buildroot host utility rather than
deal with the differences in fdisk between the common Linux distros.
But for the other utilities that are almost always present, is it work
adding them to the defconfig and increasing the build time and volume?
> [...]
>
>> +if ! mount ${PART2} ${MOUNT_POINT}
>> +then
>> + echo "${ME} ERROR: Cannot mount ${PART2} on ${MOUNT_POINT}"
>> + exit 1
>> +fi
>> +
>> +tar xvf ${BUILDROOT_OUTPUT_DIR}/images/rootfs.tar -C ${MOUNT_POINT}
>> +umount ${MOUNT_POINT}
>> +
>> +if ! mkfs.ext4 -F -O ^has_journal -E stride=2,stripe-width=1024 -b 4096 ${PART1}
>> +then
>> + echo "${ME} ERROR: Failed to create ext4 filesystem on ${PART1}"
>> + exit 1
>> +fi
>
> Buildroot can create ready made ext{2,3,4} images itself. See 'Filesystem
> images -> ext2/3/4 root filesystem' in menuconfig.
This script allows you to defer the decision on the filesystem type to a
later stage by just using rootfs.tar. In terms of project management, I
think that this is the best strategy. That is, to make a clean separation
between build issues and installation issues, not to confound them.
>> +
>> +if ! mount ${PART1} ${MOUNT_POINT}
>> +then
>> + echo "${ME} ERROR: Cannot mount ${PART1} on ${MOUNT_POINT}"
>> + exit 1
>> +fi
>> +
>> +cp ${BUILDROOT_OUTPUT_DIR}/images/zImage ${MOUNT_POINT}
>
> Buildroot can do that for you as well. See 'Kernel -> Install kernel image to
> /boot in target' in menuconfig.
Buildroot can format and identify the correct microSD device and mount
the correct partition and then copy the image from output/images to the
partition? I don't think so. That is what this script and
board/freescale/create-boot-sd.sh are about.
In any event, the question is not what Buildroot can do, it is what
Buildroot *should* do. You want a clean separaration of the build
operation and the media install operation.
>> +
>> +case ${BOARD_MODEL} in
>> + HummingBoard-i2eX)
>> + cp ${BUILDROOT_OUTPUT_DIR}/images/imx6q-hummingboard.dtb ${MOUNT_POINT}
>
> Ditto.
Please re-check the last three comments that you made. I think they might
be mistaken.
- yba
>
>> + ;;
>> + *)
>> + if [ -f ${BUILDROOT_OUTPUT_DIR}/images/${BOARD_MODEL} ]
>> + then
>> + cp ${BUILDROOT_OUTPUT_DIR}/images/${BOARD_MODEL} ${MOUNT_POINT}
>> + else
>> + echo "${ME} WARNING: No dtb file found"
>> + fi
>> + ;;
>> +esac
>> +
>> +umount ${MOUNT_POINT}
>
> baruch
>
>
--
9590 8E58 D30D 1660 C349 673D B205 4FC4 B8F5 B7F9 ~. .~ Tk Open Systems
=}-------- Jonathan Ben-Avraham ("yba") ----------ooO--U--Ooo------------{=
mailto:yba at tkos.co.il tel:+972.52.486.3386 http://tkos.co.il skype:benavrhm
^ permalink raw reply [flat|nested] 9+ messages in thread* [Buildroot] [PATCH v2 1/1] Solid-Run HummingBoard i2eX defconfig and bootable microSD Bash script
2015-05-31 7:40 ` Jonathan Ben Avraham
@ 2015-05-31 9:02 ` Baruch Siach
2015-05-31 9:23 ` Jonathan Ben Avraham
0 siblings, 1 reply; 9+ messages in thread
From: Baruch Siach @ 2015-05-31 9:02 UTC (permalink / raw)
To: buildroot
Hi Yonatan,
On Sun, May 31, 2015 at 10:40:20AM +0300, Jonathan Ben Avraham wrote:
> On Sun, 31 May 2015, Baruch Siach wrote:
> >On Sun, May 31, 2015 at 01:31:24AM +0300, Jonathan Ben-Avraham wrote:
> >>+BINS="fdisk mkfs.ext4 mount umount dd mktemp partprobe"
> >>+for BIN in ${BINS}
> >>+do
> >>+ if ! which ${BIN} >/dev/null
> >>+ then
> >>+ echo "${ME} ERROR: Required executable ${BIN} is not in PATH"
> >>+ ERROR=$((${ERROR}+1))
> >>+ fi
> >>+done
> >
> >Buildroot can build host versions of util-linux (fdisk, mount, umount),
> >e2fsprogs (mkfs.ext4), and parted (partprobe). In that case you should find
> >these utilities under ${BUILDROOT_OUTPUT_DIR}/host/usr/sbin/.
>
> For fdisk it might be better to use the Buildroot host utility rather than
> deal with the differences in fdisk between the common Linux distros.
Or even better, use sfdisk. sfdisk script should be more resistant to breakage
on future util-linux versions.
> But for the other utilities that are almost always present, is it work
> adding them to the defconfig and increasing the build time and volume?
I don't think they should be added to defconfig. But if the user selected
these host packages this script should use them.
> >Buildroot can create ready made ext{2,3,4} images itself. See 'Filesystem
> >images -> ext2/3/4 root filesystem' in menuconfig.
>
> This script allows you to defer the decision on the filesystem type to a
> later stage by just using rootfs.tar. In terms of project management, I
> think that this is the best strategy. That is, to make a clean separation
> between build issues and installation issues, not to confound them.
Filesystem generation makes this script unnecessarily complex, IMO. Going for
a single partition solution (see below) would make this script (and
board/freescale/create-boot-sd.sh) simpler, and easier to maintain.
> >>+if ! mount ${PART1} ${MOUNT_POINT}
> >>+then
> >>+ echo "${ME} ERROR: Cannot mount ${PART1} on ${MOUNT_POINT}"
> >>+ exit 1
> >>+fi
> >>+
> >>+cp ${BUILDROOT_OUTPUT_DIR}/images/zImage ${MOUNT_POINT}
> >
> >Buildroot can do that for you as well. See 'Kernel -> Install kernel image to
> >/boot in target' in menuconfig.
>
> Buildroot can format and identify the correct microSD device and mount the
> correct partition and then copy the image from output/images to the
> partition? I don't think so. That is what this script and
> board/freescale/create-boot-sd.sh are about.
Right. However, using the boot.scr boot script support of U-Boot (enabled in
both SolidRun and Freescale U-Boot) would allow Buildroot to generate a single
boot/root partition. This script, that is running as root, should only to the
bare minimum, i.e. SD card partitioning.
> In any event, the question is not what Buildroot can do, it is what
> Buildroot *should* do. You want a clean separaration of the build operation
> and the media install operation.
baruch
--
http://baruch.siach.name/blog/ ~. .~ Tk Open Systems
=}------------------------------------------------ooO--U--Ooo------------{=
- baruch at tkos.co.il - tel: +972.2.679.5364, http://www.tkos.co.il -
^ permalink raw reply [flat|nested] 9+ messages in thread* [Buildroot] [PATCH v2 1/1] Solid-Run HummingBoard i2eX defconfig and bootable microSD Bash script
2015-05-31 9:02 ` Baruch Siach
@ 2015-05-31 9:23 ` Jonathan Ben Avraham
0 siblings, 0 replies; 9+ messages in thread
From: Jonathan Ben Avraham @ 2015-05-31 9:23 UTC (permalink / raw)
To: buildroot
Hi Baruch,
See inlines.
On Sun, 31 May 2015, Baruch Siach wrote:
> Date: Sun, 31 May 2015 12:02:26 +0300
> From: Baruch Siach <baruch@tkos.co.il>
> To: Jonathan Ben Avraham <yba@tkos.co.il>
> Cc: buildroot at buildroot.org, Rabeeh Khoury <rabeeh@solid-run.com>
> Subject: Re: [Buildroot] [PATCH v2 1/1] Solid-Run HummingBoard i2eX defconfig
> and bootable microSD Bash script
>
> Hi Yonatan,
>
> On Sun, May 31, 2015 at 10:40:20AM +0300, Jonathan Ben Avraham wrote:
>> On Sun, 31 May 2015, Baruch Siach wrote:
>>> On Sun, May 31, 2015 at 01:31:24AM +0300, Jonathan Ben-Avraham wrote:
>>>> +BINS="fdisk mkfs.ext4 mount umount dd mktemp partprobe"
>>>> +for BIN in ${BINS}
>>>> +do
>>>> + if ! which ${BIN} >/dev/null
>>>> + then
>>>> + echo "${ME} ERROR: Required executable ${BIN} is not in PATH"
>>>> + ERROR=$((${ERROR}+1))
>>>> + fi
>>>> +done
>>>
>>> Buildroot can build host versions of util-linux (fdisk, mount, umount),
>>> e2fsprogs (mkfs.ext4), and parted (partprobe). In that case you should find
>>> these utilities under ${BUILDROOT_OUTPUT_DIR}/host/usr/sbin/.
>>
>> For fdisk it might be better to use the Buildroot host utility rather than
>> deal with the differences in fdisk between the common Linux distros.
>
> Or even better, use sfdisk. sfdisk script should be more resistant to breakage
> on future util-linux versions.
>
>> But for the other utilities that are almost always present, is it work
>> adding them to the defconfig and increasing the build time and volume?
>
> I don't think they should be added to defconfig. But if the user selected
> these host packages this script should use them.
ok, will add check for utils in output/host/sbin
>>> Buildroot can create ready made ext{2,3,4} images itself. See 'Filesystem
>>> images -> ext2/3/4 root filesystem' in menuconfig.
>>
>> This script allows you to defer the decision on the filesystem type to a
>> later stage by just using rootfs.tar. In terms of project management, I
>> think that this is the best strategy. That is, to make a clean separation
>> between build issues and installation issues, not to confound them.
>
> Filesystem generation makes this script unnecessarily complex, IMO. Going for
> a single partition solution (see below) would make this script (and
> board/freescale/create-boot-sd.sh) simpler, and easier to maintain.
I beg to differ. That would require changes to the U-Boot environment
or writing a U-Boot script that creates it's own risks and adds back the
complexity. I think it is better to stay with the kernel command line
parameters in the particular U-Boot repo that Solid-Run is using and not
add a U-Boot env script.
I think that fiddling with board/freescale/create-boot-sd.sh at this time
is a recipe for trouble. Better to add a new script and if it works out
deprecate the board/freescale/create-boot-sd.sh.
>>>> +if ! mount ${PART1} ${MOUNT_POINT}
>>>> +then
>>>> + echo "${ME} ERROR: Cannot mount ${PART1} on ${MOUNT_POINT}"
>>>> + exit 1
>>>> +fi
>>>> +
>>>> +cp ${BUILDROOT_OUTPUT_DIR}/images/zImage ${MOUNT_POINT}
>>>
>>> Buildroot can do that for you as well. See 'Kernel -> Install kernel image to
>>> /boot in target' in menuconfig.
>>
>> Buildroot can format and identify the correct microSD device and mount the
>> correct partition and then copy the image from output/images to the
>> partition? I don't think so. That is what this script and
>> board/freescale/create-boot-sd.sh are about.
>
> Right. However, using the boot.scr boot script support of U-Boot (enabled in
> both SolidRun and Freescale U-Boot) would allow Buildroot to generate a single
> boot/root partition. This script, that is running as root, should only to the
> bare minimum, i.e. SD card partitioning.
See above comment regarding the advisability of adding a Buildroot script
or special env.
I would be happy to write a *separate*, *additional* script that adds
this functionality but I think that the current version is a more
conservative, advisable approach. I think that a lot of things could break
if we suddenly changed the microSD partitioning on people without
allowing them to keep the old scheme. This would for example break the mfg
scripts at the microwave appliance developer with whom we worked last
year.
- yba
>> In any event, the question is not what Buildroot can do, it is what
>> Buildroot *should* do. You want a clean separaration of the build operation
>> and the media install operation.
>
> baruch
>
>
--
9590 8E58 D30D 1660 C349 673D B205 4FC4 B8F5 B7F9 ~. .~ Tk Open Systems
=}-------- Jonathan Ben-Avraham ("yba") ----------ooO--U--Ooo------------{=
mailto:yba at tkos.co.il tel:+972.52.486.3386 http://tkos.co.il skype:benavrhm
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2016-01-13 5:58 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-06-01 21:56 [Buildroot] [PATCH v2 1/1] Solid-Run HummingBoard i2eX defconfig and bootable microSD Bash script Jonathan Ben-Avraham
2015-06-01 22:00 ` Jonathan Ben Avraham
2016-01-12 21:48 ` Yann E. MORIN
2016-01-13 5:58 ` Jonathan Ben Avraham
-- strict thread matches above, loose matches on Subject: below --
2015-05-30 22:31 Jonathan Ben-Avraham
2015-05-31 7:08 ` Baruch Siach
2015-05-31 7:40 ` Jonathan Ben Avraham
2015-05-31 9:02 ` Baruch Siach
2015-05-31 9:23 ` Jonathan Ben Avraham
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox