OpenWrt – Diff between revs 2 and 3
?pathlinks?
Rev 2 | Rev 3 | |||
---|---|---|---|---|
Line 5... | Line 5... | |||
5 | # See /LICENSE for more information. |
5 | # See /LICENSE for more information. |
|
6 | # |
6 | # |
|
7 | include $(TOPDIR)/rules.mk |
7 | include $(TOPDIR)/rules.mk |
|
8 | include $(INCLUDE_DIR)/image.mk |
8 | include $(INCLUDE_DIR)/image.mk |
|
Line 9... | Line -... | |||
9 | |
- | ||
10 | # Cook a "WRGG" image, this board is apparently one in the D-Link |
9 | |
|
11 | # WRGG family and uses the exact same firmware format as other |
- | ||
12 | # D-Link devices. |
10 | # Just copy the zImage for D-Link DIR-685 |
|
13 | define Build/dir685-images |
- | ||
14 | mkwrggimg -i $(IMAGE_KERNEL) \ |
- | ||
15 | -o $@.new \ |
- | ||
16 | -d /dev/mtdblock/1 \ |
11 | define Build/dir685-images |
|
17 | -s wrgns01_dlwbr_dir685RBWW \ |
- | ||
18 | -v 'N/A' \ |
- | ||
19 | -m dir685 \ |
- | ||
20 | -B 96bb |
- | ||
21 | |
- | ||
22 | mv $@.new $@ |
12 | cp $(IMAGE_KERNEL) $(BIN_DIR)/$(IMG_PREFIX)-dir685-zImage |
|
Line 23... | Line 13... | |||
23 | endef |
13 | endef |
|
24 | |
14 | |
|
25 | # Build D-Link DNS-313 images using the special header tool. |
15 | # Build D-Link DNS-313 images using the special header tool. |
|
26 | # rootfs.tgz and rd.tgz contains nothing, we only need them |
16 | # rootfs.tgz and rd.tgz contains nothing, we only need them |
|
27 | # to satisfy the boot loader on the device. The zImage is |
17 | # to satisfy the boot loader on the device. The zImage is |
|
28 | # the only real content. |
18 | # the only real content. |
|
29 | define Build/dns313-images |
19 | define Build/dns313-images |
|
30 | mkdir -p $@.tmp/.boot |
- | ||
31 | chmod 755 $@.tmp/.boot |
20 | if [ -d $(BIN_DIR)/.boot ] ; then rm -rf $(BIN_DIR)/.boot ; fi |
|
32 | |
- | ||
33 | echo "dummy" > $@.tmp/dummyfile |
21 | mkdir -p $(BIN_DIR)/.boot |
|
34 | |
22 | echo "dummy" > $(BIN_DIR)/.boot/dummyfile |
|
35 | dns313-header $@.tmp/dummyfile \ |
23 | dns313-header $(BIN_DIR)/.boot/dummyfile \ |
|
36 | $@.tmp/.boot/rootfs.tgz |
24 | $(BIN_DIR)/.boot/rootfs.tgz |
|
37 | dns313-header $@.tmp/dummyfile \ |
25 | dns313-header $(BIN_DIR)/.boot/dummyfile \ |
|
38 | $@.tmp/.boot/rd.gz |
26 | $(BIN_DIR)/.boot/rd.gz |
|
39 | dns313-header $(IMAGE_KERNEL) \ |
- | ||
40 | $@.tmp/.boot/zImage |
27 | dns313-header $(IMAGE_KERNEL) \ |
|
41 | |
- | ||
42 | rm $@.tmp/dummyfile |
- | ||
43 | |
- | ||
44 | genext2fs --block-size $(BLOCKSIZE:%k=%Ki) \ |
- | ||
45 | --size-in-blocks $$((1024 * $(CONFIG_TARGET_KERNEL_PARTSIZE))) \ |
- | ||
46 | --squash-uids \ |
- | ||
47 | --root $@.tmp $@.tmp-boot |
- | ||
48 | |
- | ||
49 | # The device firmware needs revision 1 of EXT2 |
- | ||
50 | tune2fs -O filetype $@.tmp-boot |
- | ||
51 | e2fsck -pDf $@.tmp-boot > /dev/null |
28 | $(BIN_DIR)/.boot/zImage |
|
52 | |
- | ||
53 | ./dns313_gen_hdd_img.sh $@ $@.tmp-boot $(IMAGE_ROOTFS) \ |
- | ||
54 | $(CONFIG_TARGET_KERNEL_PARTSIZE) \ |
- | ||
55 | $(CONFIG_TARGET_ROOTFS_PARTSIZE) |
- | ||
56 | |
- | ||
57 | rm -rf $@.tmp |
- | ||
58 | endef |
- | ||
59 | |
- | ||
60 | define Build/wiligear-image |
- | ||
61 | $(STAGING_DIR_HOST)/bin/mkfwimage2 \ |
29 | rm -f $(BIN_DIR)/.boot/dummyfile |
|
62 | -m GEOS -f 0x30000000 -z \ |
- | ||
63 | -v $(1).v5.00.SL3512.OpenWrt.00000.000000.000000 \ |
- | ||
64 | -p Kernel:0x020000:0x100000:0:0:$(IMAGE_KERNEL) \ |
- | ||
65 | -p Ramdisk:0x120000:0x500000:0:0:$@ \ |
- | ||
66 | -o $@.new |
- | ||
67 | |
30 | (cd $(BIN_DIR); tar -czf $(IMG_PREFIX)-dns313-bootpart.tar.gz .boot) |
|
68 | mv $@.new $@ |
31 | if [ -d $(BIN_DIR)/.boot ] ; then rm -rf $(BIN_DIR)/.boot ; fi |
|
69 | endef |
32 | endef |
|
70 | |
33 | |
|
71 | # Create the special NAS4220B and Itian Square One SQ201 image |
34 | # Create the special NAS4220B image format with the squashfs |
|
72 | # format with the squashfs and overlay inside the "rd.gz" file. |
- | ||
73 | # We pad it out to 6144K which is the size of the initramfs partition. |
- | ||
74 | # |
- | ||
75 | # The "application" partition is just blank. You can put anything |
- | ||
76 | # there when using OpenWRT. We just use that to create the |
35 | # split across two "partitions" named rd.gz and hddapp.tgz but |
|
77 | # "sysupgrade" firmware image. |
- | ||
78 | define Build/nas4220b-sq201-images |
- | ||
79 | mkdir -p $@.tmp |
36 | # essentially just being used by OpenWRT as one big partition |
|
80 | |
37 | define Build/nas4220b-images |
|
81 | mv $@ $@.tmp/rd.gz |
38 | dd if=$(IMAGE_ROOTFS) of=$(BIN_DIR)/rd.gz bs=6144k conv=sync |
|
82 | dd if=/dev/zero of=$@.tmp/hddapp.tgz bs=6144k count=1 |
39 | dd if=$(IMAGE_ROOTFS) of=$(BIN_DIR)/hddapp.tgz bs=6144k count=1 seek=1 |
|
83 | cp $(IMAGE_KERNEL) $@.tmp/zImage |
- | ||
84 | cp ./ImageInfo-$(1) $@.tmp/ImageInfo |
40 | cp $(IMAGE_KERNEL) $(BIN_DIR)/zImage |
|
85 | |
- | ||
- | 41 | cp ./ImageInfo-ib4220 $(BIN_DIR)/ImageInfo |
||
86 | sed -i -e "s/DATESTR/`date +%Y%m%d $(if $(SOURCE_DATE_EPOCH),--date "@$(SOURCE_DATE_EPOCH)")`/g" $@.tmp/ImageInfo |
42 | (cd $(BIN_DIR); tar -czf $(IMG_PREFIX)-sysupgrade-ib4220b.tar.gz ImageInfo zImage rd.gz hddapp.tgz) |
|
87 | |
43 | mv $(BIN_DIR)/rd.gz $(BIN_DIR)/$(IMG_PREFIX)-nas4220b-rd.gz |
|
88 | (cd $@.tmp; tar --sort=name --owner=0 --group=0 --numeric-owner -czf $@ * \ |
- | ||
89 | $(if $(SOURCE_DATE_EPOCH),--mtime="@$(SOURCE_DATE_EPOCH)")) |
44 | mv $(BIN_DIR)/hddapp.tgz $(BIN_DIR)/$(IMG_PREFIX)-nas4220b-hddapp.tgz |
|
90 | |
45 | mv $(BIN_DIR)/zImage $(BIN_DIR)/$(IMG_PREFIX)-nas4220b-zImage |
|
Line 91... | Line 46... | |||
91 | rm -rf $@.tmp |
46 | rm -f $(BIN_DIR)/ImageInfo |
|
92 | endef |
47 | endef |
|
93 | |
48 | |
|
Line 102... | Line 57... | |||
102 | rm -f $@.tmp |
57 | rm -f $@.tmp |
|
103 | endef |
58 | endef |
|
Line 104... | Line 59... | |||
104 | |
59 | |
|
105 | # All DTB files are prefixed with "gemini-" |
60 | # All DTB files are prefixed with "gemini-" |
|
106 | define Device/Default |
61 | define Device/Default |
|
107 | PROFILES := Default |
62 | DEVICE_DTS := $(patsubst %.dtb,%,$(notdir $(wildcard $(if $(IB),$(KDIR),$(DTS_DIR))/*-$(1).dtb))) |
|
108 | KERNEL_DEPENDS = $$(wildcard $(DTS_DIR)/$$(DEVICE_DTS).dts) |
63 | KERNEL_DEPENDS = $$(wildcard $(DTS_DIR)/$$(DEVICE_DTS).dts) |
|
109 | KERNEL_NAME := zImage |
64 | KERNEL_NAME := zImage |
|
- | 65 | KERNEL := kernel-bin | append-dtb |
||
- | 66 | FILESYSTEMS := squashfs |
||
110 | KERNEL := kernel-bin | append-dtb |
67 | IMAGE_NAME := $$(IMAGE_PREFIX)-$$(1).$$(2) |
|
- | 68 | BLOCKSIZE := 128k |
||
111 | BLOCKSIZE := 128k |
69 | PAGESIZE := 2048 |
|
Line 112... | Line 70... | |||
112 | endef |
70 | endef |
|
113 | |
71 | |
|
114 | # A reasonable set of default packages handling the NAS type |
72 | # A reasonable set of default packages handling the NAS type |
|
115 | # of devices out of the box (former NAS42x0 IcyBox defaults) |
73 | # of devices out of the box (former NAS42x0 IcyBox defaults) |
|
116 | GEMINI_NAS_PACKAGES:=kmod-md-mod kmod-md-linear kmod-md-multipath \ |
74 | GEMINI_NAS_PACKAGES:=kmod-md-mod kmod-md-linear kmod-md-multipath \ |
|
117 | kmod-md-raid0 kmod-md-raid1 kmod-md-raid10 kmod-md-raid456 \ |
75 | kmod-md-raid0 kmod-md-raid1 kmod-md-raid10 kmod-md-raid456 \ |
|
118 | kmod-fs-btrfs kmod-fs-cifs kmod-fs-nfs \ |
76 | kmod-fs-btrfs kmod-fs-cifs kmod-fs-nfs \ |
|
119 | kmod-fs-nfsd kmod-fs-ntfs kmod-fs-reiserfs kmod-fs-vfat \ |
77 | kmod-fs-nfsd kmod-fs-ntfs kmod-fs-reiserfs kmod-fs-vfat \ |
|
120 | kmod-nls-utf8 kmod-usb-storage-extras \ |
- | ||
Line 121... | Line 78... | |||
121 | samba36-server mdadm cfdisk fdisk e2fsprogs badblocks \ |
78 | kmod-nls-utf8 kmod-usb-storage-extras \ |
|
122 | partx-utils |
79 | samba36-server mdadm cfdisk fdisk e2fsprogs badblocks |
|
123 | |
- | ||
124 | define Device/dlink_dir-685 |
80 | |
|
125 | DEVICE_TITLE := D-Link DIR-685 Xtreme N Storage Router |
81 | define Device/dlink-dir-685 |
|
126 | DEVICE_DTS := gemini-dlink-dir-685 |
- | ||
127 | DEVICE_PACKAGES := $(GEMINI_NAS_PACKAGES) \ |
82 | DEVICE_TITLE := D-Link DIR-685 Xtreme N Storage Router |
|
128 | kmod-switch-rtl8366rb swconfig \ |
83 | DEVICE_PACKAGES := $(GEMINI_NAS_PACKAGES) \ |
|
129 | kmod-rt2800-pci |
84 | kmod-switch-rtl8366rb swconfig |
|
130 | IMAGES := factory.bin |
85 | IMAGES += dir685-image |
|
Line 131... | Line 86... | |||
131 | IMAGE/factory.bin := dir685-images |
86 | IMAGE/dir685-image := dir685-images |
|
132 | endef |
87 | endef |
|
133 | TARGET_DEVICES += dlink_dir-685 |
- | ||
134 | |
88 | TARGET_DEVICES += dlink-dir-685 |
|
135 | define Device/dlink_dns-313 |
- | ||
136 | DEVICE_TITLE := D-Link DNS-313 1-Bay Network Storage Enclosure |
- | ||
137 | DEVICE_DTS := gemini-dlink-dns-313 |
89 | |
|
138 | DEVICE_PACKAGES := $(GEMINI_NAS_PACKAGES) |
90 | define Device/dlink-dns-313 |
|
139 | BLOCKSIZE := 1k |
91 | DEVICE_TITLE := D-Link DNS-313 1-Bay Network Storage Enclosure |
|
140 | FILESYSTEMS := ext4 |
92 | DEVICE_PACKAGES := $(GEMINI_NAS_PACKAGES) |
|
141 | IMAGES := factory.bin.gz |
93 | IMAGES += dns313-image |
|
142 | IMAGE/factory.bin.gz := dns313-images | gzip |
94 | IMAGE/dns313-image := dns313-images |
|
143 | endef |
95 | endef |
|
144 | TARGET_DEVICES += dlink_dns-313 |
96 | TARGET_DEVICES += dlink-dns-313 |
|
145 | |
97 | |
|
146 | define Device/itian-raidsonic |
98 | define Device/nas4220b |
|
147 | IMAGES := factory.bin |
99 | DEVICE_TITLE := Raidsonic NAS IB-4220-B |
|
- | 100 | IMAGES += nas4220b-image |
||
Line 148... | Line 101... | |||
148 | IMAGE/factory.bin := append-rootfs | pad-rootfs | pad-to 6144k | \ |
101 | IMAGE/nas4220b-image := nas4220b-images |
|
149 | nas4220b-sq201-images $(1) |
- | ||
150 | DEVICE_PACKAGES := $(GEMINI_NAS_PACKAGES) |
102 | DEVICE_PACKAGES := $(GEMINI_NAS_PACKAGES) |
|
151 | endef |
- | ||
152 | |
103 | endef |
|
153 | define Device/itian_sq201 |
104 | TARGET_DEVICES += nas4220b |
|
154 | $(Device/itian-raidsonic) |
105 | |
|
Line 155... | Line 106... | |||
155 | DEVICE_TITLE := ITian Square One SQ201 |
106 | define Device/rut1xx |
|
156 | DEVICE_DTS := gemini-sq201 |
- | ||
157 | DEVICE_PACKAGES += kmod-rt61-pci kmod-usb2-pci |
107 | DEVICE_TITLE := Teltonika RUT1xx |
|
158 | endef |
108 | DEVICE_PACKAGES := $(GEMINI_NAS_PACKAGES) |
|
159 | TARGET_DEVICES += itian_sq201 |
109 | endef |
|
160 | |
110 | TARGET_DEVICES += rut1xx |
|
Line 161... | Line -... | |||
161 | define Device/raidsonic_ib-4220-b |
- | ||
162 | $(Device/itian-raidsonic) |
- | ||
163 | DEVICE_TITLE := Raidsonic NAS IB-4220-B |
- | ||
164 | DEVICE_DTS := gemini-nas4220b |
- | ||
165 | endef |
- | ||
166 | TARGET_DEVICES += raidsonic_ib-4220-b |
- | ||
167 | |
- | ||
168 | # The wiliboard images need some changes to be functional and buildable. |
- | ||
169 | # |
111 | |
|
170 | # The dts would need to use the ecoscentric,redboot-fis-partitions partition |
112 | define Device/sq201 |
|
171 | # parser to get the correct partition offsets and size. |
- | ||
172 | # |
113 | DEVICE_TITLE := ITian Square One SQ201 |
|
173 | # The mkfwimage2 call need to be adjusted to reflect the real size of kernel |
- | ||
174 | # and rootfs. It is expected that the OEM firmware adjusts the on flash |
- | ||
175 | # partition table with the values defined in the image header. |
114 | DEVICE_PACKAGES := $(GEMINI_NAS_PACKAGES) rt61-pci-firmware |
|
- | 115 | endef |
||
Line 176... | Line 116... | |||
176 | define Device/wiliboard_wbd111 |
116 | TARGET_DEVICES += sq201 |
|
177 | DEVICE_TITLE := Wiliboard WBD-111 |
117 | |
|
178 | DEVICE_DTS := gemini-wbd111 |
- | ||
179 | KERNEL := kernel-bin | append-dtb | wbd-nops |
118 | define Device/wbd111 |
|
180 | IMAGES := factory.bin |
- | ||
181 | IMAGE/factory.bin := append-rootfs | pad-rootfs | wiligear-image "WILI-S.WILIBOARD" |
- | ||
182 | endef |
119 | DEVICE_TITLE := Wiliboard WBD-111 |
|
- | 120 | KERNEL := kernel-bin | append-dtb | wbd-nops |
||
Line 183... | Line 121... | |||
183 | |
121 | endef |