aboutsummaryrefslogtreecommitdiffstats
path: root/target/linux/mvebu/image/Makefile
diff options
context:
space:
mode:
authorJosua Mayer <josua.mayer97@gmail.com>2016-08-09 15:23:24 +0200
committerFelix Fietkau <nbd@nbd.name>2016-09-02 14:43:52 +0200
commit3242c076492a46ddf5da92fb4bd3de813cab56f4 (patch)
treec9e97fb3f812f2cdb974e8c8e508c2aff39ab286 /target/linux/mvebu/image/Makefile
parenta67183a7bc6f65535877f98ca25f662affbc1df5 (diff)
downloadupstream-3242c076492a46ddf5da92fb4bd3de813cab56f4.tar.gz
upstream-3242c076492a46ddf5da92fb4bd3de813cab56f4.tar.bz2
upstream-3242c076492a46ddf5da92fb4bd3de813cab56f4.zip
mvebu: add sdcard image creation script
Added gen_mvebu_sdcard_img.sh to facilitate creating an fixed-size sdcard image, adding the bootloader and populating it with actual data. Added the required rules for creating a 4GB sdcard image according to this layout: p0: boot (fat32) p1: rootfs (squashfs) p2: rootfs_data (ext4) This should be generic to any mvebu boards that can boot from block storage. Added the new sdcard image to the Clearfog image profile. Signed-off-by: Josua Mayer <josua.mayer97@gmail.com> Signed-off-by: Felix Fietkau <nbd@nbd.name> [cleanup]
Diffstat (limited to 'target/linux/mvebu/image/Makefile')
-rw-r--r--target/linux/mvebu/image/Makefile37
1 files changed, 35 insertions, 2 deletions
diff --git a/target/linux/mvebu/image/Makefile b/target/linux/mvebu/image/Makefile
index a09cf24f1a..05321e1dc5 100644
--- a/target/linux/mvebu/image/Makefile
+++ b/target/linux/mvebu/image/Makefile
@@ -29,6 +29,38 @@ define Build/clearfog-bundle
gzip -9n -c $@.new > $@
endef
+# SD-Card Images:
+# these values are optimized for a 4GB labeled sdcard that actually holds 7744512 sectors of 512 byte
+# MBR: 2048 sectors
+# Partition 1: 32768 sectors
+# Partition 2: 98304 sectors (configurable)
+# Partition 3: 7611392 sectors (configurable, depends on p2 size)
+
+define Build/boot-scr
+ rm -f $@.bootscript
+ mkimage -A arm -O linux -T script -C none -a 0 -e 0 -d boot.script $@.bootscript
+endef
+
+define Build/boot-img
+ rm -f $@.boot
+ mkfs.fat -C $@.boot 16384
+ $(foreach dts,$(DEVICE_DTS), mcopy -i $@.boot $(DTS_DIR)/$(dts).dtb ::$(dts).dtb)
+ mcopy -i $@.boot $(IMAGE_KERNEL) ::zImage
+ mcopy -i $@.boot $@.bootscript ::boot.scr
+endef
+
+define Build/sdcard-img
+ rm -rf $@ $@.rootfsdata $@.tmp
+ mkdir -p $@.tmp
+ ROOTFS_SIZE=$$(( $(CONFIG_TARGET_ROOTFS_PARTSIZE) * 1024 * 2 )); \
+ DATA_SIZE=$$(( 7709696 - ($(CONFIG_TARGET_ROOTFS_PARTSIZE) * 1024 * 2) )); \
+ make_ext4fs -J -l $$DATA_SIZE $@.rootfsdata $@.tmp && \
+ ./gen_mvebu_sdcard_img.sh 7744512 $@ \
+ "$(BIN_DIR)/uboot-mvebu-clearfog/openwrt-mvebu-clearfog-u-boot-spl.kwb" \
+ c 32768 $@.boot \
+ 83 $$ROOTFS_SIZE $(IMAGE_ROOTFS) \
+ 83 $$DATA_SIZE $@.rootfsdata
+endef
define Device/Default
PROFILES := Default
@@ -150,9 +182,10 @@ define Device/armada-388-clearfog
KERNEL_INSTALL := 1
KERNEL := dtb | kernel-bin
DEVICE_TITLE := SolidRun ClearFog
- DEVICE_PACKAGES := uboot-mvebu-clearfog
- IMAGES := bundle.tar.gz
+ DEVICE_PACKAGES := uboot-mvebu-clearfog kmod-fs-ext4
+ IMAGES := bundle.tar.gz sdcard.img.gz
IMAGE/bundle.tar.gz := clearfog-bundle
+ IMAGE/sdcard.img.gz := boot-scr | boot-img | sdcard-img | gzip
IMAGE_NAME = $$(IMAGE_PREFIX)-$$(2)
endef
TARGET_DEVICES += armada-388-clearfog