aboutsummaryrefslogtreecommitdiffstats
path: root/target
diff options
context:
space:
mode:
authorLuis Araneda <luaraneda@gmail.com>2018-09-03 22:40:02 -0300
committerJohn Crispin <john@phrozen.org>2018-09-10 08:55:39 +0200
commit412763c81204d0fda0ebb753cb1da78aada34c5b (patch)
tree0c533350af007cbab1c3c6246e4211282f12e38f /target
parentd6501467e7aac5b7b0831363753da4a86f33f182 (diff)
downloadupstream-412763c81204d0fda0ebb753cb1da78aada34c5b.tar.gz
upstream-412763c81204d0fda0ebb753cb1da78aada34c5b.tar.bz2
upstream-412763c81204d0fda0ebb753cb1da78aada34c5b.zip
zynq: add sdcard image support
Implement the generation of sdcard images with ext4 or squashfs + f2fs overlay, but only enable the latter automatically Additionally, add mkf2fs and e2fsprogs to default packages to manipulate ext4 and f2fs filesystems Finally, disable the automatic generation of initramfs and rootfs.tar.gz images, as they are no longer required (they can still be selected in menuconfig) Signed-off-by: Luis Araneda <luaraneda@gmail.com>
Diffstat (limited to 'target')
-rw-r--r--target/linux/zynq/Makefile4
-rw-r--r--target/linux/zynq/image/Makefile20
-rwxr-xr-xtarget/linux/zynq/image/gen_zynq_sdcard_img.sh26
3 files changed, 48 insertions, 2 deletions
diff --git a/target/linux/zynq/Makefile b/target/linux/zynq/Makefile
index 6c0ca921d5..6193675088 100644
--- a/target/linux/zynq/Makefile
+++ b/target/linux/zynq/Makefile
@@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk
ARCH:=arm
BOARD:=zynq
BOARDNAME:=Xilinx Zynq 7000 SoCs
-FEATURES:=fpu gpio rtc usb usbgadget ramdisk targz
+FEATURES:=fpu gpio rtc usb usbgadget boot-part rootfs-part squashfs
CPU_TYPE:=cortex-a9
CPU_SUBTYPE:=neon
MAINTAINER:=Jason Wu <jason.wu.misc@gmail.com>
@@ -26,6 +26,6 @@ include $(INCLUDE_DIR)/target.mk
KERNELNAME:=Image dtbs
-DEFAULT_PACKAGES += uboot-envtools
+DEFAULT_PACKAGES += uboot-envtools mkf2fs e2fsprogs
$(eval $(call BuildTarget))
diff --git a/target/linux/zynq/image/Makefile b/target/linux/zynq/image/Makefile
index aa98f4bf3b..92174db19a 100644
--- a/target/linux/zynq/image/Makefile
+++ b/target/linux/zynq/image/Makefile
@@ -7,6 +7,24 @@
include $(TOPDIR)/rules.mk
include $(INCLUDE_DIR)/image.mk
+FAT32_BLOCK_SIZE=1024
+FAT32_BLOCKS=$(shell echo $$(($(CONFIG_TARGET_KERNEL_PARTSIZE)*1024*1024/$(FAT32_BLOCK_SIZE))))
+
+define Build/zynq-sdcard
+ rm -f $@.boot
+ mkfs.fat $@.boot -C $(FAT32_BLOCKS)
+ mcopy -i $@.boot $(STAGING_DIR_IMAGE)/$(DEVICE_NAME)-boot.bin ::boot.bin
+ mcopy -i $@.boot $(STAGING_DIR_IMAGE)/$(DEVICE_NAME)-u-boot.img ::u-boot.img
+ mcopy -i $@.boot $(STAGING_DIR_IMAGE)/$(DEVICE_NAME)-uEnv.txt ::uEnv.txt
+ mcopy -i $@.boot $(IMAGE_KERNEL) ::fit.itb
+ ./gen_zynq_sdcard_img.sh $@ \
+ $@.boot \
+ $(IMAGE_ROOTFS) \
+ $(CONFIG_TARGET_KERNEL_PARTSIZE) \
+ $(CONFIG_TARGET_ROOTFS_PARTSIZE)
+ rm -f $@.boot
+endef
+
#################################################
# Default and templates
#################################################
@@ -17,6 +35,8 @@ define Device/Default
KERNEL_INITRAMFS_PREFIX := $$(IMG_PREFIX)-$(1)-initramfs
KERNEL_PREFIX := $$(IMAGE_PREFIX)
KERNEL_LOADADDR := 0x8000
+ IMAGES := sdcard.img.gz
+ IMAGE/sdcard.img.gz := zynq-sdcard | gzip
endef
define Device/FitImageGzip
diff --git a/target/linux/zynq/image/gen_zynq_sdcard_img.sh b/target/linux/zynq/image/gen_zynq_sdcard_img.sh
new file mode 100755
index 0000000000..460a336e69
--- /dev/null
+++ b/target/linux/zynq/image/gen_zynq_sdcard_img.sh
@@ -0,0 +1,26 @@
+#!/usr/bin/env bash
+
+set -ex
+[ $# -eq 5 ] || {
+ echo "SYNTAX: $0 <file> <bootfs image> <rootfs image> <bootfs size> <rootfs size>"
+ exit 1
+}
+
+OUTPUT="$1"
+BOOTFS="$2"
+ROOTFS="$3"
+BOOTFSSIZE="$4"
+ROOTFSSIZE="$5"
+
+head=4
+sect=63
+
+set $(ptgen -o $OUTPUT -h $head -s $sect -l 1024 -t c -p ${BOOTFSSIZE}M -t 83 -p ${ROOTFSSIZE}M)
+
+BOOTOFFSET="$(($1 / 512))"
+BOOTSIZE="$(($2 / 512))"
+ROOTFSOFFSET="$(($3 / 512))"
+ROOTFSSIZE="$(($4 / 512))"
+
+dd bs=512 if="$BOOTFS" of="$OUTPUT" seek="$BOOTOFFSET" conv=notrunc
+dd bs=512 if="$ROOTFS" of="$OUTPUT" seek="$ROOTFSOFFSET" conv=notrunc