From patchwork Wed Oct 11 12:19:32 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexandre Gambier X-Patchwork-Id: 824399 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=busybox.net (client-ip=140.211.166.137; helo=fraxinus.osuosl.org; envelope-from=buildroot-bounces@busybox.net; receiver=) Received: from fraxinus.osuosl.org (smtp4.osuosl.org [140.211.166.137]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3yBtmt4St1z9s7p for ; Wed, 11 Oct 2017 23:38:06 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by fraxinus.osuosl.org (Postfix) with ESMTP id 3246488057; Wed, 11 Oct 2017 12:38:04 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from fraxinus.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id Bys0vGGzrEt1; Wed, 11 Oct 2017 12:38:03 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by fraxinus.osuosl.org (Postfix) with ESMTP id 780FD8805D; Wed, 11 Oct 2017 12:38:03 +0000 (UTC) X-Original-To: buildroot@lists.busybox.net Delivered-To: buildroot@osuosl.org Received: from fraxinus.osuosl.org (smtp4.osuosl.org [140.211.166.137]) by ash.osuosl.org (Postfix) with ESMTP id B411E1C26AC for ; Wed, 11 Oct 2017 12:38:00 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by fraxinus.osuosl.org (Postfix) with ESMTP id AAA718805D for ; Wed, 11 Oct 2017 12:38:00 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from fraxinus.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 0o9GQE-bZ3gu for ; Wed, 11 Oct 2017 12:37:59 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from 9.mo178.mail-out.ovh.net (9.mo178.mail-out.ovh.net [46.105.75.45]) by fraxinus.osuosl.org (Postfix) with ESMTPS id C79B488057 for ; Wed, 11 Oct 2017 12:37:59 +0000 (UTC) Received: from player793.ha.ovh.net (b9.ovh.net [213.186.33.59]) by mo178.mail-out.ovh.net (Postfix) with ESMTP id D541456E70 for ; Wed, 11 Oct 2017 14:20:15 +0200 (CEST) Received: from localhost.localdomain (204.114.71.37.rev.sfr.net [37.71.114.204]) (Authenticated sender: system@annecyelectronique.com) by player793.ha.ovh.net (Postfix) with ESMTPSA id AB70140099; Wed, 11 Oct 2017 14:20:13 +0200 (CEST) From: Alexandre Gambier To: buildroot@buildroot.org Date: Wed, 11 Oct 2017 14:19:32 +0200 Message-Id: <1507724378-23461-3-git-send-email-agambier.dev@gmail.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1507724378-23461-1-git-send-email-agambier.dev@gmail.com> References: <1507724378-23461-1-git-send-email-agambier.dev@gmail.com> X-Ovh-Tracer-Id: 900438451553565854 X-VR-SPAMSTATE: OK X-VR-SPAMSCORE: 0 X-VR-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrgedttddrtddvgdehfecutefuodetggdotefrodftvfcurfhrohhfihhlvgemucfqggfjpdevjffgvefmvefgnecuuegrihhlohhuthemuceftddtnecu Cc: Alexandre Gambier Subject: [Buildroot] [PATCH 3/9] iMX6S-PICO: add post image scripts X-BeenThere: buildroot@busybox.net X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: Discussion and development of buildroot List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: buildroot-bounces@busybox.net Sender: "buildroot" Signed-off-by: Alexandre Gambier --- board/technexion/imx6spico/genimage.cfg.template | 40 ++++++++++++++++++ board/technexion/imx6spico/post-image.sh | 54 ++++++++++++++++++++++++ 2 files changed, 94 insertions(+) create mode 100644 board/technexion/imx6spico/genimage.cfg.template create mode 100755 board/technexion/imx6spico/post-image.sh diff --git a/board/technexion/imx6spico/genimage.cfg.template b/board/technexion/imx6spico/genimage.cfg.template new file mode 100644 index 0000000..45450a9 --- /dev/null +++ b/board/technexion/imx6spico/genimage.cfg.template @@ -0,0 +1,40 @@ +# Minimal SD card image for the Freescale boards Template +# +# We mimic the .sdcard Freescale's image format: +# * the SD card must have 1 kB free space at the beginning, +# * U-Boot is dumped as is, +# * a FAT partition at offset 8 MB is containing zImage/uImage and DTB files +# * a single root filesystem partition is required (ext2, ext3 or ext4) +# + +image boot.vfat { + vfat { + files = { + %FILES% + } + } + size = 16M +} + +image sdcard.img { + hdimage { + } + + partition u-boot { + in-partition-table = "no" + image = "SPL" + offset = 1024 + } + + partition boot { + partition-type = 0xC + bootable = "true" + image = "boot.vfat" + offset = 8M + } + + partition rootfs { + partition-type = 0x83 + image = "rootfs.ext2" + } +} diff --git a/board/technexion/imx6spico/post-image.sh b/board/technexion/imx6spico/post-image.sh new file mode 100755 index 0000000..52b423a --- /dev/null +++ b/board/technexion/imx6spico/post-image.sh @@ -0,0 +1,54 @@ +#!/usr/bin/env bash + +# +# dtb_list extracts the list of DTB files from BR2_LINUX_KERNEL_INTREE_DTS_NAME +# in ${BR_CONFIG}, then prints the corresponding list of file names for the +# genimage configuration file +# +dtb_list() +{ + local DTB_LIST="imx6dl-pico_dwarf" + + for dt in $DTB_LIST; do + echo -n "\"$dt.dtb\", " + done +} + +# +# linux_image extracts the Linux image format from BR2_LINUX_KERNEL_UIMAGE in +# ${BR_CONFIG}, then prints the corresponding file name for the genimage +# configuration file +# +linux_image() +{ + if grep -Eq "^BR2_LINUX_KERNEL_UIMAGE=y$" ${BR2_CONFIG}; then + echo "\"uImage\"" + else + echo "\"zImage\"" + fi +} + +main() +{ + local FILES="$(dtb_list) $(linux_image), \"u-boot.img\"" + local GENIMAGE_CFG="$(mktemp --suffix genimage.cfg)" + local GENIMAGE_TMP="${BUILD_DIR}/genimage.tmp" + + sed -e "s/%FILES%/${FILES}/" \ + board/technexion/imx6spico/genimage.cfg.template > ${GENIMAGE_CFG} + + rm -rf "${GENIMAGE_TMP}" + + genimage \ + --rootpath "${TARGET_DIR}" \ + --tmppath "${GENIMAGE_TMP}" \ + --inputpath "${BINARIES_DIR}" \ + --outputpath "${BINARIES_DIR}" \ + --config "${GENIMAGE_CFG}" + + rm -f ${GENIMAGE_CFG} + + exit $? +} + +main $@