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 # Build the special D-Link DNS-313 header generator tool
11 # needed to generate the hard disk boot images then
12 # build D-Link DNS-313 images using the special header tool.
13 # rootfs.tgz and rd.tgz contains nothing, we only need them
14 # to satisfy the boot loader on the device. The zImage is
15 # the only real content.
16 define Build
/dns313-images
17 if
[ -d
$(BIN_DIR
)/.boot
] ; then
rm -rf
$(BIN_DIR
)/.boot
; fi
18 mkdir
-p
$(BIN_DIR
)/.boot
19 echo
"dummy" > $(BIN_DIR
)/.boot
/dummyfile
20 dns313-header
$(BIN_DIR
)/.boot
/dummyfile \
21 $(BIN_DIR
)/.boot
/rootfs.tgz
22 dns313-header
$(BIN_DIR
)/.boot
/dummyfile \
23 $(BIN_DIR
)/.boot
/rd.gz
24 dns313-header
$(IMAGE_KERNEL
) \
25 $(BIN_DIR
)/.boot
/zImage
26 rm -f
$(BIN_DIR
)/.boot
/dummyfile
27 (cd
$(BIN_DIR
); tar -czf
$(IMG_PREFIX
)-dns313-bootpart.
tar.gz .boot
)
28 if
[ -d
$(BIN_DIR
)/.boot
] ; then
rm -rf
$(BIN_DIR
)/.boot
; fi
31 # Create the special NAS4220B image format with the squashfs
32 # split across two "partitions" named rd.gz and hddapp.tgz but
33 # essentially just being used by OpenWRT as one big partition
34 define Build
/nas4220b-images
35 dd if
=$(IMAGE_ROOTFS
) of
=$(BIN_DIR
)/rd.gz bs
=6144k conv
=sync
36 dd if
=$(IMAGE_ROOTFS
) of
=$(BIN_DIR
)/hddapp.tgz bs
=6144k count
=1 seek
=1
37 cp
$(IMAGE_KERNEL
) $(BIN_DIR
)/zImage
38 cp .
/ImageInfo-ib4220
$(BIN_DIR
)/ImageInfo
39 (cd
$(BIN_DIR
); tar -czf
$(IMG_PREFIX
)-sysupgrade-ib4220b.
tar.gz ImageInfo zImage rd.gz hddapp.tgz
)
40 mv
$(BIN_DIR
)/rd.gz
$(BIN_DIR
)/$(IMG_PREFIX
)-nas4220b-rd.gz
41 mv
$(BIN_DIR
)/hddapp.tgz
$(BIN_DIR
)/$(IMG_PREFIX
)-nas4220b-hddapp.tgz
42 mv
$(BIN_DIR
)/zImage
$(BIN_DIR
)/$(IMG_PREFIX
)-nas4220b-zImage
43 rm -f
$(BIN_DIR
)/ImageInfo
46 # WBD-111 and WBD-222:
47 # work around the bootloader's bug with extra nops
48 # FIXME: is this really needed now that we no longer append the code
49 # to change the machine ID number? Needs testing on Wiliboard.
52 echo
-en
"\x00\x00\xa0\xe1\x00\x00\xa0\xe1\x00\x00\xa0\xe1\x00\x00\xa0\xe1" > $@
57 # All DTB files are prefixed with "gemini-"
59 DEVICE_DTS
:= $(patsubst %.dtb
,%,$(notdir $(wildcard $(if
$(IB
),$(KDIR
),$(DTS_DIR
))/*-$(1).dtb
)))
60 KERNEL_DEPENDS
= $$(wildcard $(DTS_DIR
)/$$(DEVICE_DTS
).dts
)
62 KERNEL
:= kernel-bin | append-dtb
63 FILESYSTEMS
:= squashfs
64 IMAGE_NAME
:= $$(IMAGE_PREFIX
)-$$(1).
$$(2)
69 # A reasonable set of default packages handling the NAS type
70 # of devices out of the box (former NAS42x0 IcyBox defaults)
71 GEMINI_NAS_PACKAGES
:=kmod-md-mod kmod-md-linear kmod-md-multipath \
72 kmod-md-raid0 kmod-md-raid1 kmod-md-raid10 kmod-md-raid456 \
73 kmod-fs-btrfs kmod-fs-cifs kmod-fs-ext4 kmod-fs-nfs \
74 kmod-fs-nfsd kmod-fs-ntfs kmod-fs-reiserfs kmod-fs-vfat \
75 kmod-nls-utf8 kmod-usb-storage-extras \
76 samba36-server mdadm cfdisk fdisk e2fsprogs badblocks
78 DIR685_CMDLINE
:=-console
=ttyS0
,19200n8 root
=/dev
/sda1 rw rootwait
79 define Device
/dlink-dir-685
80 DEVICE_TITLE
:= D-Link DIR-685 Xtreme N Storage Router
81 CMDLINE
:= $(DIR685_CMDLINE
)
82 DEVICE_PACKAGES
:= $(GEMINI_NAS_PACKAGES
)
84 TARGET_DEVICES
+= dlink-dir-685
86 DNS313_CMDLINE
:=-console
=ttyS0
,19200n8 root
=/dev
/sda4 rw rootwait
87 define Device
/dlink-dns-313
88 DEVICE_TITLE
:= D-Link DNS-313
1-Bay Network Storage Enclosure
89 CMDLINE
:= $(DNS313_CMDLINE
)
90 DEVICE_PACKAGES
:= $(GEMINI_NAS_PACKAGES
)
91 IMAGES
+= dns313-image
92 IMAGE
/dns313-image
:= dns313-images
94 TARGET_DEVICES
+= dlink-dns-313
96 define Device
/nas4220b
97 DEVICE_TITLE
:= Raidsonic NAS IB-4220-B
98 IMAGES
+= nas4220b-image
99 IMAGE
/nas4220b-image
:= nas4220b-images
100 DEVICE_PACKAGES
:= $(GEMINI_NAS_PACKAGES
)
102 TARGET_DEVICES
+= nas4220b
105 DEVICE_TITLE
:= Teltonika RUT1xx
106 DEVICE_PACKAGES
:= $(GEMINI_NAS_PACKAGES
)
108 TARGET_DEVICES
+= rut1xx
110 SQ201_CMDLINE
:=-console
=ttyS0
,115200n8
112 DEVICE_TITLE
:= ITian Square One SQ201
113 CMDLINE
:= $(SQ201_CMDLINE
)
114 DEVICE_PACKAGES
:= $(GEMINI_NAS_PACKAGES
) rt61-pci-firmware
116 TARGET_DEVICES
+= sq201
119 DEVICE_TITLE
:= Wiliboard WBD-111
120 KERNEL
:= kernel-bin | append-dtb | wbd-nops
122 TARGET_DEVICES
+= wbd111
125 DEVICE_TITLE
:= Wiliboard WBD-222
126 KERNEL
:= kernel-bin | append-dtb | wbd-nops
128 TARGET_DEVICES
+= wbd222
130 $(eval
$(call BuildImage
))