5577b16238521a92f93d81072877dab5a4998bbe
[oweals/openwrt.git] / target / linux / layerscape / image / Makefile
1 #
2 # Copyright (C) 2016 Jiang Yutang <jiangyutang1978@gmail.com>
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 define Build/append-ls-rcw
11         rm -f $@
12         dd if=$(STAGING_DIR_IMAGE)/$(1)-rcw.bin >> $@
13 endef
14
15 define Build/append-ls-uboot
16         dd if=$(STAGING_DIR_IMAGE)/$(1)-$(SUBTARGET)-uboot.bin >> $@
17 endef
18
19 define Build/append-ls-fman
20         dd if=$(STAGING_DIR_IMAGE)/$(1)-fman.bin >> $@
21 endef
22
23 define Build/append-ls-dtb
24         $(call Image/BuildDTB,$(DTS_DIR)/$(1).dts,$(DTS_DIR)/$(1).dtb)
25         dd if=$(DTS_DIR)/$(1).dtb >> $@
26 endef
27
28 define Build/append-ls-rootfs-ext4
29         $(STAGING_DIR_HOST)/bin/make_ext4fs -l $(word 2,$(1)) -b 4096 -i 6000 -m 0 -J $(KDIR)/$(word 1,$(1))-$(word 2,$(1)).root.ext4 $(TARGET_DIR)
30         dd if=$(KDIR)/$(word 1,$(1))-$(word 2,$(1)).root.ext4 >> $@
31 endef
32
33 define Device/Default
34   PROFILES = Default
35   FILESYSTEMS := squashfs
36   DEVICE_DTS :=
37   IMAGES = firmware.bin
38
39 ifeq ($(SUBTARGET),armv8_64b)
40   KERNEL := kernel-bin | gzip | uImage gzip
41   KERNEL_LOADADDR = 0x80080000
42   KERNEL_ENTRY_POINT = 0x80080000
43 endif
44 ifeq ($(SUBTARGET),armv8_32b)
45   KERNEL := kernel-bin | uImage none
46   KERNEL_NAME := zImage
47   KERNEL_LOADADDR = 0x80008000
48   KERNEL_ENTRY_POINT = 0x80008000
49 endif
50 endef
51
52 define Device/ls1043ardb
53   DEVICE_TITLE := ls1043ardb-$(SUBTARGET)
54   DEVICE_PACKAGES += rcw-layerscape-ls1043ardb uboot-layerscape-$(SUBTARGET)-ls1043ardb fman-layerscape-ls1043ardb
55   DEVICE_DTS = ../../../arm64/boot/dts/freescale/fsl-ls1043a-rdb-sdk
56   IMAGE/firmware.bin =  append-ls-rcw $(1) | pad-to 1M | \
57                         append-ls-uboot $(1) | pad-to 9M | \
58                         append-ls-fman $(1) | pad-to 15M | \
59                         append-ls-dtb $$(DEVICE_DTS) | pad-to 16M | \
60                         append-kernel | pad-to 32M | \
61                         append-rootfs | pad-rootfs | check-size 67108865
62 endef
63 TARGET_DEVICES += ls1043ardb
64
65 define Device/ls1046ardb
66   DEVICE_TITLE := ls1046ardb-$(SUBTARGET)
67   DEVICE_PACKAGES += rcw-layerscape-ls1046ardb uboot-layerscape-$(SUBTARGET)-ls1046ardb fman-layerscape-ls1046ardb
68   DEVICE_DTS = ../../../arm64/boot/dts/freescale/fsl-ls1046a-rdb-sdk
69   IMAGE/firmware.bin =  append-ls-rcw $(1) | pad-to 1M | \
70                         append-ls-uboot $(1) | pad-to 9M | \
71                         append-ls-fman $(1) | pad-to 15M | \
72                         append-ls-dtb $$(DEVICE_DTS) | pad-to 16M | \
73                         append-kernel | pad-to 32M | \
74                         append-ls-rootfs-ext4 $(1) 22M | check-size 67108865
75 endef
76 TARGET_DEVICES += ls1046ardb
77
78 define Device/ls1012ardb
79   DEVICE_TITLE := ls1012ardb-$(SUBTARGET)
80   DEVICE_PACKAGES += rcw-layerscape-ls1012ardb uboot-layerscape-$(SUBTARGET)-ls1012ardb kmod-ppfe ppfe-ls1012ardb
81   DEVICE_DTS = ../../../arm64/boot/dts/freescale/fsl-ls1012a-rdb
82   IMAGE/firmware.bin =  append-ls-rcw $(1) | pad-to 1M | \
83                         append-ls-uboot $(1) | pad-to 15M | \
84                         append-ls-dtb $$(DEVICE_DTS) | pad-to 16M | \
85                         append-kernel | pad-to 32M | \
86                         append-ls-rootfs-ext4 $(1) 23M | check-size 67108865
87 endef
88 TARGET_DEVICES += ls1012ardb
89
90 ifeq ($(SUBTARGET),armv8_64b)
91 define Device/ls1088ardb
92   DEVICE_TITLE := ls1088ardb-$(SUBTARGET)
93   DEVICE_PACKAGES += rcw-layerscape-ls1088ardb uboot-layerscape-$(SUBTARGET)-ls1088ardb mc-binary-ls1088ardb
94   DEVICE_DTS = ../../../arm64/boot/dts/freescale/fsl-ls1088a-rdb
95   IMAGE/firmware.bin =  append-ls-dtb $$(DEVICE_DTS) | pad-to 1M | \
96                         append-kernel | pad-to 17M | \
97                         append-ls-rootfs-ext4 $(1) 17M | check-size 51380225
98 endef
99 TARGET_DEVICES += ls1088ardb
100
101 define Device/ls2088ardb
102   DEVICE_TITLE := ls2088ardb-$(SUBTARGET)
103   DEVICE_PACKAGES += rcw-layerscape-ls2088ardb uboot-layerscape-$(SUBTARGET)-ls2088ardb mc-binary-ls2088ardb
104   DEVICE_DTS = ../../../arm64/boot/dts/freescale/fsl-ls2088a-rdb
105   IMAGE/firmware.bin =  append-ls-dtb $$(DEVICE_DTS) | pad-to 1M | \
106                         append-kernel | pad-to 17M | \
107                         append-rootfs | pad-rootfs | check-size 51380225
108 endef
109 TARGET_DEVICES += ls2088ardb
110 endif
111
112 $(eval $(call BuildImage))