OpenWrt – Blame information for rev 4
?pathlinks?
Rev | Author | Line No. | Line |
---|---|---|---|
4 | office | 1 | # |
2 | # This is free software, licensed under the GNU General Public License v2. |
||
3 | # See /LICENSE for more information. |
||
4 | # |
||
5 | include $(TOPDIR)/rules.mk |
||
6 | include $(INCLUDE_DIR)/image.mk |
||
7 | |||
8 | DEVICE_VARS += IMAGE_SIZE DTB_SIZE |
||
9 | |||
10 | define Device/Default |
||
11 | PROFILES := Default |
||
12 | KERNEL_DEPENDS = $$(wildcard ../dts/$$(DEVICE_DTS).dts) |
||
13 | DEVICE_DTS := |
||
14 | KERNEL_ENTRY := 0x00000000 |
||
15 | KERNEL_LOADADDR := 0x00000000 |
||
16 | DEVICE_DTS_DIR := ../dts |
||
17 | SUPPORTED_DEVICES = $(subst _,$(comma),$(1)) |
||
18 | endef |
||
19 | |||
20 | define Build/dtb |
||
21 | $(call Image/BuildDTB,../dts/$(DEVICE_DTS).dts,$@.dtb,,--space $(DTB_SIZE)) |
||
22 | endef |
||
23 | |||
24 | define Build/prepend-dtb |
||
25 | cat "$@.dtb.uimage" "$@" > "$@.new" |
||
26 | mv "$@.new" "$@" |
||
27 | endef |
||
28 | |||
29 | define Build/export-dtb |
||
30 | cp $(IMAGE_KERNEL).dtb $@ |
||
31 | endef |
||
32 | |||
33 | ifeq ($(SUBTARGET),nand) |
||
34 | |||
35 | define Image/cpiogz |
||
36 | ( cd $(TARGET_DIR); find . | cpio -o -H newc | gzip -9n >$(KDIR_TMP)/$(IMG_PREFIX)-rootfs.cpio.gz ) |
||
37 | endef |
||
38 | |||
39 | define Build/copy-file |
||
40 | cat "$(1)" > "$@" |
||
41 | endef |
||
42 | |||
43 | define Build/MerakiAdd-dtb |
||
44 | $(call Image/BuildDTB,../dts/$(DEVICE_DTS).dts,$@.dtb) |
||
45 | ( \ |
||
46 | dd if=$@.dtb bs=$(DTB_SIZE) conv=sync; \ |
||
47 | dd if=$@ bs=$(BLOCKSIZE) conv=sync; \ |
||
48 | ) > $@.new |
||
49 | @mv $@.new $@ |
||
50 | endef |
||
51 | |||
52 | define Build/MerakiAdd-initramfs |
||
53 | $(call Image/cpiogz) |
||
54 | |||
55 | -$(STAGING_DIR_HOST)/bin/mkimage -A $(LINUX_KARCH) -O linux -T ramdisk \ |
||
56 | -C gzip -n "$(PROFILE) rootfs" \ |
||
57 | -d $(KDIR_TMP)/$(IMG_PREFIX)-rootfs.cpio.gz \ |
||
58 | $(KDIR_TMP)/$(IMG_PREFIX)-uramdisk.image.gz |
||
59 | |||
60 | ( \ |
||
61 | dd if=$@ bs=1k conv=sync; \ |
||
62 | dd if=$(KDIR_TMP)/$(IMG_PREFIX)-uramdisk.image.gz bs=$(BLOCKSIZE) conv=sync; \ |
||
63 | ) > $@.new |
||
64 | @mv $@.new $@ |
||
65 | endef |
||
66 | |||
67 | define Build/MerakiNAND |
||
68 | -$(STAGING_DIR_HOST)/bin/mkmerakifw \ |
||
69 | -B $(BOARD_NAME) -s \ |
||
70 | -i $@ \ |
||
71 | -o $@.new |
||
72 | @cp $@.new $@ |
||
73 | endef |
||
74 | |||
75 | define Device/meraki_mr24 |
||
76 | DEVICE_TITLE := Cisco Meraki MR24 |
||
77 | DEVICE_PACKAGES := kmod-spi-gpio -swconfig |
||
78 | BOARD_NAME := mr24 |
||
79 | DEVICE_DTS := meraki-mr24 |
||
80 | BLOCKSIZE := 63k |
||
81 | IMAGES := sysupgrade.tar |
||
82 | DTB_SIZE := 64512 |
||
83 | IMAGE_SIZE := 8191k |
||
84 | KERNEL := kernel-bin | lzma | uImage lzma | MerakiAdd-dtb | MerakiNAND |
||
85 | KERNEL_INITRAMFS := kernel-bin | lzma | dtb | MuImage-initramfs lzma |
||
86 | IMAGE/sysupgrade.tar := sysupgrade-tar | append-metadata |
||
87 | UBINIZE_OPTS := -E 5 |
||
88 | SUPPORTED_DEVICES += mr24 |
||
89 | endef |
||
90 | TARGET_DEVICES += meraki_mr24 |
||
91 | |||
92 | define Device/meraki_mx60 |
||
93 | DEVICE_TITLE := Cisco Meraki MX60/MX60W |
||
94 | DEVICE_PACKAGES := kmod-spi-gpio kmod-usb-ledtrig-usbport kmod-usb-dwc2 \ |
||
95 | kmod-usb-storage block-mount |
||
96 | BOARD_NAME := mx60 |
||
97 | DEVICE_DTS := meraki-mx60 |
||
98 | BLOCKSIZE := 63k |
||
99 | IMAGES := sysupgrade.tar |
||
100 | DTB_SIZE := 64512 |
||
101 | # The kernel size will need to match the offset defined in mkmerakifw.c, |
||
102 | # otherwise the final image will fail to boot. This is set within the |
||
103 | # MX60 kernel header definition which is found at |
||
104 | # ./tools/firmware-utils/src/mkmerakifw.c, line 103~ |
||
105 | KERNEL_SIZE := 2984k |
||
106 | IMAGE_SIZE := 1021m |
||
107 | KERNEL := kernel-bin | gzip | uImage gzip | MerakiAdd-dtb | MerakiNAND |
||
108 | KERNEL_INITRAMFS := copy-file $(KDIR)/vmlinux | gzip | uImage gzip | \ |
||
109 | check-size $$(KERNEL_SIZE) | \ |
||
110 | MerakiAdd-dtb | pad-to 2047k | MerakiAdd-initramfs | \ |
||
111 | MerakiNAND |
||
112 | IMAGE/sysupgrade.tar := sysupgrade-tar | append-metadata |
||
113 | UBINIZE_OPTS := -E 5 |
||
114 | SUPPORTED_DEVICES += mx60 |
||
115 | endef |
||
116 | TARGET_DEVICES += meraki_mx60 |
||
117 | |||
118 | define Build/create-uImage-dtb |
||
119 | # flat_dt target expect FIT image - which WNDR4700's uboot doesn't support |
||
120 | -$(STAGING_DIR_HOST)/bin/mkimage -A $(LINUX_KARCH) \ |
||
121 | -O linux -T kernel -C none \ |
||
122 | -n '$(call toupper,$(LINUX_KARCH)) $(VERSION_DIST) Linux-$(LINUX_VERSION)' \ |
||
123 | -d "$@.dtb" "$@.dtb.uimage" |
||
124 | endef |
||
125 | |||
126 | define Build/MuImage-initramfs |
||
127 | rm -rf $@.fakerd $@.new |
||
128 | |||
129 | dd if=/dev/zero of=$@.fakerd bs=32 count=1 conv=sync |
||
130 | |||
131 | # Netgear used an old uboot that doesn't have FIT support. |
||
132 | # So we are stuck with either a full ext2/4 fs in a initrd. |
||
133 | # ... or we try to make the "multi" image approach to work |
||
134 | # for us. |
||
135 | # |
||
136 | # Sadly, the "multi" image has to consists of three |
||
137 | # "fixed" parts in the following "fixed" order: |
||
138 | # 1. The kernel which is in $@ |
||
139 | # 2. The (fake) initrd which is in $@.fakerd |
||
140 | # 3. The device tree binary which is in $@.dtb |
||
141 | # |
||
142 | # Now, given that we use the function for the kernel which |
||
143 | # already has a initramfs image inside, we still have to |
||
144 | # add a "fake" initrd (which a mkimage header) in the second |
||
145 | # part of the legacy multi image. Since we need to put the |
||
146 | # device tree stuff into part 3. |
||
147 | |||
148 | -$(STAGING_DIR_HOST)/bin/mkimage -A $(LINUX_KARCH) -O linux -T multi \ |
||
149 | -C $(1) -a $(KERNEL_LOADADDR) -e $(KERNEL_ENTRY) \ |
||
150 | -n '$(BOARD_NAME) initramfs' -d $@:$@.fakerd:$@.dtb $@.new |
||
151 | mv $@.new $@ |
||
152 | rm -rf $@.fakerd |
||
153 | endef |
||
154 | |||
155 | define Device/netgear_wndr4700 |
||
156 | DEVICE_TITLE := Netgear Centria N900 WNDR4700/WNDR4720 |
||
157 | DEVICE_PACKAGES := badblocks block-mount e2fsprogs \ |
||
158 | kmod-dm kmod-fs-ext4 kmod-fs-vfat kmod-usb-ledtrig-usbport \ |
||
159 | kmod-md-mod kmod-nls-cp437 kmod-nls-iso8859-1 kmod-nls-iso8859-15 \ |
||
160 | kmod-nls-utf8 kmod-usb3 kmod-usb-dwc2 kmod-usb-storage \ |
||
161 | partx-utils |
||
162 | BOARD_NAME := wndr4700 |
||
163 | DEVICE_DTS := netgear-wndr4700 |
||
164 | PAGESIZE := 2048 |
||
165 | SUBPAGESIZE := 512 |
||
166 | BLOCKSIZE := 128k |
||
167 | DTB_SIZE := 131008 |
||
168 | IMAGE_SIZE := 24960k |
||
169 | IMAGES := factory.img sysupgrade.tar kernel.dtb |
||
170 | KERNEL_SIZE := 3584k |
||
171 | # append a fake/empty rootfs to fool netgear's uboot |
||
172 | # CHECK_DNI_FIRMWARE_ROOTFS_INTEGRITY in do_chk_dniimg() |
||
173 | KERNEL := kernel-bin | lzma | uImage lzma | pad-offset $$(BLOCKSIZE) 64 | \ |
||
174 | append-uImage-fakehdr filesystem | dtb | create-uImage-dtb | prepend-dtb |
||
175 | KERNEL_INITRAMFS := kernel-bin | gzip | dtb | MuImage-initramfs gzip |
||
176 | IMAGE/factory.img := append-kernel | pad-to $$$$(KERNEL_SIZE) | append-ubi | \ |
||
177 | netgear-dni | check-size $$$$(IMAGE_SIZE) |
||
178 | IMAGE/sysupgrade.tar := sysupgrade-tar | append-metadata |
||
179 | IMAGE/kernel.dtb := export-dtb | uImage none |
||
180 | NETGEAR_BOARD_ID := WNDR4700 |
||
181 | NETGEAR_HW_ID := 29763875+128+256 |
||
182 | UBINIZE_OPTS := -E 5 |
||
183 | SUPPORTED_DEVICES += wndr4700 |
||
184 | endef |
||
185 | TARGET_DEVICES += netgear_wndr4700 |
||
186 | |||
187 | endif |
||
188 | |||
189 | ifeq ($(SUBTARGET),sata) |
||
190 | |||
191 | ### Image scripts for the WD My Book Live Series ### |
||
192 | define Build/boot-script |
||
193 | $(STAGING_DIR_HOST)/bin/mkimage -A powerpc -T script -C none -n "$(PROFILE) Boot Script" \ |
||
194 | -d mbl_boot.scr \ |
||
195 | $@.scr |
||
196 | endef |
||
197 | |||
198 | define Build/boot-img |
||
199 | $(RM) -rf $@.bootdir |
||
200 | mkdir -p $@.bootdir/boot |
||
201 | |||
202 | $(CP) $@.scr $@.bootdir/boot/boot.scr |
||
203 | $(CP) $(IMAGE_KERNEL).dtb $@.bootdir/boot/$(DEVICE_DTB) |
||
204 | $(CP) $(IMAGE_KERNEL) $@.bootdir/boot/uImage |
||
205 | |||
206 | genext2fs --block-size $(BLOCKSIZE:%k=%Ki) --size-in-blocks $$((1024 * $(BOOT_SIZE))) --root $@.bootdir $@.boot |
||
207 | |||
208 | # convert it to revision 1 - needed for u-boot ext2load |
||
209 | $(STAGING_DIR_HOST)/bin/tune2fs -O filetype $@.boot |
||
210 | $(STAGING_DIR_HOST)/bin/e2fsck -pDf $@.boot > /dev/null |
||
211 | endef |
||
212 | |||
213 | define Build/hdd-img |
||
214 | ./mbl_gen_hdd_img.sh $@ $@.boot $(IMAGE_ROOTFS) |
||
215 | endef |
||
216 | |||
217 | define Device/MyBookLiveDefault |
||
218 | IMAGE_SIZE := 48m |
||
219 | BLOCKSIZE := 1k |
||
220 | DTB_SIZE := 16384 |
||
221 | KERNEL := kernel-bin | dtb | gzip | uImage gzip |
||
222 | KERNEL_INITRAMFS := kernel-bin | dtb | gzip | uImage gzip |
||
223 | BOOT_SIZE := 8 |
||
224 | IMAGES := rootfs.img.gz kernel.dtb |
||
225 | DEVICE_DTB := apollo3g.dtb |
||
226 | FILESYSTEMS := ext4 |
||
227 | IMAGE/kernel.dtb := export-dtb |
||
228 | IMAGE/rootfs.img.gz := boot-script | boot-img | hdd-img | gzip | append-metadata |
||
229 | endef |
||
230 | |||
231 | define Device/wd_mybooklive |
||
232 | $(Device/MyBookLiveDefault) |
||
233 | DEVICE_TITLE := Western Digital My Book Live |
||
234 | DEVICE_DTS := wd-mybooklive |
||
235 | SUPPORTED_DEVICES += mbl |
||
236 | endef |
||
237 | |||
238 | TARGET_DEVICES += wd_mybooklive |
||
239 | |||
240 | define Device/wd_mybooklive-duo |
||
241 | $(Device/MyBookLiveDefault) |
||
242 | DEVICE_TITLE := Western Digital My Book Live Duo |
||
243 | DEVICE_PACKAGES := kmod-usb-dwc2 kmod-usb-ledtrig-usbport kmod-usb-storage kmod-fs-vfat wpad-mini |
||
244 | DEVICE_DTS := wd-mybooklive-duo |
||
245 | SUPPORTED_DEVICES += mbl |
||
246 | endef |
||
247 | |||
248 | TARGET_DEVICES += wd_mybooklive-duo |
||
249 | |||
250 | endif |
||
251 | |||
252 | $(eval $(call BuildImage)) |