2 # Copyright (C) 2009-2018 OpenWrt.org
4 # This is free software, licensed under the GNU General Public License v2.
5 # See /LICENSE for more information.
7 include $(TOPDIR
)/rules.mk
8 include $(INCLUDE_DIR
)/image.mk
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
13 define Build
/dir685-image
17 -s wrgns01_dlwbr_dir685RBWW \
25 # Padding added after the rootfs to an even 128k boundary
26 # as this is 128k eraseblocks flash.
27 define Build
/dir685-pad-rootfs
28 $(STAGING_DIR_HOST
)/bin
/padjffs2
$(IMAGE_ROOTFS
) -c
128 >>$@
31 # Build D-Link DNS-313 images using the special header tool.
32 # rootfs.tgz and rd.tgz contains nothing, we only need them
33 # to satisfy the boot loader on the device. The zImage is
34 # the only real content.
35 define Build
/dns313-images
37 chmod
755 $@.tmp
/.boot
39 echo
"dummy" > $@.tmp
/dummyfile
41 dns313-header
$@.tmp
/dummyfile \
42 $@.tmp
/.boot
/rootfs.tgz
43 dns313-header
$@.tmp
/dummyfile \
45 dns313-header
$(IMAGE_KERNEL
) \
50 genext2fs
--block-size
$(BLOCKSIZE
:%k
=%Ki
) \
51 --size-in-blocks
$$((1024 * $(CONFIG_TARGET_KERNEL_PARTSIZE
))) \
53 --root
$@.tmp
$@.tmp-boot
55 # The device firmware needs revision 1 of EXT2
56 tune2fs
-O filetype
$@.tmp-boot
57 e2fsck
-pDf
$@.tmp-boot
> /dev
/null
59 .
/dns313_gen_hdd_img.sh
$@
$@.tmp-boot
$(IMAGE_ROOTFS
) \
60 $(CONFIG_TARGET_KERNEL_PARTSIZE
) \
61 $(CONFIG_TARGET_ROOTFS_PARTSIZE
)
66 define Build
/wiligear-image
67 $(STAGING_DIR_HOST
)/bin
/mkfwimage2 \
68 -m GEOS
-f
0x30000000 -z \
69 -v
$(1).v5.00.SL3512.OpenWrt
.00000.000000.000000 \
70 -p Kernel
:0x020000:0x100000:0:0:$(IMAGE_KERNEL
) \
71 -p Ramdisk
:0x120000:0x500000:0:0:$@ \
77 # Create the special NAS4220B and Itian Square One SQ201 image
78 # format with the squashfs and overlay inside the "rd.gz" file.
79 # We pad it out to 6144K which is the size of the initramfs partition.
81 # The "application" partition is just blank. You can put anything
82 # there when using OpenWRT. We just use that to create the
83 # "sysupgrade" firmware image.
84 define Build
/nas4220b-sq201-images
88 dd if
=/dev
/zero of
=$@.tmp
/hddapp.tgz bs
=6144k count
=1
89 cp
$(IMAGE_KERNEL
) $@.tmp
/zImage
90 cp .
/ImageInfo-
$(1) $@.tmp
/ImageInfo
92 sed
-i
-e
"s/DATESTR/`date +%Y%m%d $(if $(SOURCE_DATE_EPOCH),--date "@
$(SOURCE_DATE_EPOCH
)")`/g" $@.tmp
/ImageInfo
94 (cd
$@.tmp
; tar --sort=name
--owner
=0 --group
=0 --numeric-owner
-czf
$@
* \
95 $(if
$(SOURCE_DATE_EPOCH
),--mtime
="@$(SOURCE_DATE_EPOCH)"))
100 # WBD-111 and WBD-222:
101 # work around the bootloader's bug with extra nops
102 # FIXME: is this really needed now that we no longer append the code
103 # to change the machine ID number? Needs testing on Wiliboard.
104 define Build
/wbd-nops
106 echo
-en
"\x00\x00\xa0\xe1\x00\x00\xa0\xe1\x00\x00\xa0\xe1\x00\x00\xa0\xe1" > $@
111 # All DTB files are prefixed with "gemini-"
112 define Device
/Default
114 KERNEL_DEPENDS
= $$(wildcard $(DTS_DIR
)/$$(DEVICE_DTS
).dts
)
115 KERNEL_NAME
:= zImage
116 KERNEL
:= kernel-bin | append-dtb
118 SUPPORTED_DEVICES
:= $(subst _
,$(comma
),$(1))
121 # A reasonable set of default packages handling the NAS type
122 # of devices out of the box (former NAS42x0 IcyBox defaults)
123 GEMINI_NAS_PACKAGES
:=kmod-md-mod kmod-md-linear kmod-md-multipath \
124 kmod-md-raid0 kmod-md-raid1 kmod-md-raid10 kmod-md-raid456 \
125 kmod-fs-btrfs kmod-fs-cifs kmod-fs-nfs \
126 kmod-fs-nfsd kmod-fs-ntfs kmod-fs-reiserfs kmod-fs-vfat \
127 kmod-nls-utf8 kmod-usb-storage-extras \
128 samba36-server mdadm cfdisk fdisk e2fsprogs badblocks \
131 # The DIR-685 flash layout is kernel in WRGG format, padded and followed
132 # by the appended rootfs followed by some reasonable JFFS padding, the
133 # remainder will be used by JFFS2 through overlayfs.
135 # - For the factory image, the WRGG image includes the rootfs so that the
136 # default firmware will flash it properly as all it knows is WRGG format.
137 # - For the sysupgrade, we do not include the rootfs in the kernel image
138 # so it is not needelessly tossed into the RAM by the boot loader.
139 # This will be flashed from OpenWrt userland anyways so we only need
140 # the minimum to make the boot loader happy.
141 define Device
/dlink_dir-685
142 DEVICE_TITLE
:= D-Link DIR-685 Xtreme N Storage Router
143 DEVICE_DTS
:= gemini-dlink-dir-685
144 DEVICE_PACKAGES
:= $(GEMINI_NAS_PACKAGES
) \
146 IMAGES
:= factory.bin sysupgrade.bin
147 # Pad to 128k erase blocks with 160 bytes WRGG header
148 IMAGE
/factory.bin
:= append-kernel | pad-offset
128k
160 | append-rootfs | dir685-pad-rootfs | dir685-image
149 IMAGE
/sysupgrade.bin
:= append-kernel | pad-offset
128k
160 | dir685-image | append-rootfs | dir685-pad-rootfs | append-metadata
151 TARGET_DEVICES
+= dlink_dir-685
153 define Device
/dlink_dns-313
154 DEVICE_TITLE
:= D-Link DNS-313
1-Bay Network Storage Enclosure
155 DEVICE_DTS
:= gemini-dlink-dns-313
157 DEVICE_PACKAGES
:= $(GEMINI_NAS_PACKAGES
)
160 IMAGES
:= factory.bin.gz
161 IMAGE
/factory.bin.gz
:= dns313-images | gzip
163 TARGET_DEVICES
+= dlink_dns-313
165 define Device
/itian-raidsonic
166 IMAGES
:= factory.bin
167 IMAGE
/factory.bin
:= append-rootfs | pad-rootfs | pad-to
6144k | \
168 nas4220b-sq201-images
$(1)
169 DEVICE_PACKAGES
:= $(GEMINI_NAS_PACKAGES
)
172 define Device
/itian_sq201
173 $(Device
/itian-raidsonic
)
174 DEVICE_TITLE
:= ITian Square One SQ201
175 DEVICE_DTS
:= gemini-sq201
176 DEVICE_PACKAGES
+= kmod-rt61-pci kmod-usb2-pci
178 TARGET_DEVICES
+= itian_sq201
180 define Device
/raidsonic_ib-4220-b
181 $(Device
/itian-raidsonic
)
182 DEVICE_TITLE
:= Raidsonic NAS IB-4220-B
183 DEVICE_DTS
:= gemini-nas4220b
186 TARGET_DEVICES
+= raidsonic_ib-4220-b
188 # The wiliboard images need some changes to be functional and buildable.
190 # The dts would need to use the ecoscentric,redboot-fis-partitions partition
191 # parser to get the correct partition offsets and size.
193 # The mkfwimage2 call need to be adjusted to reflect the real size of kernel
194 # and rootfs. It is expected that the OEM firmware adjusts the on flash
195 # partition table with the values defined in the image header.
196 define Device
/wiliboard_wbd111
197 DEVICE_TITLE
:= Wiliboard WBD-111
198 DEVICE_DTS
:= gemini-wbd111
199 KERNEL
:= kernel-bin | append-dtb | wbd-nops
200 IMAGES
:= factory.bin
201 IMAGE
/factory.bin
:= append-rootfs | pad-rootfs | wiligear-image
"WILI-S.WILIBOARD"
204 define Device
/wiliboard_wbd222
205 DEVICE_TITLE
:= Wiliboard WBD-222
206 DEVICE_DTS
:= gemini-wbd222
207 KERNEL
:= kernel-bin | append-dtb | wbd-nops
208 IMAGES
:= factory.bin
209 IMAGE
/factory.bin
:= append-rootfs | pad-rootfs | wiligear-image
"WILI-S.WBD222"
212 $(eval
$(call BuildImage
))