Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Baruch Siach <baruch@tkos.co.il>
To: buildroot@busybox.net
Subject: [Buildroot] [PATCH v2 1/1] Solid-Run HummingBoard i2eX defconfig and bootable microSD Bash script
Date: Sun, 31 May 2015 10:08:42 +0300	[thread overview]
Message-ID: <20150531070842.GD2282@tarshish> (raw)
In-Reply-To: <1433025084-25182-1-git-send-email-yba@tkos.co.il>

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 -

  reply	other threads:[~2015-05-31  7:08 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-05-30 22:31 [Buildroot] [PATCH v2 1/1] Solid-Run HummingBoard i2eX defconfig and bootable microSD Bash script Jonathan Ben-Avraham
2015-05-31  7:08 ` Baruch Siach [this message]
2015-05-31  7:40   ` Jonathan Ben Avraham
2015-05-31  9:02     ` Baruch Siach
2015-05-31  9:23       ` Jonathan Ben Avraham
  -- strict thread matches above, loose matches on Subject: below --
2015-06-01 21:56 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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20150531070842.GD2282@tarshish \
    --to=baruch@tkos.co.il \
    --cc=buildroot@busybox.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox