gemini: Name binary "bootpart.tar.gz"
[openwrt/staging/wigyori.git] / target / linux / gemini / image / Makefile
1 #
2 # Copyright (C) 2009-2018 OpenWrt.org
3 #
4 # This is free software, licensed under the GNU General Public License v2.
5 # See /LICENSE for more information.
6 #
7 include $(TOPDIR)/rules.mk
8 include $(INCLUDE_DIR)/image.mk
9
10 # Cook a "WRGG" image, this board is apparently one in the D-Link
11 # WRGG family and uses the exact same firmware format as other
12 # D-Link devices.
13 define Build/dir685-images
14 mkwrggimg -i $(IMAGE_KERNEL) \
15 -o $@.new \
16 -d /dev/mtdblock/1 \
17 -s wrgns01_dlwbr_dir685RBWW \
18 -v 'N/A' \
19 -m dir685 \
20 -B 96bb
21
22 mv $@.new $@
23 endef
24
25 # Build D-Link DNS-313 images using the special header tool.
26 # rootfs.tgz and rd.tgz contains nothing, we only need them
27 # to satisfy the boot loader on the device. The zImage is
28 # the only real content.
29 define Build/dns313-images
30 mkdir -p $@.tmp/.boot
31
32 echo "dummy" > $@.tmp/dummyfile
33
34 dns313-header $@.tmp/dummyfile \
35 $@.tmp/.boot/rootfs.tgz
36 dns313-header $@.tmp/dummyfile \
37 $@.tmp/.boot/rd.gz
38 dns313-header $(IMAGE_KERNEL) \
39 $@.tmp/.boot/zImage
40
41 tar --sort=name --owner=0 --group=0 --numeric-owner -czf $@ \
42 -C $@.tmp .boot \
43 $(if $(SOURCE_DATE_EPOCH),--mtime="@$(SOURCE_DATE_EPOCH)")
44
45 rm -rf $@.tmp
46 endef
47
48 define Build/wiligear-image
49 $(STAGING_DIR_HOST)/bin/mkfwimage2 \
50 -m GEOS -f 0x30000000 -z \
51 -v $(1).v5.00.SL3512.OpenWrt.00000.000000.000000 \
52 -p Kernel:0x020000:0x100000:0:0:$(IMAGE_KERNEL) \
53 -p Ramdisk:0x120000:0x500000:0:0:$@ \
54 -o $@.new
55
56 mv $@.new $@
57 endef
58
59 # Create the special NAS4220B and Itian Square One SQ201 image
60 # format with the squashfs and overlay inside the "rd.gz" file.
61 # We pad it out to 6144K which is the size of the initramfs partition.
62 #
63 # The "application" partition is just blank. You can put anything
64 # there when using OpenWRT. We just use that to create the
65 # "sysupgrade" firmware image.
66 define Build/nas4220b-sq201-images
67 mkdir -p $@.tmp
68
69 mv $@ $@.tmp/rd.gz
70 dd if=/dev/zero of=$@.tmp/hddapp.tgz bs=6144k count=1
71 cp $(IMAGE_KERNEL) $@.tmp/zImage
72 cp ./ImageInfo-$(1) $@.tmp/ImageInfo
73
74 sed -i -e "s/DATESTR/`date +%Y%m%d $(if $(SOURCE_DATE_EPOCH),--date "@$(SOURCE_DATE_EPOCH)")`/g" $@.tmp/ImageInfo
75
76 (cd $@.tmp; tar --sort=name --owner=0 --group=0 --numeric-owner -czf $@ * \
77 $(if $(SOURCE_DATE_EPOCH),--mtime="@$(SOURCE_DATE_EPOCH)"))
78
79 rm -rf $@.tmp
80 endef
81
82 # WBD-111 and WBD-222:
83 # work around the bootloader's bug with extra nops
84 # FIXME: is this really needed now that we no longer append the code
85 # to change the machine ID number? Needs testing on Wiliboard.
86 define Build/wbd-nops
87 mv $@ $@.tmp
88 echo -en "\x00\x00\xa0\xe1\x00\x00\xa0\xe1\x00\x00\xa0\xe1\x00\x00\xa0\xe1" > $@
89 cat $@.tmp >> $@
90 rm -f $@.tmp
91 endef
92
93 # All DTB files are prefixed with "gemini-"
94 define Device/Default
95 PROFILES := Default
96 KERNEL_DEPENDS = $$(wildcard $(DTS_DIR)/$$(DEVICE_DTS).dts)
97 KERNEL_NAME := zImage
98 KERNEL := kernel-bin | append-dtb
99 BLOCKSIZE := 128k
100 endef
101
102 # A reasonable set of default packages handling the NAS type
103 # of devices out of the box (former NAS42x0 IcyBox defaults)
104 GEMINI_NAS_PACKAGES:=kmod-md-mod kmod-md-linear kmod-md-multipath \
105 kmod-md-raid0 kmod-md-raid1 kmod-md-raid10 kmod-md-raid456 \
106 kmod-fs-btrfs kmod-fs-cifs kmod-fs-nfs \
107 kmod-fs-nfsd kmod-fs-ntfs kmod-fs-reiserfs kmod-fs-vfat \
108 kmod-nls-utf8 kmod-usb-storage-extras \
109 samba36-server mdadm cfdisk fdisk e2fsprogs badblocks
110
111 define Device/dlink_dir-685
112 DEVICE_TITLE := D-Link DIR-685 Xtreme N Storage Router
113 DEVICE_DTS := gemini-dlink-dir-685
114 DEVICE_PACKAGES := $(GEMINI_NAS_PACKAGES) \
115 kmod-switch-rtl8366rb swconfig \
116 kmod-rt2800-pci
117 IMAGES := factory.bin
118 IMAGE/factory.bin := dir685-images
119 endef
120 TARGET_DEVICES += dlink_dir-685
121
122 define Device/dlink_dns-313
123 DEVICE_TITLE := D-Link DNS-313 1-Bay Network Storage Enclosure
124 DEVICE_DTS := gemini-dlink-dns-313
125 DEVICE_PACKAGES := $(GEMINI_NAS_PACKAGES)
126 IMAGES := bootpart.tar.gz
127 IMAGE/bootpart.tar.gz := dns313-images
128 endef
129 TARGET_DEVICES += dlink_dns-313
130
131 define Device/itian-raidsonic
132 IMAGES := factory.bin
133 IMAGE/factory.bin := append-rootfs | pad-rootfs | pad-to 6144k | \
134 nas4220b-sq201-images $(1)
135 DEVICE_PACKAGES := $(GEMINI_NAS_PACKAGES)
136 endef
137
138 define Device/itian_sq201
139 $(Device/itian-raidsonic)
140 DEVICE_TITLE := ITian Square One SQ201
141 DEVICE_DTS := gemini-sq201
142 DEVICE_PACKAGES += kmod-rt61-pci kmod-usb2-pci
143 endef
144 TARGET_DEVICES += itian_sq201
145
146 define Device/raidsonic_ib-4220-b
147 $(Device/itian-raidsonic)
148 DEVICE_TITLE := Raidsonic NAS IB-4220-B
149 DEVICE_DTS := gemini-nas4220b
150 endef
151 TARGET_DEVICES += raidsonic_ib-4220-b
152
153 # The wiliboard images need some changes to be functional and buildable.
154 #
155 # The dts would need to use the ecoscentric,redboot-fis-partitions partition
156 # parser to get the correct partition offsets and size.
157 #
158 # The mkfwimage2 call need to be adjusted to reflect the real size of kernel
159 # and rootfs. It is expected that the OEM firmware adjusts the on flash
160 # partition table with the values defined in the image header.
161 define Device/wiliboard_wbd111
162 DEVICE_TITLE := Wiliboard WBD-111
163 DEVICE_DTS := gemini-wbd111
164 KERNEL := kernel-bin | append-dtb | wbd-nops
165 IMAGES := factory.bin
166 IMAGE/factory.bin := append-rootfs | pad-rootfs | wiligear-image "WILI-S.WILIBOARD"
167 endef
168
169 define Device/wiliboard_wbd222
170 DEVICE_TITLE := Wiliboard WBD-222
171 DEVICE_DTS := gemini-wbd222
172 KERNEL := kernel-bin | append-dtb | wbd-nops
173 IMAGES := factory.bin
174 IMAGE/factory.bin := append-rootfs | pad-rootfs | wiligear-image "WILI-S.WBD222"
175 endef
176
177 $(eval $(call BuildImage))