diff options
Diffstat (limited to 'target/linux/apm821xx/image/Makefile')
-rw-r--r-- | target/linux/apm821xx/image/Makefile | 81 |
1 files changed, 71 insertions, 10 deletions
diff --git a/target/linux/apm821xx/image/Makefile b/target/linux/apm821xx/image/Makefile index 48ada70d3f..ba11bb22ee 100644 --- a/target/linux/apm821xx/image/Makefile +++ b/target/linux/apm821xx/image/Makefile @@ -4,19 +4,80 @@ # include $(TOPDIR)/rules.mk include $(INCLUDE_DIR)/image.mk +include $(INCLUDE_DIR)/host.mk -IMAGE_PROFILE:=$(if $(PROFILE),$(PROFILE),Default) - -DEVICE_VARS += DTS IMAGE_SIZE +DEVICE_VARS += DEVICE_DTS DEVICE_PROFILE IMAGE_SIZE DTB_SIZE define Device/Default - BOARDNAME := - DEVICE_PROFILE = $$(BOARDNAME) - PROFILES = Default $$(DEVICE_PROFILE) - KERNEL_DEPENDS = $$(wildcard ../dts/$$(DTS).dts) - KERNEL := kernel-bin | lzma | uImage lzma - KERNEL_INITRAMFS := kernel-bin | lzma | uImage lzma + KERNEL_DEPENDS = $$(wildcard ../dts/$$(DEVICE_DTS).dts) + DEVICE_PROFILE := + DEVICE_DTS := + KERNEL_ENTRY := 0x00000000 + KERNEL_LOADADDR := 0x00000000 +endef + +define Build/dtb + $(call Image/BuildDTB,../dts/$(DEVICE_DTS).dts,$@.dtb,,--space $(DTB_SIZE)) +endef + +ifeq ($(SUBTARGET),nand) + +define Image/cpiogz + ( cd $(TARGET_DIR); find . | cpio -o -H newc | gzip -9n >$(KDIR_TMP)/$(IMG_PREFIX)-rootfs.cpio.gz ) +endef + +define Build/copy-file + cat "$(1)" > "$@" +endef + +define Build/MerakiAdd-dtb + $(call Image/BuildDTB,../dts/$(DEVICE_DTS).dts,$@.dtb) + ( \ + dd if=$@.dtb bs=$(DTB_SIZE) conv=sync; \ + dd if=$@ bs=$(BLOCKSIZE) conv=sync; \ + ) > $@.new + @mv $@.new $@ endef -TARGET_DEVICES += Default + +define Build/MerakiAdd-initramfs + $(call Image/cpiogz) + + -$(STAGING_DIR_HOST)/bin/mkimage -A $(LINUX_KARCH) -O linux -T ramdisk \ + -C gzip -n "$(PROFILE) rootfs" \ + -d $(KDIR_TMP)/$(IMG_PREFIX)-rootfs.cpio.gz \ + $(KDIR_TMP)/$(IMG_PREFIX)-uramdisk.image.gz + + ( \ + dd if=$@ bs=1k conv=sync; \ + dd if=$(KDIR_TMP)/$(IMG_PREFIX)-uramdisk.image.gz bs=$(BLOCKSIZE) conv=sync; \ + ) > $@.new + @mv $@.new $@ +endef + +define Build/MerakiNAND + -$(STAGING_DIR_HOST)/bin/mkmerakifw \ + -B $(DEVICE_PROFILE) -s \ + -i $@ \ + -o $@.new + @cp $@.new $@ +endef + +define Device/mr24 + DEVICE_TITLE := Cisco Meraki MR24 + DEVICE_PACKAGES := kmod-spi-gpio kmod-ath9k wpad-mini + DEVICE_PROFILE := MR24 + DEVICE_DTS := MR24 + BLOCKSIZE := 64512 + IMAGES := sysupgrade.tar + DTB_SIZE := 64512 + KERNEL_SIZE := 2048k + IMAGE_SIZE := 8191k + KERNEL := kernel-bin | lzma | uImage lzma | MerakiAdd-dtb | MerakiNAND + KERNEL_INITRAMFS := copy-file $(KDIR)/vmlinux | lzma | uImage lzma | MerakiAdd-dtb | pad-to 2047k | MerakiAdd-initramfs | MerakiNAND + IMAGE/sysupgrade.tar := sysupgrade-nand +endef +TARGET_DEVICES += mr24 $(eval $(call BuildImage)) + +endif |