Revert "kmod-nft-reject: Fix for "nft_reject_ipv4.ko missing" warning"
[openwrt/openwrt.git] / target / linux / mvebu / image / Makefile
1 #
2 # Copyright (C) 2012-2016 OpenWrt.org
3 # Copyright (C) 2016 LEDE-project.org
4 #
5 # This is free software, licensed under the GNU General Public License v2.
6 # See /LICENSE for more information.
7 #
8
9 JFFS2_BLOCKSIZE = 128k
10
11 include $(TOPDIR)/rules.mk
12 include $(INCLUDE_DIR)/image.mk
13
14 DEVICE_VARS += BOOT_SCRIPT UBOOT
15 KERNEL_LOADADDR := 0x00008000
16
17 define Build/boot-scr
18 rm -f $@-boot.scr
19 sed \
20 -e 's#@ROOT@#$(IMG_PART_SIGNATURE)#g' \
21 -e 's#@DTB@#$(firstword $(DEVICE_DTS))#g' \
22 $(BOOT_SCRIPT).bootscript > $@-new.bootscript
23 mkimage -A arm -O linux -T script -C none -a 0 -e 0 -d $@-new.bootscript $@-boot.scr
24 endef
25
26 define Build/boot-img
27 rm -f $@.boot
28 mkfs.fat -C $@.boot $$(( $(CONFIG_TARGET_KERNEL_PARTSIZE) * 1024 ))
29 $(foreach dts,$(DEVICE_DTS), mcopy -i $@.boot $(KDIR)/image-$(dts).dtb ::$(dts).dtb;)
30 mcopy -i $@.boot $(IMAGE_KERNEL) ::$(KERNEL_NAME)
31 -mcopy -i $@.boot $@-boot.scr ::boot.scr
32 endef
33
34 define Build/boot-img-ext4
35 rm -fR $@.boot
36 mkdir -p $@.boot
37 $(foreach dts,$(DEVICE_DTS), $(CP) $(KDIR)/image-$(dts).dtb $@.boot/$(dts).dtb;)
38 $(CP) $(IMAGE_KERNEL) $@.boot/$(KERNEL_NAME)
39 -$(CP) $@-boot.scr $@.boot/boot.scr
40 make_ext4fs -J -L kernel -l $(CONFIG_TARGET_KERNEL_PARTSIZE)M $@.bootimg $@.boot
41 endef
42
43 define Build/buffalo-kernel-jffs2
44 rm -rf $(KDIR)/kernel_jffs2 $@.fakerd
45 mkdir -p $(KDIR)/kernel_jffs2
46 dd if=/dev/zero of=$@.fakerd bs=131008 count=1 conv=sync
47 $(STAGING_DIR_HOST)/bin/mkimage \
48 -T ramdisk -A $(LINUX_KARCH) -O linux -C gzip -n 'fake initrd' \
49 -d $@.fakerd $(KDIR)/kernel_jffs2/initrd.buffalo
50 cp $@ $(KDIR)/kernel_jffs2/uImage.buffalo
51 $(STAGING_DIR_HOST)/bin/mkfs.jffs2 \
52 --little-endian -v --squash-uids -q -f -n -x lzma -x rtime -m none \
53 --eraseblock=128KiB --pad=$(KERNEL_SIZE) -d $(KDIR)/kernel_jffs2 -o $@
54 rm -rf $(KDIR)/kernel_jffs2 $@.fakerd
55 endef
56
57 define Build/sdcard-img
58 SIGNATURE="$(IMG_PART_SIGNATURE)" \
59 ./gen_mvebu_sdcard_img.sh $@ \
60 $(if $(UBOOT),$(STAGING_DIR_IMAGE)/$(UBOOT)) \
61 c $(CONFIG_TARGET_KERNEL_PARTSIZE) $@.boot \
62 83 $(CONFIG_TARGET_ROOTFS_PARTSIZE) $(IMAGE_ROOTFS)
63 endef
64
65 define Build/sdcard-img-ext4
66 SIGNATURE="$(IMG_PART_SIGNATURE)" \
67 ./gen_mvebu_sdcard_img.sh $@ \
68 $(if $(UBOOT),$(STAGING_DIR_IMAGE)/$(UBOOT)) \
69 83 $(CONFIG_TARGET_KERNEL_PARTSIZE) $@.bootimg \
70 83 $(CONFIG_TARGET_ROOTFS_PARTSIZE) $(IMAGE_ROOTFS)
71 endef
72
73 define Build/omnia-medkit-initramfs
74 $(TAR) -c -T /dev/null -f $@
75 rm -rf $(dir $(IMAGE_KERNEL))boot
76 mkdir -p $(dir $(IMAGE_KERNEL))boot/boot/
77 cp $(KDIR)/zImage-initramfs $(dir $(IMAGE_KERNEL))boot/boot/zImage
78 cp $(KDIR)/image-$(DEVICE_DTS).dtb $(dir $(IMAGE_KERNEL))boot/boot/dtb
79 $(TAR) -rp --numeric-owner --owner=0 --group=0 --sort=name \
80 $(if $(SOURCE_DATE_EPOCH),--mtime="@$(SOURCE_DATE_EPOCH)") \
81 --file=$@ -C $(dir $(IMAGE_KERNEL))boot/ .
82 endef
83
84 define Build/uDPU-firmware
85 (rm -fR $@-fw; mkdir -p $@-fw)
86 $(CP) $(BIN_DIR)/$(IMAGE_PREFIX)-initramfs.itb $@-fw/recovery.itb
87 $(CP) $@-boot.scr $@-fw/boot.scr
88 $(TAR) -cvzp --numeric-owner --owner=0 --group=0 --sort=name \
89 $(if $(SOURCE_DATE_EPOCH),--mtime="@$(SOURCE_DATE_EPOCH)") \
90 -f $@-fw/rootfs.tgz -C $(TARGET_DIR) .
91 $(TAR) -cvzp --numeric-owner --owner=0 --group=0 --sort=name \
92 $(if $(SOURCE_DATE_EPOCH),--mtime="@$(SOURCE_DATE_EPOCH)") \
93 -f $@-fw/boot.tgz -C $@.boot .
94 $(TAR) -cvzp --numeric-owner --owner=0 --group=0 --sort=name \
95 $(if $(SOURCE_DATE_EPOCH),--mtime="@$(SOURCE_DATE_EPOCH)") \
96 -f $(KDIR_TMP)/$(IMAGE_PREFIX)-firmware.tgz -C $@-fw .
97 endef
98
99 define Device/Default
100 PROFILES := Default
101 DEVICE_DTS = $$(SOC)-$(lastword $(subst _, ,$(1)))
102 DEVICE_DTS_DIR := $(DTS_DIR)
103 BOARD_NAME = $$(DEVICE_DTS)
104 KERNEL_NAME := zImage
105 KERNEL := kernel-bin | append-dtb | uImage none
106 IMAGES := sysupgrade.bin
107 IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata
108 SUPPORTED_DEVICES = $(subst _,$(comma),$(1))
109 UBINIZE_OPTS := -E 5
110 UBOOT :=
111 BOOT_SCRIPT :=
112 endef
113
114 define Device/Default-arm64
115 BOOT_SCRIPT := generic-arm64
116 DEVICE_DTS_DIR := $(DTS_DIR)/marvell
117 IMAGES := sdcard.img.gz
118 IMAGE/sdcard.img.gz := boot-scr | boot-img-ext4 | sdcard-img-ext4 | gzip | append-metadata
119 KERNEL_NAME := Image
120 KERNEL := kernel-bin
121 endef
122
123 define Device/NAND-128K
124 BLOCKSIZE := 128k
125 PAGESIZE := 2048
126 SUBPAGESIZE := 512
127 VID_HDR_OFFSET := 2048
128 endef
129
130 define Device/NAND-256K
131 BLOCKSIZE := 256k
132 PAGESIZE := 4096
133 endef
134
135 define Device/NAND-512K
136 BLOCKSIZE := 512k
137 PAGESIZE := 4096
138 endef
139
140 include $(SUBTARGET).mk
141
142 $(eval $(call BuildImage))