Skip to contentSkip to conversation

configs: atmel: add sama5d2 xplained sd card image generation

PATCH Superseded Ludovic Desroches 2 participants 5 messages Apr 1, 2016 – Apr 4, 2016 Arm/Microchip (AT91) SoC support

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/3 configs: atmel: add sama5d2 xplained sd card image generation

Use genimage to generate a sd card with a fat partition (at91bootstrap, u-boot, kernel, dtbs) and an ext4 partition (rootfs).

---
 board/atmel/sama5d2_xplained_mmc/genimage.cfg  | 33 ++++++++++++++++++++++++++
 board/atmel/sama5d2_xplained_mmc/post-image.sh | 16 +++++++++++++
 configs/atmel_sama5d2_xplained_mmc_defconfig   |  4 ++++
 3 files changed, 53 insertions(+)
 create mode 100644 board/atmel/sama5d2_xplained_mmc/genimage.cfg
 create mode 100755 board/atmel/sama5d2_xplained_mmc/post-image.sh
board/atmel/sama5d2_xplained_mmc/genimage.cfg new file +33 -0
new file mode 100644
index 0000000..b0ba22d
@@ -0,0 +1,33 @@
+# Image for SD card boot on Atmel SAMA5D2 Xplained boards
+#
+image boot.vfat {
+	vfat {
+		files = {
+			"zImage",
+			"at91-sama5d2_xplained.dtb",
+			"at91-sama5d2_xplained_pda4.dtb",
+			"at91-sama5d2_xplained_pda7.dtb",
+			"at91-sama5d2_xplained_pda7b.dtb",
+			"boot.bin",
+			"u-boot.bin"
+		}
+	}
+	size = 16M
+}
+
+image sdcard.img {
+	hdimage {
+	}
+
+	partition boot {
+		partition-type = 0xC
+		bootable = "true"
+		image = "boot.vfat"
+	}
+
+	partition rootfs {
+		partition-type = 0x83
+		image = "rootfs.ext4"
+		size = 512M
+	}
+}
board/atmel/sama5d2_xplained_mmc/post-image.sh new file +16 -0
new file mode 100755
index 0000000..c82b189
@@ -0,0 +1,16 @@
+#!/bin/sh
+
+BOARD_DIR="$(dirname $0)"
+GENIMAGE_CFG="${BOARD_DIR}/genimage.cfg"
+GENIMAGE_TMP="${BUILD_DIR}/genimage.tmp"
+
+rm -rf "${GENIMAGE_TMP}"
+
+genimage                               \
+	--rootpath "${TARGET_DIR}"     \
+	--tmppath "${GENIMAGE_TMP}"    \
+	--inputpath "${BINARIES_DIR}"  \
+	--outputpath "${BINARIES_DIR}" \
+	--config "${GENIMAGE_CFG}"
+
+exit $?
configs/atmel_sama5d2_xplained_mmc_defconfig +4 -0
index 74fa2b5..445c814 100644
@@ -5,6 +5,7 @@ BR2_ARM_ENABLE_VFP=y
 BR2_ARM_FPU_VFPV4=y
 BR2_ARM_INSTRUCTIONS_THUMB2=y
 BR2_PACKAGE_HOST_LINUX_HEADERS_CUSTOM_4_1=y
+BR2_ROOTFS_POST_IMAGE_SCRIPT="board/atmel/sama5d2_xplained_mmc/post-image.sh"
 BR2_LINUX_KERNEL=y
 BR2_LINUX_KERNEL_CUSTOM_GIT=y
 BR2_LINUX_KERNEL_CUSTOM_REPO_URL="https://github.com/linux4sam/linux-at91.git"
@@ -13,6 +14,8 @@ BR2_LINUX_KERNEL_DEFCONFIG="sama5"
 BR2_LINUX_KERNEL_ZIMAGE=y
 BR2_LINUX_KERNEL_DTS_SUPPORT=y
 BR2_LINUX_KERNEL_INTREE_DTS_NAME="at91-sama5d2_xplained at91-sama5d2_xplained_pda4 at91-sama5d2_xplained_pda7 at91-sama5d2_xplained_pda7b"
+BR2_TARGET_ROOTFS_EXT2=y
+BR2_TARGET_ROOTFS_EXT2_4=y
 BR2_TARGET_AT91BOOTSTRAP3=y
 BR2_TARGET_AT91BOOTSTRAP3_CUSTOM_GIT=y
 BR2_TARGET_AT91BOOTSTRAP3_CUSTOM_REPO_URL="https://github.com/linux4sam/at91bootstrap.git"
@@ -24,3 +27,4 @@ BR2_TARGET_UBOOT_CUSTOM_GIT=y
 BR2_TARGET_UBOOT_CUSTOM_REPO_URL="https://github.com/linux4sam/u-boot-at91.git"
 BR2_TARGET_UBOOT_CUSTOM_REPO_VERSION="linux4sam_5.2"
 BR2_TARGET_UBOOT_BOARD_DEFCONFIG="sama5d2_xplained_mmc"
+BR2_PACKAGE_HOST_GENIMAGE=y
Signature · 1 line
2.5.0
#1 lore raw

PATCH 2/3 configs: atmel: add sama5d4 xplained sd card image generation

Use genimage to generate a sd card with a fat partition (at91bootstrap, u-boot, kernel, dtbs) and an ext4 partition (rootfs).

---
 board/atmel/sama5d4_xplained_mmc/genimage.cfg  | 34 ++++++++++++++++++++++++++
 board/atmel/sama5d4_xplained_mmc/post-image.sh | 16 ++++++++++++
 configs/atmel_sama5d4_xplained_mmc_defconfig   |  5 +++-
 3 files changed, 54 insertions(+), 1 deletion(-)
 create mode 100644 board/atmel/sama5d4_xplained_mmc/genimage.cfg
 create mode 100755 board/atmel/sama5d4_xplained_mmc/post-image.sh
board/atmel/sama5d4_xplained_mmc/genimage.cfg new file +34 -0
new file mode 100644
index 0000000..b23ebe4
@@ -0,0 +1,34 @@
+# Image for SD card boot on Atmel SAMA5D4 Xplained boards
+#
+image boot.vfat {
+	vfat {
+		files = {
+			"zImage",
+			"at91-sama5d4_xplained.dtb",
+			"at91-sama5d4_xplained_hdmi.dtb",
+			"at91-sama5d4_xplained_pda4.dtb",
+			"at91-sama5d4_xplained_pda7.dtb",
+			"at91-sama5d4_xplained_pda7b.dtb",
+			"boot.bin",
+			"u-boot.bin"
+		}
+	}
+	size = 16M
+}
+
+image sdcard.img {
+	hdimage {
+	}
+
+	partition boot {
+		partition-type = 0xC
+		bootable = "true"
+		image = "boot.vfat"
+	}
+
+	partition rootfs {
+		partition-type = 0x83
+		image = "rootfs.ext4"
+		size = 512M
+	}
+}
board/atmel/sama5d4_xplained_mmc/post-image.sh new file +16 -0
new file mode 100755
index 0000000..c82b189
@@ -0,0 +1,16 @@
+#!/bin/sh
+
+BOARD_DIR="$(dirname $0)"
+GENIMAGE_CFG="${BOARD_DIR}/genimage.cfg"
+GENIMAGE_TMP="${BUILD_DIR}/genimage.tmp"
+
+rm -rf "${GENIMAGE_TMP}"
+
+genimage                               \
+	--rootpath "${TARGET_DIR}"     \
+	--tmppath "${GENIMAGE_TMP}"    \
+	--inputpath "${BINARIES_DIR}"  \
+	--outputpath "${BINARIES_DIR}" \
+	--config "${GENIMAGE_CFG}"
+
+exit $?
configs/atmel_sama5d4_xplained_mmc_defconfig +4 -1
index e0374d7..eb16ad7 100644
@@ -4,6 +4,7 @@ BR2_ARM_ENABLE_NEON=y
 BR2_ARM_ENABLE_VFP=y
 BR2_ARM_INSTRUCTIONS_THUMB2=y
 BR2_PACKAGE_HOST_LINUX_HEADERS_CUSTOM_4_1=y
