remove duplicate package
[openadk.git] / target / arm / Makefile
blobd6dab6af0dc84e54bd002e5b2ecd41d14eb11d34
1 # This file is part of the OpenADK project. OpenADK is copyrighted
2 # material, please see the LICENCE file in the top-level directory.
4 include $(ADK_TOPDIR)/rules.mk
5 include $(ADK_TOPDIR)/mk/kernel-build.mk
6 include $(ADK_TOPDIR)/mk/image.mk
8 KERNEL:=$(LINUX_DIR)/$(ADK_TARGET_KERNEL)
9 ifeq ($(ADK_TARGET_KERNEL_ZIMAGE),y)
10 KERNEL:=$(LINUX_DIR)/arch/arm/boot/zImage
11 endif
12 ifeq ($(ADK_TARGET_KERNEL_UIMAGE),y)
13 KERNEL:=$(LINUX_DIR)/arch/arm/boot/uImage
14 endif
15 ifeq ($(ADK_TARGET_KERNEL_XIPIMAGE),y)
16 KERNEL:=$(LINUX_DIR)/arch/arm/boot/xipImage
17 endif
18 ifeq ($(ADK_TARGET_KERNEL_IMAGE),y)
19 KERNEL:=$(LINUX_DIR)/arch/arm/boot/Image
20 endif
22 QEMU_ARGS:=${ADK_QEMU_ARGS}
23 ifeq ($(ADK_TARGET_SYSTEM_QEMU_ARM_XILINX_ZYNQ),y)
24 QEMU_ARGS+=-M xilinx-zynq-a9 -dtb $(FW_DIR)/zynq-zc702.dtb -serial null -serial mon:stdio
25 endif
26 ifeq ($(ADK_TARGET_SYSTEM_QEMU_ARM_SPITZ),y)
27 QEMU_ARGS+=-M spitz
28 endif
29 ifeq ($(ADK_TARGET_SYSTEM_QEMU_ARM_TERRIER),y)
30 QEMU_ARGS+=-M terrier
31 endif
32 ifeq ($(ADK_TARGET_SYSTEM_QEMU_ARM_REALVIEW_EB_MPCORE),y)
33 QEMU_ARGS+=-M realview-eb-mpcore -net user -net nic -dtb $(FW_DIR)/arm-realview-eb-11mp-ctrevb.dtb
34 endif
35 ifeq ($(ADK_TARGET_SYSTEM_QEMU_ARM_VERSATILEPB),y)
36 QEMU_ARGS+=-M versatilepb -m 256 -net user -net nic,model=smc91c111 -dtb $(FW_DIR)/versatile-pb.dtb
37 endif
38 ifeq ($(ADK_TARGET_SYSTEM_QEMU_ARM_VEXPRESS_A9),y)
39 QEMU_ARGS+=-M vexpress-a9 -cpu cortex-a9 -m 256 -net user -net nic,model=lan9118 -dtb $(FW_DIR)/vexpress-v2p-ca9.dtb
40 ifeq ($(ADK_TARGET_ROOTFS_ARCHIVE),y)
41 QEMU_ARGS+=-drive file=qemu-arm.img,if=sd,format=raw
42 endif
43 endif
44 ifeq ($(ADK_TARGET_QEMU_WITH_VIRTIO),y)
45 QEMU_ARGS+=-drive file=qemu-${ADK_TARGET_CPU_ARCH}.img,if=virtio,index=0 -net nic,model=virtio -net user
46 endif
48 # target helper text
49 ifeq ($(ADK_TARGET_FS),archive)
50 targethelp:
51 @echo "#################################################"
52 @echo "The RootFS tarball is: $(FW_DIR)/$(ROOTFSTARBALL)"
53 ifeq ($(ADK_TARGET_SYSTEM_QEMU_ARM_VEXPRESS_A9)$(ADK_TARGET_SYSTEM_QEMU_ARM_VERSATILEPB)$(ADK_TARGET_SYSTEM_QEMU_ARM_TERRIER)$(ADK_TARGET_SYSTEM_QEMU_ARM_SPITZ),y)
54 @echo 'The kernel file is: $(FW_DIR)/${TARGET_KERNEL}'
55 @echo "Use following command to create a QEMU Image:"
56 @echo "./scripts/create.sh qemu-${ADK_TARGET_CPU_ARCH}.img $(FW_DIR)/$(ROOTFSTARBALL)"
57 @echo "Start qemu with following options:"
58 @echo 'qemu-system-${ADK_TARGET_CPU_ARCH} ${QEMU_ARGS} -kernel $(FW_DIR)/$(TARGET_KERNEL) qemu-${ADK_TARGET_CPU_ARCH}.img'
59 endif
60 ifeq ($(ADK_TARGET_BOARD_BCM28XX)$(ADK_TARGET_SYSTEM_SOLIDRUN_IMX6)$(ADK_TARGET_SYSTEM_SOLIDRUN_CLEARFOG),y)
61 ifeq ($(ADK_RUNTIME_DATA_PARTITION),y)
62 @echo "Use following command to install with a writable data partition"
63 @echo "sudo ./scripts/install.sh -d 256 $(ADK_TARGET_SYSTEM) /dev/sdX $(FW_DIR)/$(ROOTFSTARBALL)"
64 @echo "If you want to update a card without loosing existing data on the writable partition use:"
65 @echo "sudo ./scripts/install.sh -k -d 256 $(ADK_TARGET_SYSTEM) /dev/sdX $(FW_DIR)/$(ROOTFSTARBALL)"
66 @echo "In both cases the cfgfs partition is _not_ removed!"
67 else
68 @echo "Use following command to install it on SD card:"
69 @echo "sudo ./scripts/install.sh $(ADK_TARGET_SYSTEM) /dev/sdX $(FW_DIR)/$(ROOTFSTARBALL)"
70 endif
71 endif
72 ifeq ($(ADK_TARGET_SYSTEM_PHYTEC_WEGA),y)
73 @echo "Use following command to install it on SD card:"
74 @echo "sudo ./scripts/install.sh phytec-wega /dev/sdX $(FW_DIR)/$(ROOTFSTARBALL)"
75 @echo "Use following command to install with a writable data partition"
76 @echo "sudo ./scripts/install.sh -d 256 phytec-wega /dev/sdX $(FW_DIR)/$(ROOTFSTARBALL)"
77 @echo
78 @echo "To boot from SD card do following in barebox bootloader:"
79 @echo "mount /dev/mmc0.0 /mnt"
80 @echo "bootm -o /mnt/am335x-wega-rdk.dtb /mnt/kernel"
81 @echo
82 endif
83 ifeq ($(ADK_TARGET_SYSTEM_PHYTEC_IMX6),y)
84 @echo "Use following command to install it on SD card:"
85 @echo "sudo ./scripts/install.sh phytec-imx6 /dev/sdX $(FW_DIR)/$(ROOTFSTARBALL)"
86 @echo
87 endif
88 ifeq ($(ADK_TARGET_SYSTEM_BANANA_PRO),y)
89 @echo "Use following command to install it on SD card:"
90 @echo "sudo ./scripts/install.sh banana-pro /dev/sdX $(FW_DIR)/$(ROOTFSTARBALL)"
91 @echo "Use following command to install with a writable data partition"
92 @echo "sudo ./scripts/install.sh -d 256 banana-pro /dev/sdX $(FW_DIR)/$(ROOTFSTARBALL)"
93 endif
94 ifeq ($(ADK_TARGET_SYSTEM_BANANA_P2_ZERO),y)
95 @echo "Use following command to install it on SD card:"
96 @echo "sudo ./scripts/install.sh banana-pro-zero /dev/sdX $(FW_DIR)/$(ROOTFSTARBALL)"
97 @echo "Use following command to install with a writable data partition"
98 @echo "sudo ./scripts/install.sh -d 256 banana-pro-zero /dev/sdX $(FW_DIR)/$(ROOTFSTARBALL)"
99 endif
100 ifeq ($(ADK_TARGET_SYSTEM_ORANGE_PI0),y)
101 @echo "Use following command to install it on SD card:"
102 @echo "sudo ./scripts/install.sh orange-pi0 /dev/sdX $(FW_DIR)/$(ROOTFSTARBALL)"
103 @echo "Use following command to install with a writable data partition"
104 @echo "sudo ./scripts/install.sh -d 256 orange-pi0 /dev/sdX $(FW_DIR)/$(ROOTFSTARBALL)"
105 endif
106 endif
107 ifeq ($(ADK_TARGET_FS),initramfs)
108 targethelp:
109 @echo 'The kernel file is: $(FW_DIR)/${TARGET_KERNEL}'
110 @echo 'The initramfs image is: ${FW_DIR}/${INITRAMFS}'
111 ifeq ($(ADK_TARGET_QEMU),y)
112 @echo "Start qemu with following command line:"
113 @echo 'qemu-system-arm ${QEMU_ARGS} -kernel $(FW_DIR)/$(TARGET_KERNEL) -initrd ${FW_DIR}/${INITRAMFS}'
114 endif
115 endif
116 ifeq ($(ADK_TARGET_FS),initramfsarchive)
117 targethelp:
118 @echo 'The kernel file is: $(FW_DIR)/${TARGET_KERNEL}'
119 @echo "The RootFS tarball is: $(FW_DIR)/$(ROOTFSUSERTARBALL)"
120 endif
121 ifeq ($(ADK_TARGET_FS),initramfspiggyback)
122 targethelp:
123 @echo 'The kernel+initramfs file is: $(FW_DIR)/${TARGET_KERNEL}'
124 ifeq ($(ADK_TARGET_QEMU),y)
125 @echo "Start qemu with following command line:"
126 @echo 'qemu-system-arm ${QEMU_ARGS} -kernel $(FW_DIR)/$(TARGET_KERNEL)'
127 endif
128 endif
129 ifeq ($(ADK_TARGET_FS),nfsroot)
130 targethelp:
131 @echo 'The kernel file is: $(FW_DIR)/${TARGET_KERNEL}'
132 @echo "The RootFS tarball is: $(FW_DIR)/$(ROOTFSUSERTARBALL)"
133 ifeq ($(ADK_TARGET_SYSTEM_LINKSYS_NSLU2),y)
134 @echo "Use following in RedBoot bootloader:"
135 @echo "RedBoot> ip_address -l <localip> -h <serverip>; load -r -v -b 0x01d00000 ${TARGET_KERNEL}; exec 0x01d00000"
136 endif
137 endif
138 ifeq ($(ADK_TARGET_FS),squashfs)
139 targethelp:
140 @echo 'The kernel file is: $(FW_DIR)/${TARGET_KERNEL}'
141 @echo "The RootFS image is: $(FW_DIR)/$(ROOTFSSQUASHFS)"
142 ifeq ($(ADK_TARGET_QEMU),y)
143 @echo "Start qemu with following options:"
144 @echo 'qemu-system-arm $(QEMU_ARGS) -nographic -kernel $(FW_DIR)/$(TARGET_KERNEL) $(FW_DIR)/$(ROOTFSSQUASHFS)'
145 endif
146 endif
147 ifeq ($(ADK_TARGET_FS),jffs2)
148 targethelp:
149 @echo 'The kernel file is: $(FW_DIR)/${TARGET_KERNEL}'
150 @echo "The RootFS image is: $(FW_DIR)/$(ROOTFSJFFS2)"
151 ifeq ($(ADK_TARGET_QEMU),y)
152 @echo "Start qemu with following options:"
153 @echo 'qemu-system-arm $(QEMU_ARGS) -nographic -kernel $(FW_DIR)/$(TARGET_KERNEL) $(FW_DIR)/$(ROOTFSJFFS2)'
154 endif
155 endif
156 ifeq ($(ADK_TARGET_FS),genimage)
157 targethelp:
158 @echo "The disk image is: $(FW_DIR)/sdcard.img"
159 @echo "Use following command to install it on SD card:"
160 @echo 'sudo dd if=$(FW_DIR)/sdcard.img of=/dev/sdX bs=2048k'
161 endif
163 kernel-strip:
164 ifeq ($(ADK_TARGET_KERNEL_GIT_REPO_NAME),rpi)
165 @echo adding DT trailer to kernel $(MAKE_TRACE)
166 PATH='$(HOST_PATH)' perl $(LINUX_DIR)/scripts/mkknlimg $(KERNEL) $(BUILD_DIR)/$(TARGET_KERNEL) $(MAKE_TRACE)
167 else
168 @cp $(KERNEL) $(BUILD_DIR)/$(TARGET_KERNEL)
169 endif
171 kernel-install: kernel-strip
172 @cp $(BUILD_DIR)/$(TARGET_KERNEL) $(FW_DIR)/$(TARGET_KERNEL)
173 ifeq ($(ADK_TARGET_FS),squashfs)
174 env PATH=$(HOST_PATH) qemu-img create -f raw $(FW_DIR)/$(ROOTFSSQUASHFS) $(ADK_TARGET_MTD_SIZE)
175 dd conv=notrunc if=$(BUILD_DIR)/root.squashfs of=$(FW_DIR)/$(ROOTFSSQUASHFS)
176 endif
178 ifeq ($(ADK_TARGET_LINUX_KERNEL_VERSION_6_6)$(ADK_TARGET_LINUX_KERNEL_VERSION_6_9),y)
179 ifeq ($(ADK_TARGET_SYSTEM_QEMU_ARM_VERSATILEPB),y)
180 VENDOR:=arm/
181 endif
182 ifeq ($(ADK_TARGET_SYSTEM_QEMU_ARM_REALVIEW_EB_MPCORE),y)
183 VENDOR:=arm/
184 endif
185 ifeq ($(ADK_TARGET_SYSTEM_QEMU_ARM_VEXPRESS_A9),y)
186 VENDOR:=arm/
187 endif
188 ifeq ($(ADK_TARGET_SYSTEM_QEMU_ARM_XILINX_ZYNQ),y)
189 VENDOR:=xilinx/
190 endif
191 ifeq ($(ADK_TARGET_SYSTEM_ST_STM32F746G),y)
192 VENDOR:=st/
193 endif
194 ifeq ($(ADK_TARGET_SYSTEM_SOLIDRUN_IMX6),y)
195 VENDOR:=nxp/imx/
196 endif
197 endif
199 dtb-install:
200 ifeq ($(ADK_TARGET_SYSTEM_QEMU_ARM_XILINX_ZYNQ),y)
201 ${KERNEL_MAKE} dtbs $(MAKE_TRACE)
202 endif
203 ifeq ($(ADK_TARGET_SYSTEM_QEMU_ARM_VEXPRESS_A9),y)
204 ${KERNEL_MAKE} $(VENDOR)vexpress-v2p-ca9.dtb $(MAKE_TRACE)
205 endif
206 ifeq ($(ADK_TARGET_SYSTEM_QEMU_ARM_REALVIEW_EB_MPCORE),y)
207 ${KERNEL_MAKE} $(VENDOR)arm-realview-eb-11mp-ctrevb.dtb $(MAKE_TRACE)
208 endif
209 ifeq ($(ADK_TARGET_SYSTEM_QEMU_ARM_VERSATILEPB),y)
210 ${KERNEL_MAKE} $(VENDOR)versatile-pb.dtb $(MAKE_TRACE)
211 endif
212 ifeq ($(ADK_TARGET_SYSTEM_PHYTEC_WEGA),y)
213 ${KERNEL_MAKE} am335x-wega-rdk.dtb $(MAKE_TRACE)
214 cp $(LINUX_DIR)/arch/arm/boot/dts/am335x-wega-rdk.dtb ${TARGET_DIR}/boot
215 endif
216 ifeq ($(ADK_TARGET_SYSTEM_PHYTEC_IMX6),y)
217 ${KERNEL_MAKE} imx6q-phytec-pbab01.dtb $(MAKE_TRACE)
218 cp $(LINUX_DIR)/arch/arm/boot/dts/imx6q-phytec-pbab01.dtb ${TARGET_DIR}/boot
219 endif
220 ifeq ($(ADK_TARGET_SYSTEM_BEAGLEBONE_BLACK),y)
221 ${KERNEL_MAKE} am335x-boneblack.dtb $(MAKE_TRACE)
222 cp $(LINUX_DIR)/arch/arm/boot/dts/am335x-boneblack.dtb ${TARGET_DIR}/boot
223 endif
224 ifeq ($(ADK_TARGET_BOARD_BCM28XX),y)
225 ${KERNEL_MAKE} dtbs $(MAKE_TRACE)
226 mkdir -p $(FW_DIR)/overlays
227 for x in $(LINUX_DIR)/arch/arm/boot/dts/overlays/*.dtbo; do \
228 [[ -e "$$x" ]] && cp $(LINUX_DIR)/arch/arm/boot/dts/overlays/*.dtbo $(FW_DIR)/overlays; \
229 break; \
230 done
231 for x in $(LINUX_DIR)/arch/arm/boot/dts/overlays/*.dtb; do \
232 [[ -e "$$x" ]] && cp $(LINUX_DIR)/arch/arm/boot/dts/overlays/*.dtb $(FW_DIR)/overlays; \
233 break; \
234 done
235 endif
236 ifeq ($(ADK_TARGET_SYSTEM_BANANA_PRO),y)
237 ${KERNEL_MAKE} sun7i-a20-bananapro.dtb $(MAKE_TRACE)
238 endif
239 ifeq ($(ADK_TARGET_SYSTEM_ORANGE_PI0),y)
240 ${KERNEL_MAKE} sun8i-h2-plus-orangepi-zero.dtb $(MAKE_TRACE)
241 endif
242 ifeq ($(ADK_TARGET_SYSTEM_BANANA_P2_ZERO),y)
243 ${KERNEL_MAKE} sun8i-h2-plus-bananapi-m2-zero.dtb $(MAKE_TRACE)
244 endif
245 ifeq ($(ADK_TARGET_SYSTEM_SOLIDRUN_IMX6),y)
246 ${KERNEL_MAKE} $(VENDOR)imx6q-cubox-i.dtb $(VENDOR)imx6dl-cubox-i.dtb \
247 $(VENDOR)imx6dl-hummingboard.dtb $(VENDOR)imx6q-hummingboard.dtb $(MAKE_TRACE)
248 endif
249 ifeq ($(ADK_TARGET_SYSTEM_SOLIDRUN_CLEARFOG),y)
250 ${KERNEL_MAKE} armada-388-clearfog.dtb $(MAKE_TRACE)
251 endif
252 ifeq ($(ADK_TARGET_SYSTEM_ST_STM32F429),y)
253 ${KERNEL_MAKE} dtbs $(MAKE_TRACE)
254 endif
255 ifeq ($(ADK_TARGET_SYSTEM_ST_STM32F769),y)
256 ${KERNEL_MAKE} dtbs $(MAKE_TRACE)
257 endif
258 ifeq ($(ADK_TARGET_SYSTEM_ST_STM32F746G),y)
259 ${KERNEL_MAKE} $(VENDOR)stm32f746-disco.dtb $(MAKE_TRACE)
260 endif
261 for x in $(LINUX_DIR)/arch/arm/boot/dts/$(VENDOR)*.dtb; do \
262 [[ -e "$$x" ]] && cp $(LINUX_DIR)/arch/arm/boot/dts/$(VENDOR)*.dtb $(FW_DIR); \
263 break; \
264 done
266 # filesystem specific targets
267 ifeq ($(ADK_TARGET_FS),archive)
268 imageinstall: dtb-install $(FW_DIR)/$(ROOTFSTARBALL) targethelp
269 endif
270 ifeq ($(ADK_TARGET_FS),initramfs)
271 imageinstall: kernel-install dtb-install $(FW_DIR)/$(INITRAMFS) targethelp
272 endif
273 ifeq ($(ADK_TARGET_FS),initramfsarchive)
274 imageinstall: kernel-install dtb-install $(FW_DIR)/$(ROOTFSUSERTARBALL) targethelp
275 endif
276 ifeq ($(ADK_TARGET_FS),initramfspiggyback)
277 imageinstall: dtb-install createinitramfs targethelp
278 endif
279 ifeq (${ADK_TARGET_FS},genimage)
280 imageinstall: dtb-install $(FW_DIR)/$(GENIMAGE) targethelp
281 endif
282 ifeq ($(ADK_TARGET_FS),nfsroot)
283 imageinstall: kernel-install $(FW_DIR)/$(ROOTFSUSERTARBALL) targethelp
284 endif
285 ifeq ($(ADK_TARGET_FS),squashfs)
286 imageinstall: $(BUILD_DIR)/root.squashfs kernel-install dtb-install targethelp
287 endif
288 ifeq ($(ADK_TARGET_FS),jffs2)
289 imageinstall: kernel-install dtb-install $(FW_DIR)/$(ROOTFSJFFS2) targethelp
290 endif
291 ifeq ($(ADK_TARGET_FS),usb)
292 imageinstall: $(FW_DIR)/$(ROOTFSTARBALL) targethelp
293 endif