diff mbox

[1/1] olimex_imx233_olinuxino_defconfig: genimage support

Message ID 1457645651-2472-1-git-send-email-phil@zankapfel.net
State Accepted
Commit 0b7b84310c3781c346eea4c114c8cb4e97bbd8ea
Headers show

Commit Message

Phil Eichinger March 10, 2016, 9:34 p.m. UTC
* add a post-image.sh script
* update defconfig for genimage
* update readme.txt

Signed-off-by: Phil Eichinger <phil@zankapfel.net>
---
 .../imx233_olinuxino/genimage-imx233_olinuxino.cfg | 28 ++++++++++++++++++++++
 board/olimex/imx233_olinuxino/post-image.sh        | 20 ++++++++++++++++
 board/olimex/imx233_olinuxino/readme.txt           | 22 +++++++++++++++++
 configs/olimex_imx233_olinuxino_defconfig          |  6 +++++
 4 files changed, 76 insertions(+)
 create mode 100644 board/olimex/imx233_olinuxino/genimage-imx233_olinuxino.cfg
 create mode 100755 board/olimex/imx233_olinuxino/post-image.sh

Comments

Peter Korsgaard March 11, 2016, 12:14 p.m. UTC | #1
>>>>> "Phil" == Phil Eichinger <phil.eichinger@gmail.com> writes:

 > * add a post-image.sh script
 > * update defconfig for genimage
 > * update readme.txt

 > Signed-off-by: Phil Eichinger <phil@zankapfel.net>

Thanks!

 > +genimage                           \
 > +	--rootpath "${TARGET_DIR}"     \
 > +	--tmppath "${GENIMAGE_TMP}"    \
 > +	--inputpath "${BINARIES_DIR}"  \
 > +	--outputpath "${BINARIES_DIR}" \
 > +	--config "${GENIMAGE_CFG}"
 > +
 > +exit $?

I know other post-image scripts do this as well, but there's really no
need for this 'exit $?'.

 > +=== Manual creation of SD card image =========================================
 > +
 >  You'll need a spare MicroSD card with Freescale's special partition layout.
 >  This is basically three partitions:

I'm not sure there's any reason to still document the manual approach,
but ok - I've left it for now.

 > diff --git a/configs/olimex_imx233_olinuxino_defconfig b/configs/olimex_imx233_olinuxino_defconfig
 > index 9951284..87684fc 100644
 > --- a/configs/olimex_imx233_olinuxino_defconfig
 > +++ b/configs/olimex_imx233_olinuxino_defconfig
 > @@ -39,3 +39,9 @@ BR2_TARGET_UBOOT_CUSTOM_VERSION=y
 >  BR2_TARGET_UBOOT_CUSTOM_VERSION_VALUE="2016.01"
 >  BR2_TARGET_UBOOT_BOARD_DEFCONFIG="mx23_olinuxino"
 >  BR2_TARGET_UBOOT_FORMAT_SD=y
 > + 
 > +# To generate SD Image
 > +BR2_PACKAGE_HOST_GENIMAGE=y
 > +BR2_PACKAGE_HOST_MTOOLS=y

The vfat handling also uses mkdosfs, so we need to add
BR2_PACKAGE_HOST_DOSFSTOOLS=y as well.

I noticed that we are missing it from some of the other defconfigs as
well, so I'll fix that.

Committed with that fixed, thanks.
Arnout Vandecappelle March 12, 2016, 9:31 a.m. UTC | #2
On 03/11/16 13:14, Peter Korsgaard wrote:
>>>>>> "Phil" == Phil Eichinger <phil.eichinger@gmail.com> writes:
[snip]
>   > +# To generate SD Image
>   > +BR2_PACKAGE_HOST_GENIMAGE=y
>   > +BR2_PACKAGE_HOST_MTOOLS=y
>
> The vfat handling also uses mkdosfs, so we need to add
> BR2_PACKAGE_HOST_DOSFSTOOLS=y as well.
>
> I noticed that we are missing it from some of the other defconfigs as
> well, so I'll fix that.

  So, why doesn't Travis detect that?

  Regards,
  Arnout
Peter Korsgaard March 12, 2016, 9:52 a.m. UTC | #3
>>>>> "Arnout" == Arnout Vandecappelle <arnout@mind.be> writes:

 > On 03/11/16 13:14, Peter Korsgaard wrote:
 >>>>>>> "Phil" == Phil Eichinger <phil.eichinger@gmail.com> writes:
 > [snip]
 >> > +# To generate SD Image
 >> > +BR2_PACKAGE_HOST_GENIMAGE=y
 >> > +BR2_PACKAGE_HOST_MTOOLS=y
 >> 
 >> The vfat handling also uses mkdosfs, so we need to add
 >> BR2_PACKAGE_HOST_DOSFSTOOLS=y as well.
 >> 
 >> I noticed that we are missing it from some of the other defconfigs as
 >> well, so I'll fix that.

 >  So, why doesn't Travis detect that?

Presumably because the Ubuntu container has mkdosfs installed?
Phil Eichinger March 12, 2016, 1:52 p.m. UTC | #4
On 12 March 2016 at 10:52, Peter Korsgaard <peter@korsgaard.com> wrote:
>>>>>> "Arnout" == Arnout Vandecappelle <arnout@mind.be> writes:
>
>  > On 03/11/16 13:14, Peter Korsgaard wrote:
>  >>>>>>> "Phil" == Phil Eichinger <phil.eichinger@gmail.com> writes:
>  > [snip]
>  >> > +# To generate SD Image
>  >> > +BR2_PACKAGE_HOST_GENIMAGE=y
>  >> > +BR2_PACKAGE_HOST_MTOOLS=y
>  >>
>  >> The vfat handling also uses mkdosfs, so we need to add
>  >> BR2_PACKAGE_HOST_DOSFSTOOLS=y as well.
>  >>
>  >> I noticed that we are missing it from some of the other defconfigs as
>  >> well, so I'll fix that.
>
>  >  So, why doesn't Travis detect that?
>
> Presumably because the Ubuntu container has mkdosfs installed?