+BR2_ROOTFS_POST_IMAGE_SCRIPT="board/atmel/sama5d4_xplained_mmc/post-image.sh"
 BR2_LINUX_KERNEL=y
 BR2_LINUX_KERNEL_CUSTOM_GIT=y
 BR2_LINUX_KERNEL_CUSTOM_REPO_URL="https://github.com/linux4sam/linux-at91.git"
@@ -12,6 +13,8 @@ BR2_LINUX_KERNEL_DEFCONFIG="sama5"
 BR2_LINUX_KERNEL_ZIMAGE=y
 BR2_LINUX_KERNEL_DTS_SUPPORT=y
 BR2_LINUX_KERNEL_INTREE_DTS_NAME="at91-sama5d4_xplained at91-sama5d4_xplained_hdmi at91-sama5d4_xplained_pda4 at91-sama5d4_xplained_pda7 at91-sama5d4_xplained_pda7b"
+BR2_TARGET_ROOTFS_EXT2=y
+BR2_TARGET_ROOTFS_EXT2_4=y
 BR2_TARGET_AT91BOOTSTRAP3=y
 BR2_TARGET_AT91BOOTSTRAP3_CUSTOM_GIT=y
 BR2_TARGET_AT91BOOTSTRAP3_CUSTOM_REPO_URL="https://github.com/linux4sam/at91bootstrap.git"
@@ -23,4 +26,4 @@ BR2_TARGET_UBOOT_CUSTOM_GIT=y
 BR2_TARGET_UBOOT_CUSTOM_REPO_URL="git://github.com/linux4sam/u-boot-at91.git"
 BR2_TARGET_UBOOT_CUSTOM_REPO_VERSION="linux4sam_5.2"
 BR2_TARGET_UBOOT_BOARD_DEFCONFIG="sama5d4_xplained_mmc"
-BR2_PACKAGE_HOST_SAM_BA=y
+BR2_PACKAGE_HOST_GENIMAGE=y
Signature · 1 line
2.5.0
#2 lore raw

PATCH 3/3 configs: atmel: add sama5d3 xplained sd card image generation

In reply to Ludovic Desroches

Use genimage to generate a sd card with a fat partition (at91bootstrap, u-boot, kernel, dtbs) and an ext4 partition (rootfs).

---
 board/atmel/sama5d3_xplained_mmc/genimage.cfg  | 33 ++++++++++++++++++++++++++
 board/atmel/sama5d3_xplained_mmc/post-image.sh | 16 +++++++++++++
 configs/atmel_sama5d3_xplained_mmc_defconfig   |  4 ++++
 3 files changed, 53 insertions(+)
 create mode 100644 board/atmel/sama5d3_xplained_mmc/genimage.cfg
 create mode 100755 board/atmel/sama5d3_xplained_mmc/post-image.sh
board/atmel/sama5d3_xplained_mmc/genimage.cfg new file +33 -0
new file mode 100644
index 0000000..32df453
@@ -0,0 +1,33 @@
+# Image for SD card boot on Atmel SAMA5D3 Xplained boards
+#
+image boot.vfat {
+	vfat {
+		files = {
+			"zImage",
+			"at91-sama5d3_xplained.dtb",
+			"at91-sama5d3_xplained_pda4.dtb",
+			"at91-sama5d3_xplained_pda7.dtb",
+			"at91-sama5d3_xplained_pda7b.dtb",
+			"boot.bin",
+			"u-boot.bin"
+		}
+	}
+	size = 16M
+}
+
+image sdcard.img {
+	hdimage {
+	}
+
+	partition boot {
+		partition-type = 0xC
+		bootable = "true"
+		image = "boot.vfat"
+	}
+
+	partition rootfs {
+		partition-type = 0x83
+		image = "rootfs.ext4"
+		size = 512M
+	}
+}
board/atmel/sama5d3_xplained_mmc/post-image.sh new file +16 -0
new file mode 100755
index 0000000..c82b189
@@ -0,0 +1,16 @@
+#!/bin/sh
+
+BOARD_DIR="$(dirname $0)"
+GENIMAGE_CFG="${BOARD_DIR}/genimage.cfg"
+GENIMAGE_TMP="${BUILD_DIR}/genimage.tmp"
+
+rm -rf "${GENIMAGE_TMP}"
+
+genimage                               \
+	--rootpath "${TARGET_DIR}"     \
+	--tmppath "${GENIMAGE_TMP}"    \
+	--inputpath "${BINARIES_DIR}"  \
+	--outputpath "${BINARIES_DIR}" \
+	--config "${GENIMAGE_CFG}"
+
+exit $?
configs/atmel_sama5d3_xplained_mmc_defconfig +4 -0
index 2fb1fa4..27672a9 100644
@@ -3,6 +3,7 @@ BR2_cortex_a5=y
 BR2_ARM_ENABLE_VFP=y
 BR2_ARM_INSTRUCTIONS_THUMB2=y
 BR2_PACKAGE_HOST_LINUX_HEADERS_CUSTOM_4_1=y
+BR2_ROOTFS_POST_IMAGE_SCRIPT="board/atmel/sama5d3_xplained_mmc/post-image.sh"
 BR2_LINUX_KERNEL=y
 BR2_LINUX_KERNEL_CUSTOM_GIT=y
 BR2_LINUX_KERNEL_CUSTOM_REPO_URL="https://github.com/linux4sam/linux-at91.git"
@@ -11,6 +12,8 @@ BR2_LINUX_KERNEL_DEFCONFIG="sama5"
 BR2_LINUX_KERNEL_ZIMAGE=y
 BR2_LINUX_KERNEL_DTS_SUPPORT=y
 BR2_LINUX_KERNEL_INTREE_DTS_NAME="at91-sama5d3_xplained at91-sama5d3_xplained_pda4 at91-sama5d3_xplained_pda7 at91-sama5d3_xplained_pda7b"
+BR2_TARGET_ROOTFS_EXT2=y
+BR2_TARGET_ROOTFS_EXT2_4=y
 BR2_TARGET_AT91BOOTSTRAP3=y
 BR2_TARGET_AT91BOOTSTRAP3_CUSTOM_GIT=y
 BR2_TARGET_AT91BOOTSTRAP3_CUSTOM_REPO_URL="https://github.com/linux4sam/at91bootstrap.git"
@@ -22,3 +25,4 @@ BR2_TARGET_UBOOT_CUSTOM_GIT=y
 BR2_TARGET_UBOOT_CUSTOM_REPO_URL="https://github.com/linux4sam/u-boot-at91.git"
 BR2_TARGET_UBOOT_CUSTOM_REPO_VERSION="linux4sam_5.2"
 BR2_TARGET_UBOOT_BOARD_DEFCONFIG="sama5d3_xplained_mmc"
+BR2_PACKAGE_HOST_GENIMAGE=y
Signature · 1 line
2.5.0
#3 lore raw

PATCH 1/3 configs: atmel: add sama5d2 xplained sd card image generation

In reply to Ludovic Desroches

Hello,

Quoted 4 lines · Ludovic Desroches

Use genimage to generate a sd card with a fat partition (at91bootstrap, u-boot, kernel, dtbs) and an ext4 partition (rootfs).

Thanks for working on this!

Quoted 12 lines
board/atmel/sama5d2_xplained_mmc/post-image.sh new file +6 -0
new file mode 100755
index 0000000..c82b189
@@ -0,0 +1,16 @@
+#!/bin/sh
+
+BOARD_DIR="$(dirname $0)"
+GENIMAGE_CFG="${BOARD_DIR}/genimage.cfg"
+GENIMAGE_TMP="${BUILD_DIR}/genimage.tmp"
+

board/atmel/sama5d2_xplained_mmc/post-image.sh line 16

Quoted 10 lines
board/atmel/sama5d2_xplained_mmc/post-image.sh new file +10 -0
+rm -rf "${GENIMAGE_TMP}"
+
+genimage                               \
+	--rootpath "${TARGET_DIR}"     \
+	--tmppath "${GENIMAGE_TMP}"    \
+	--inputpath "${BINARIES_DIR}"  \
+	--outputpath "${BINARIES_DIR}" \
+	--config "${GENIMAGE_CFG}"
+
+exit $?

This last line is not needed.

We really need at some point to provide a generic mechanism for genimage, because this script is duplicated all over the place. But that's a separate issue, we can definitely accept your patch without doing this refactoring.

Quoted 1 line

+BR2_PACKAGE_HOST_GENIMAGE=y

You need to add:

BR2_PACKAGE_HOST_DOSFSTOOLS=y
BR2_PACKAGE_HOST_MTOOLS=y

Which are used to generate the FAT filesystem. You may not have noticed if you have those tools installed on your machine, but they are needed.

Last but not least, could you add a patch at the end of the series that updates the documentation in board/atmel/readme.txt to simplify the SD card installation details? Indeed we no longer need to tell the user to create the partitions, copy the files manually and so on.

Thanks a lot!

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
#4 lore raw

PATCH 1/3 configs: atmel: add sama5d2 xplained sd card image generation

Quoted 27 lines · Thomas Petazzoni

Hello,

Quoted 4 lines · Ludovic Desroches

Use genimage to generate a sd card with a fat partition (at91bootstrap, u-boot, kernel, dtbs) and an ext4 partition (rootfs).

Thanks for working on this!

Quoted 16 lines
board/atmel/sama5d2_xplained_mmc/post-image.sh new file +10 -0
new file mode 100755
index 0000000..c82b189
@@ -0,0 +1,16 @@
+#!/bin/sh
+
+BOARD_DIR="$(dirname $0)"
+GENIMAGE_CFG="${BOARD_DIR}/genimage.cfg"
+GENIMAGE_TMP="${BUILD_DIR}/genimage.tmp"
+
+rm -rf "${GENIMAGE_TMP}"
+
+genimage                               \
+	--rootpath "${TARGET_DIR}"     \
Quoted 9 lines

board/atmel/sama5d2_xplained_mmc/post-image.sh line 16

Quoted 6 lines
board/atmel/sama5d2_xplained_mmc/post-image.sh new file +6 -0
+	--tmppath "${GENIMAGE_TMP}"    \
+	--inputpath "${BINARIES_DIR}"  \
+	--outputpath "${BINARIES_DIR}" \
+	--config "${GENIMAGE_CFG}"
+
+exit $?

This last line is not needed.

Ok.

Quoted 8 lines

We really need at some point to provide a generic mechanism for genimage, because this script is duplicated all over the place. But that's a separate issue, we can definitely accept your patch without doing this refactoring.

Quoted 1 line

+BR2_PACKAGE_HOST_GENIMAGE=y

Quoted 8 lines

You need to add:

BR2_PACKAGE_HOST_DOSFSTOOLS=y
BR2_PACKAGE_HOST_MTOOLS=y

Which are used to generate the FAT filesystem. You may not have noticed if you have those tools installed on your machine, but they are needed.

I'll add these packages.

Quoted 5 lines

Last but not least, could you add a patch at the end of the series that updates the documentation in board/atmel/readme.txt to simplify the SD card installation details? Indeed we no longer need to tell the user to create the partitions, copy the files manually and so on.

I thought it could be useful if the user wanted to generate it by himself. But you are right why doing it this way if he only has to change genimage.cfg

Regards

Ludovic