gemini: add rtl8366rb to dir-685 board
[openwrt/openwrt.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 # 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
29 endef
30
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
44 endef
45
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.
50 define Build/wbd-nops
51 mv $@ $@.tmp
52 echo -en "\x00\x00\xa0\xe1\x00\x00\xa0\xe1\x00\x00\xa0\xe1\x00\x00\xa0\xe1" > $@
53 cat $@.tmp >> $@
54 rm -f $@.tmp
55 endef
56
57 # All DTB files are prefixed with "gemini-"
58 define Device/Default
59 DEVICE_DTS := $(patsubst %.dtb,%,$(notdir $(wildcard $(if $(IB),$(KDIR),$(DTS_DIR))/*-$(1).dtb)))
60 KERNEL_DEPENDS = $$(wildcard $(DTS_DIR)/$$(DEVICE_DTS).dts)
61 KERNEL_NAME := zImage
62 KERNEL := kernel-bin | append-dtb
63 FILESYSTEMS := squashfs
64 IMAGE_NAME := $$(IMAGE_PREFIX)-$$(1).$$(2)
65 BLOCKSIZE := 128k
66 PAGESIZE := 2048
67 endef
68
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
77
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) \
83 kmod-switch-rtl8366rb swconfig
84 endef
85 TARGET_DEVICES += dlink-dir-685
86
87 DNS313_CMDLINE:=-console=ttyS0,19200n8 root=/dev/sda4 rw rootwait
88 define Device/dlink-dns-313
89 DEVICE_TITLE := D-Link DNS-313 1-Bay Network Storage Enclosure
90 CMDLINE := $(DNS313_CMDLINE)
91 DEVICE_PACKAGES := $(GEMINI_NAS_PACKAGES)
92 IMAGES += dns313-image
93 IMAGE/dns313-image := dns313-images
94 endef
95 TARGET_DEVICES += dlink-dns-313
96
97 define Device/nas4220b
98 DEVICE_TITLE := Raidsonic NAS IB-4220-B
99 IMAGES += nas4220b-image
100 IMAGE/nas4220b-image := nas4220b-images
101 DEVICE_PACKAGES := $(GEMINI_NAS_PACKAGES)
102 endef
103 TARGET_DEVICES += nas4220b
104
105 define Device/rut1xx
106 DEVICE_TITLE := Teltonika RUT1xx
107 DEVICE_PACKAGES := $(GEMINI_NAS_PACKAGES)
108 endef
109 TARGET_DEVICES += rut1xx
110
111 SQ201_CMDLINE:=-console=ttyS0,115200n8
112 define Device/sq201
113 DEVICE_TITLE := ITian Square One SQ201
114 CMDLINE := $(SQ201_CMDLINE)
115 DEVICE_PACKAGES := $(GEMINI_NAS_PACKAGES) rt61-pci-firmware
116 endef
117 TARGET_DEVICES += sq201
118
119 define Device/wbd111
120 DEVICE_TITLE := Wiliboard WBD-111
121 KERNEL := kernel-bin | append-dtb | wbd-nops
122 endef
123 TARGET_DEVICES += wbd111
124
125 define Device/wbd222
126 DEVICE_TITLE := Wiliboard WBD-222
127 KERNEL := kernel-bin | append-dtb | wbd-nops
128 endef
129 TARGET_DEVICES += wbd222
130
131 $(eval $(call BuildImage))