7ad05844cc992899f5ee64e9814c86893ad15083
[openwrt/openwrt.git] / target / linux / oxnas / image / Makefile
1 #
2 # Copyright (C) 2013-2016 OpenWrt.org
3 #
4 # This is free software, licensed under the GNU General Public License v2.
5 # See /LICENSE for more information.
6 #
7
8 include $(TOPDIR)/rules.mk
9 include $(INCLUDE_DIR)/image.mk
10
11 UBIFS_OPTS = -m 2048 -e 126KiB -c 4096
12
13 DEVICE_VARS += DTS UBIFS_OPTS
14
15 KERNEL_LOADADDR := 0x60008000
16
17 define Build/ubootable
18 (dd if="$(KDIR)/u-boot.bin" bs=128k conv=sync; \
19 dd if="$@" bs=128k conv=sync ) >> $@.new
20 @mv "$@.new" "$@"
21 endef
22
23 define Device/Default
24 KERNEL_DEPENDS = $$(wildcard $$(DTS_DIR)/ox820-$$(DTS).dts)
25 KERNEL = kernel-bin | lzma | fit lzma $$(DTS_DIR)/ox820-$$(DTS).dtb
26 KERNEL_NAME := zImage
27 KERNEL_SUFFIX := -uImage
28 KERNEL_INSTALL := 1
29 KERNEL_INITRAMFS = kernel-bin | lzma | fit lzma $$(DTS_DIR)/ox820-$$(DTS).dtb | ubootable
30 KERNEL_INITRAMFS_PREFIX = $$(IMAGE_PREFIX)-u-boot-initramfs
31 KERNEL_INITRAMFS_SUFFIX := .bin
32 BLOCKSIZE := 128k
33 PAGESIZE := 2048
34 SUBPAGESIZE := 512
35 FILESYSTEMS := squashfs ubifs
36 PROFILES = Default $$(DTS)
37 IMAGES := ubinized.bin sysupgrade.tar
38 IMAGE/ubinized.bin := append-ubi
39 IMAGE/sysupgrade.tar := sysupgrade-tar | append-metadata
40 KERNEL_IN_UBI := 1
41 UBOOTENV_IN_UBI := 1
42 endef
43
44 define Device/akitio
45 DTS := akitio
46 DEVICE_TITLE := Akitio MyCloud mini / Silverstone DC01
47 DEVICE_PACKAGES := kmod-i2c-gpio kmod-rtc-ds1307
48 endef
49 TARGET_DEVICES += akitio
50
51 define Build/omninas-factory
52 rm -rf $@.tmp $@.dummy $@.dummy.gz
53 mkdir -p $@.tmp
54 $(CP) $@ $@.tmp/uImage
55 dd if=/dev/zero bs=64k count=4 of=$@.dummy
56 gzip $@.dummy
57 mkimage -A arm -T ramdisk -C gzip -n "dummy" \
58 -d $@.dummy.gz \
59 $@.tmp/rdimg.gz
60 echo 2.35.20140102 > $@.tmp/version ; echo >> $@.tmp/version
61 chmod 0744 $@.tmp/*
62 $(TAR) -C $@.tmp -czvf $@ \
63 $(if $(SOURCE_DATE_EPOCH),--mtime="@$(SOURCE_DATE_EPOCH)") .
64 endef
65
66 define Build/encrypt-3des
67 openssl enc -des3 -a -k $(1) -in $@ -out $@.new && mv $@.new $@
68 endef
69
70 define Device/kd20
71 DEVICE_DTS := ox820-kd20
72 DEVICE_TITLE := Shuttle KD20
73 KERNEL := kernel-bin | append-dtb | uImage none
74 KERNEL_INITRAMFS_PREFIX = $$(IMAGE_PREFIX)-factory
75 KERNEL_INITRAMFS_SUFFIX := .tar.gz
76 KERNEL_INITRAMFS = kernel-bin | append-dtb | uImage none | omninas-factory | encrypt-3des sohmuntitnlaes
77 KERNEL_IMAGE := zImage
78 DEVICE_PACKAGES := kmod-usb3 kmod-i2c-gpio kmod-rtc-pcf8563 kmod-gpio-beeper \
79 kmod-hwmon-core kmod-hwmon-gpiofan \
80 kmod-md-mod kmod-md-raid0 kmod-md-raid1 kmod-fs-ext4 kmod-fs-xfs
81 KERNEL_IN_UBI :=
82 UBOOTENV_IN_UBI :=
83 endef
84 TARGET_DEVICES += kd20
85
86 define Device/pogoplug-pro
87 DTS := pogoplug-pro
88 DEVICE_TITLE := Cloud Engines Pogoplug Pro (with mPCIe)
89 endef
90 TARGET_DEVICES += pogoplug-pro
91
92 define Device/pogoplug-v3
93 DTS := pogoplug-v3
94 DEVICE_TITLE := Cloud Engines Pogoplug V3 (no mPCIe)
95 endef
96 TARGET_DEVICES += pogoplug-v3
97
98 define Device/stg212
99 DTS := stg212
100 DEVICE_TITLE := MitraStar STG-212
101 endef
102 TARGET_DEVICES += stg212
103
104 VMLINUX:=$(BIN_DIR)/$(IMG_PREFIX)-vmlinux
105 UIMAGE:=$(BIN_DIR)/$(IMG_PREFIX)-uImage
106
107 $(eval $(call BuildImage))