I looked into it, on my system mkdosfs was installed, that's why I was
able to generate the image.
Is a fallback to system mkdosfs considered a feature or should
genimage only use Buildroot's mkdosfs?

Cheers, Phil
Peter Korsgaard March 12, 2016, 2:55 p.m. UTC | #5
>>>>> "Phil" == Phil Eichinger <phil.eichinger@gmail.com> writes:

Hi,

 >> >  So, why doesn't Travis detect that?
 >> 
 >> Presumably because the Ubuntu container has mkdosfs installed?

 > I looked into it, on my system mkdosfs was installed, that's why I was
 > able to generate the image.
 > Is a fallback to system mkdosfs considered a feature or should
 > genimage only use Buildroot's mkdosfs?

We want the builds to be reproducible on other machines, so we should be
able to build with only the programs available we check for in
dependencies.sh
diff mbox

Patch

diff --git a/board/olimex/imx233_olinuxino/genimage-imx233_olinuxino.cfg b/board/olimex/imx233_olinuxino/genimage-imx233_olinuxino.cfg
new file mode 100644
index 0000000..78979dc
--- /dev/null
+++ b/board/olimex/imx233_olinuxino/genimage-imx233_olinuxino.cfg
@@ -0,0 +1,28 @@ 
+image kernel.vfat {
+  vfat {
+    files = {
+      "uImage"
+    }
+  }
+  size = 5M
+}
+
+image sdcard.img {
+  hdimage {
+  }
+  partition boot {
+    	partition-type = 0x53
+    	image = "u-boot.sd"
+	size = 16M
+  }
+
+  partition kernel {
+    partition-type = 0xC
+    image = "kernel.vfat"
+  }
+
+  partition rootfs {
+    partition-type = 0x83
+    image = "rootfs.ext2"
+  }
+}
diff --git a/board/olimex/imx233_olinuxino/post-image.sh b/board/olimex/imx233_olinuxino/post-image.sh
new file mode 100755
index 0000000..703cbe7
--- /dev/null
+++ b/board/olimex/imx233_olinuxino/post-image.sh
@@ -0,0 +1,20 @@ 
+#!/bin/sh
+
+BOARD_DIR="$(dirname $0)"
+BOARD_NAME="$(basename ${BOARD_DIR})"
+GENIMAGE_CFG="${BOARD_DIR}/genimage-${BOARD_NAME}.cfg"
+GENIMAGE_TMP="${BUILD_DIR}/genimage.tmp"
+
+# Create symlink to "rename" kernel image
+ln -sf uImage.imx23-olinuxino ${BINARIES_DIR}/uImage
+
+rm -rf "${GENIMAGE_TMP}"
+
+genimage                           \
+	--rootpath "${TARGET_DIR}"     \
+	--tmppath "${GENIMAGE_TMP}"    \
+	--inputpath "${BINARIES_DIR}"  \
+	--outputpath "${BINARIES_DIR}" \
+	--config "${GENIMAGE_CFG}"
+
+exit $?
diff --git a/board/olimex/imx233_olinuxino/readme.txt b/board/olimex/imx233_olinuxino/readme.txt
index a545f7b..4b24ac2 100644
--- a/board/olimex/imx233_olinuxino/readme.txt
+++ b/board/olimex/imx233_olinuxino/readme.txt
@@ -5,6 +5,28 @@  one or more of: hostapd, iw, wireless_tools and/or wpa_supplicant.
 
 It also pulls up the console on the serial port, not on TV output.
 
+=== Output files after building ==============================================
+
+output/images
++-- kernel.vfat (VFAT kernel partition image generated by genimage)
++-- rootfs.ext2 (Root file system)
++-- sdcard.img (Complete SD card image generated by genimage)
++-- u-boot.sd (U-Boot image)
++-- uImage -> uImage.imx23-olinuxino (To copy kernel as "uImage" to kernel.vfat)
++-- uImage.imx23-olinuxino (Kernel uImage)
+
+=== Use of generated SD card image ===========================================
+
+Just write sdcard.img directly to the SD card
+
+***** WARNING: Double check that /dev/sdc is your MicroSD card *****
+*****      It might be /dev/sdb or some other device name      *****
+***** Failure to do so may result in you wiping your hard disk *****
+
+   # dd if=output/images/sdcard.img of=/dev/sdc bs=512
+
+=== Manual creation of SD card image =========================================
+
 You'll need a spare MicroSD card with Freescale's special partition layout.
 This is basically three partitions:
 
diff --git a/configs/olimex_imx233_olinuxino_defconfig b/configs/olimex_imx233_olinuxino_defconfig
index 9951284..87684fc 100644
--- a/configs/olimex_imx233_olinuxino_defconfig
+++ b/configs/olimex_imx233_olinuxino_defconfig
@@ -39,3 +39,9 @@  BR2_TARGET_UBOOT_CUSTOM_VERSION=y
 BR2_TARGET_UBOOT_CUSTOM_VERSION_VALUE="2016.01"
 BR2_TARGET_UBOOT_BOARD_DEFCONFIG="mx23_olinuxino"
 BR2_TARGET_UBOOT_FORMAT_SD=y
+ 
+# To generate SD Image
+BR2_PACKAGE_HOST_GENIMAGE=y
+BR2_PACKAGE_HOST_MTOOLS=y
+BR2_ROOTFS_POST_IMAGE_SCRIPT="board/olimex/imx233_olinuxino/post-image.sh"
+