2 # Copyright (C) 2012-2016 OpenWrt.org
3 # Copyright (C) 2016 LEDE-project.org
5 # This is free software, licensed under the GNU General Public License v2.
6 # See /LICENSE for more information.
11 include $(TOPDIR)/rules.mk
12 include $(INCLUDE_DIR)/image.mk
14 KERNEL_LOADADDR := 0x00008000
16 SIGNATURE:=$(shell printf "%.8s" $(SOURCE_DATE_EPOCH))
19 $(call Image/BuildDTB,$(DTS_DIR)/$(DEVICE_DTS).dts,$@.dtb)
23 # these values are optimized for a 4GB labeled sdcard that actually holds 7744512 sectors of 512 byte
25 # Partition 1: 32768 sectors
26 # Partition 2: 98304 sectors (configurable)
30 sed -e 's#@ROOT@#$(SIGNATURE)#g' \
31 $(DEVICE_NAME).bootscript > $@-new.bootscript
32 mkimage -A arm -O linux -T script -C none -a 0 -e 0 -d $@-new.bootscript $@-boot.scr
37 mkfs.fat -C $@.boot 16384
38 $(foreach dts,$(DEVICE_DTS), mcopy -i $@.boot $(DTS_DIR)/$(dts).dtb ::$(dts).dtb;)
39 mcopy -i $@.boot $(IMAGE_KERNEL) ::$(KERNEL_NAME)
40 -mcopy -i $@.boot $@-boot.scr ::boot.scr
43 define Build/boot-img-ext4
46 $(foreach dts,$(DEVICE_DTS), $(CP) $(DTS_DIR)/$(dts).dtb $@.boot;)
47 $(CP) $(IMAGE_KERNEL) $@.boot/$(KERNEL_NAME)
48 -$(CP) $@-boot.scr $@.boot/boot.scr
49 make_ext4fs -J -l 16384K $@.bootimg $@.boot
52 define Build/sdcard-img
53 if [ -n "$(UBOOT)" ]; then UBOOT="$(STAGING_DIR_IMAGE)/$(UBOOT)"; fi; \
54 ROOTFS_SIZE=$$(( $(CONFIG_TARGET_ROOTFS_PARTSIZE) * 1024 * 2 )); \
55 SIGNATURE="$(SIGNATURE)" \
56 ./gen_mvebu_sdcard_img.sh $@ \
59 83 $$ROOTFS_SIZE $(IMAGE_ROOTFS)
62 define Build/sdcard-img-ext4
63 if [ -n "$(UBOOT)" ]; then UBOOT="$(STAGING_DIR_IMAGE)/$(UBOOT)"; fi; \
64 ROOTFS_SIZE=$$(( $(CONFIG_TARGET_ROOTFS_PARTSIZE) * 1024 * 2 )); \
65 SIGNATURE="$(SIGNATURE)" \
66 ./gen_mvebu_sdcard_img.sh $@ \
69 83 $$ROOTFS_SIZE $(IMAGE_ROOTFS)
72 define Build/omnia-medkit-initramfs
73 $(TAR) -c -T /dev/null -f $@
74 rm -rf $(dir $(IMAGE_KERNEL))boot
75 mkdir -p $(dir $(IMAGE_KERNEL))boot/boot/
76 cp $(KDIR)/zImage-initramfs $(dir $(IMAGE_KERNEL))boot/boot/zImage
77 cp $(DTS_DIR)/$(DEVICE_DTS).dtb $(dir $(IMAGE_KERNEL))boot/boot/dtb
78 $(TAR) -rp --numeric-owner --owner=0 --group=0 --sort=name \
79 $(if $(SOURCE_DATE_EPOCH),--mtime="@$(SOURCE_DATE_EPOCH)") \
80 --file=$@ -C $(dir $(IMAGE_KERNEL))boot/ .
86 BOARD_NAME = $$(DEVICE_DTS)
88 KERNEL := kernel-bin | append-dtb | uImage none
89 SUPPORTED_DEVICES = $$(DEVICE_DTS)
95 IMAGES := sysupgrade.bin
96 IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata
99 define Device/UBI-factory
102 IMAGES += factory.img
103 IMAGE/factory.img := append-kernel | pad-to $$$$(KERNEL_SIZE) | append-ubi | pad-to $$$$(PAGESIZE)
106 define Device/NAND-128K
111 VID_HDR_OFFSET := 2048
114 define Device/NAND-256K
120 define Device/NAND-512K
127 include cortex-a53.mk
128 include cortex-a72.mk
130 $(eval $(call BuildImage))