beaglebone-black: works with omap2plus_defconfig and upstream kernel
[openadk.git] / target / arm / Makefile
blob255d5c79370544fc57c6f312c4398ce5928f3c3b
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_BEAGEBONE_BLACK),y)
89 @echo "Use following command to install it on SD card:"
90 @echo "sudo ./scripts/install.sh beaglebone-black /dev/sdX $(FW_DIR)/$(ROOTFSTARBALL)"
91 @echo
92 endif
93 ifeq ($(ADK_TARGET_SYSTEM_BANANA_PRO),y)
94 @echo "Use following command to install it on SD card:"
95 @echo "sudo ./scripts/install.sh banana-pro /dev/sdX $(FW_DIR)/$(ROOTFSTARBALL)"
96 @echo "Use following command to install with a writable data partition"
97 @echo "sudo ./scripts/install.sh -d 256 banana-pro /dev/sdX $(FW_DIR)/$(ROOTFSTARBALL)"
98 endif
99 ifeq ($(ADK_TARGET_SYSTEM_BANANA_P2_ZERO),y)
100 @echo "Use following command to install it on SD card:"
101 @echo "sudo ./scripts/install.sh banana-pro-zero /dev/sdX $(FW_DIR)/$(ROOTFSTARBALL)"
102 @echo "Use following command to install with a writable data partition"
103 @echo "sudo ./scripts/install.sh -d 256 banana-pro-zero /dev/sdX $(FW_DIR)/$(ROOTFSTARBALL)"
104 endif
105 ifeq ($(ADK_TARGET_SYSTEM_ORANGE_PI0),y)
106 @echo "Use following command to install it on SD card:"
107 @echo "sudo ./scripts/install.sh orange-pi0 /dev/sdX $(FW_DIR)/$(ROOTFSTARBALL)"
108 @echo "Use following command to install with a writable data partition"
109 @echo "sudo ./scripts/install.sh -d 256 orange-pi0 /dev/sdX $(FW_DIR)/$(ROOTFSTARBALL)"
110 endif
111 endif
112 ifeq ($(ADK_TARGET_FS),initramfs)
113 targethelp:
114 @echo 'The kernel file is: $(FW_DIR)/${TARGET_KERNEL}'
115 @echo 'The initramfs image is: ${FW_DIR}/${INITRAMFS}'
116 ifeq ($(ADK_TARGET_QEMU),y)
117 @echo "Start qemu with following command line:"
118 @echo 'qemu-system-arm ${QEMU_ARGS} -kernel $(FW_DIR)/$(TARGET_KERNEL) -initrd ${FW_DIR}/${INITRAMFS}'
119 endif
120 endif
121 ifeq ($(ADK_TARGET_FS),initramfsarchive)
122 targethelp:
123 @echo 'The kernel file is: $(FW_DIR)/${TARGET_KERNEL}'
124 @echo "The RootFS tarball is: $(FW_DIR)/$(ROOTFSUSERTARBALL)"
125 endif
126 ifeq ($(ADK_TARGET_FS),initramfspiggyback)
127 targethelp:
128 @echo 'The kernel+initramfs file is: $(FW_DIR)/${TARGET_KERNEL}'
129 ifeq ($(ADK_TARGET_QEMU),y)
130 @echo "Start qemu with following command line:"
131 @echo 'qemu-system-arm ${QEMU_ARGS} -kernel $(FW_DIR)/$(TARGET_KERNEL)'
132 endif
133 endif
134 ifeq ($(ADK_TARGET_FS),nfsroot)
135 targethelp:
136 @echo 'The kernel file is: $(FW_DIR)/${TARGET_KERNEL}'
137 @echo "The RootFS tarball is: $(FW_DIR)/$(ROOTFSUSERTARBALL)"
138 ifeq ($(ADK_TARGET_SYSTEM_LINKSYS_NSLU2),y)
139 @echo "Use following in RedBoot bootloader:"
140 @echo "RedBoot> ip_address -l <localip> -h <serverip>; load -r -v -b 0x01d00000 ${TARGET_KERNEL}; exec 0x01d00000"
141 endif
142 endif
143 ifeq ($(ADK_TARGET_FS),squashfs)
144 targethelp:
145 @echo 'The kernel file is: $(FW_DIR)/${TARGET_KERNEL}'
146 @echo "The RootFS image is: $(FW_DIR)/$(ROOTFSSQUASHFS)"
147 ifeq ($(ADK_TARGET_QEMU),y)
148 @echo "Start qemu with following options:"
149 @echo 'qemu-system-arm $(QEMU_ARGS) -nographic -kernel $(FW_DIR)/$(TARGET_KERNEL) $(FW_DIR)/$(ROOTFSSQUASHFS)'
150 endif
151 endif
152 ifeq ($(ADK_TARGET_FS),jffs2)
153 targethelp:
154 @echo 'The kernel file is: $(FW_DIR)/${TARGET_KERNEL}'
155 @echo "The RootFS image is: $(FW_DIR)/$(ROOTFSJFFS2)"
156 ifeq ($(ADK_TARGET_QEMU),y)
157 @echo "Start qemu with following options:"
158 @echo 'qemu-system-arm $(QEMU_ARGS) -nographic -kernel $(FW_DIR)/$(TARGET_KERNEL) $(FW_DIR)/$(ROOTFSJFFS2)'
159 endif
160 endif
161 ifeq ($(ADK_TARGET_FS),genimage)
162 targethelp:
163 @echo "The disk image is: $(FW_DIR)/sdcard.img"
164 @echo "Use following command to install it on SD card:"
165 @echo 'sudo dd if=$(FW_DIR)/sdcard.img of=/dev/sdX bs=32M'
166 endif
168 kernel-strip:
169 ifeq ($(ADK_TARGET_KERNEL_GIT_REPO_NAME),rpi)
170 @echo adding DT trailer to kernel $(MAKE_TRACE)
171 PATH='$(HOST_PATH)' perl $(LINUX_DIR)/scripts/mkknlimg $(KERNEL) $(BUILD_DIR)/$(TARGET_KERNEL) $(MAKE_TRACE)
172 else
173 @cp $(KERNEL) $(BUILD_DIR)/$(TARGET_KERNEL)
174 endif
176 kernel-install: kernel-strip
177 @cp $(BUILD_DIR)/$(TARGET_KERNEL) $(FW_DIR)/$(TARGET_KERNEL)
178 ifeq ($(ADK_TARGET_FS),squashfs)
179 env PATH=$(HOST_PATH) qemu-img create -f raw $(FW_DIR)/$(ROOTFSSQUASHFS) $(ADK_TARGET_MTD_SIZE)
180 dd conv=notrunc if=$(BUILD_DIR)/root.squashfs of=$(FW_DIR)/$(ROOTFSSQUASHFS)
181 endif
183 ifeq ($(ADK_TARGET_LINUX_KERNEL_VERSION_6_6)$(ADK_TARGET_LINUX_KERNEL_VERSION_6_9)$(ADK_TARGET_LINUX_KERNEL_VERSION_GIT),y)
184 ifeq ($(ADK_TARGET_SYSTEM_QEMU_ARM_VERSATILEPB),y)
185 VENDOR:=arm/
186 endif
187 ifeq ($(ADK_TARGET_SYSTEM_QEMU_ARM_REALVIEW_EB_MPCORE),y)
188 VENDOR:=arm/
189 endif
190 ifeq ($(ADK_TARGET_SYSTEM_QEMU_ARM_VEXPRESS_A9),y)
191 VENDOR:=arm/
192 endif
193 ifeq ($(ADK_TARGET_SYSTEM_QEMU_ARM_XILINX_ZYNQ),y)
194 VENDOR:=xilinx/
195 endif
196 ifeq ($(ADK_TARGET_SYSTEM_ST_STM32F746G),y)
197 VENDOR:=st/
198 endif
199 ifeq ($(ADK_TARGET_SYSTEM_SOLIDRUN_IMX6),y)
200 VENDOR:=nxp/imx/
201 endif
202 ifeq ($(ADK_TARGET_SYSTEM_BEAGLEBONE_BLACK),y)
203 VENDOR:=ti/omap/
204 endif
205 endif
207 dtb-install:
208 ifeq ($(ADK_TARGET_SYSTEM_QEMU_ARM_XILINX_ZYNQ),y)
209 ${KERNEL_MAKE} dtbs $(MAKE_TRACE)
210 endif
211 ifeq ($(ADK_TARGET_SYSTEM_QEMU_ARM_VEXPRESS_A9),y)
212 ${KERNEL_MAKE} $(VENDOR)vexpress-v2p-ca9.dtb $(MAKE_TRACE)
213 endif
214 ifeq ($(ADK_TARGET_SYSTEM_QEMU_ARM_REALVIEW_EB_MPCORE),y)
215 ${KERNEL_MAKE} $(VENDOR)arm-realview-eb-11mp-ctrevb.dtb $(MAKE_TRACE)
216 endif
217 ifeq ($(ADK_TARGET_SYSTEM_QEMU_ARM_VERSATILEPB),y)
218 ${KERNEL_MAKE} $(VENDOR)versatile-pb.dtb $(MAKE_TRACE)
219 endif
220 ifeq ($(ADK_TARGET_SYSTEM_PHYTEC_WEGA),y)
221 ${KERNEL_MAKE} am335x-wega-rdk.dtb $(MAKE_TRACE)
222 cp $(LINUX_DIR)/arch/arm/boot/dts/am335x-wega-rdk.dtb ${TARGET_DIR}/boot
223 endif
224 ifeq ($(ADK_TARGET_SYSTEM_PHYTEC_IMX6),y)
225 ${KERNEL_MAKE} imx6q-phytec-pbab01.dtb $(MAKE_TRACE)
226 cp $(LINUX_DIR)/arch/arm/boot/dts/imx6q-phytec-pbab01.dtb ${TARGET_DIR}/boot
227 endif
228 ifeq ($(ADK_TARGET_SYSTEM_BEAGLEBONE_BLACK),y)
229 ${KERNEL_MAKE} $(VENDOR)am335x-boneblack.dtb $(MAKE_TRACE)
230 cp $(LINUX_DIR)/arch/arm/boot/dts/$(VENDOR)am335x-boneblack.dtb ${TARGET_DIR}/boot
231 endif
232 ifeq ($(ADK_TARGET_BOARD_BCM28XX),y)
233 ${KERNEL_MAKE} dtbs $(MAKE_TRACE)
234 mkdir -p $(FW_DIR)/overlays
235 for x in $(LINUX_DIR)/arch/arm/boot/dts/overlays/*.dtbo; do \
236 [[ -e "$$x" ]] && cp $(LINUX_DIR)/arch/arm/boot/dts/overlays/*.dtbo $(FW_DIR)/overlays; \
237 break; \
238 done
239 for x in $(LINUX_DIR)/arch/arm/boot/dts/overlays/*.dtb; do \
240 [[ -e "$$x" ]] && cp $(LINUX_DIR)/arch/arm/boot/dts/overlays/*.dtb $(FW_DIR)/overlays; \
241 break; \
242 done
243 endif
244 ifeq ($(ADK_TARGET_SYSTEM_BANANA_PRO),y)
245 ${KERNEL_MAKE} sun7i-a20-bananapro.dtb $(MAKE_TRACE)
246 endif
247 ifeq ($(ADK_TARGET_SYSTEM_ORANGE_PI0),y)
248 ${KERNEL_MAKE} sun8i-h2-plus-orangepi-zero.dtb $(MAKE_TRACE)
249 endif
250 ifeq ($(ADK_TARGET_SYSTEM_BANANA_P2_ZERO),y)
251 ${KERNEL_MAKE} sun8i-h2-plus-bananapi-m2-zero.dtb $(MAKE_TRACE)
252 endif
253 ifeq ($(ADK_TARGET_SYSTEM_SOLIDRUN_IMX6),y)
254 ${KERNEL_MAKE} $(VENDOR)imx6q-cubox-i.dtb $(VENDOR)imx6dl-cubox-i.dtb \
255 $(VENDOR)imx6dl-hummingboard.dtb $(VENDOR)imx6q-hummingboard.dtb $(MAKE_TRACE)
256 endif
257 ifeq ($(ADK_TARGET_SYSTEM_SOLIDRUN_CLEARFOG),y)
258 ${KERNEL_MAKE} armada-388-clearfog.dtb $(MAKE_TRACE)
259 endif
260 ifeq ($(ADK_TARGET_SYSTEM_ST_STM32F429),y)
261 ${KERNEL_MAKE} dtbs $(MAKE_TRACE)
262 endif
263 ifeq ($(ADK_TARGET_SYSTEM_ST_STM32F769),y)
264 ${KERNEL_MAKE} dtbs $(MAKE_TRACE)
265 endif
266 ifeq ($(ADK_TARGET_SYSTEM_ST_STM32F746G),y)
267 ${KERNEL_MAKE} $(VENDOR)stm32f746-disco.dtb $(MAKE_TRACE)
268 endif
269 for x in $(LINUX_DIR)/arch/arm/boot/dts/$(VENDOR)*.dtb; do \
270 [[ -e "$$x" ]] && cp $(LINUX_DIR)/arch/arm/boot/dts/$(VENDOR)*.dtb $(FW_DIR); \
271 break; \
272 done
274 # filesystem specific targets
275 ifeq ($(ADK_TARGET_FS),archive)
276 imageinstall: dtb-install $(FW_DIR)/$(ROOTFSTARBALL) targethelp
277 endif
278 ifeq ($(ADK_TARGET_FS),initramfs)
279 imageinstall: kernel-install dtb-install $(FW_DIR)/$(INITRAMFS) targethelp
280 endif
281 ifeq ($(ADK_TARGET_FS),initramfsarchive)
282 imageinstall: kernel-install dtb-install $(FW_DIR)/$(ROOTFSUSERTARBALL) targethelp
283 endif
284 ifeq ($(ADK_TARGET_FS),initramfspiggyback)
285 imageinstall: dtb-install createinitramfs targethelp
286 endif
287 ifeq (${ADK_TARGET_FS},genimage)
288 imageinstall: dtb-install $(FW_DIR)/$(GENIMAGE) targethelp
289 endif
290 ifeq ($(ADK_TARGET_FS),nfsroot)
291 imageinstall: kernel-install $(FW_DIR)/$(ROOTFSUSERTARBALL) targethelp
292 endif
293 ifeq ($(ADK_TARGET_FS),squashfs)
294 imageinstall: $(BUILD_DIR)/root.squashfs kernel-install dtb-install targethelp
295 endif
296 ifeq ($(ADK_TARGET_FS),jffs2)
297 imageinstall: kernel-install dtb-install $(FW_DIR)/$(ROOTFSJFFS2) targethelp
298 endif
299 ifeq ($(ADK_TARGET_FS),usb)
300 imageinstall: $(FW_DIR)/$(ROOTFSTARBALL) targethelp
301 endif