frosted: add support for stm32f429-discovery
[openadk.git] / target / arm / Makefile
blob0965f60be5e04e10ad8e3355166bb4d9dc3a3c23
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
34 endif
35 ifeq ($(ADK_TARGET_SYSTEM_QEMU_ARM_VERSATILEPB)$(ADK_TARGET_SYSTEM_QEMU_ARM_VERSATILEPB_NOMMU),y)
36 ifeq ($(ADK_TARGET_WITH_DEVICETREE),y)
37 QEMU_ARGS+=-M versatilepb -net user -net nic,model=smc91c111 -dtb $(FW_DIR)/versatile-pb.dtb
38 else
39 QEMU_ARGS+=-M versatilepb -net user -net nic,model=smc91c111
40 endif
41 endif
42 ifeq ($(ADK_TARGET_SYSTEM_QEMU_ARM_VEXPRESS_A9),y)
43 QEMU_ARGS+=-M vexpress-a9 -cpu cortex-a9 -m 256 -net user -net nic,model=lan9118 -dtb $(FW_DIR)/vexpress-v2p-ca9.dtb
44 ifeq ($(ADK_TARGET_ROOTFS_ARCHIVE),y)
45 QEMU_ARGS+=-drive file=qemu-arm.img,if=sd,format=raw
46 endif
47 endif
48 ifeq ($(ADK_TARGET_QEMU_WITH_VIRTIO),y)
49 QEMU_ARGS+=-drive file=qemu-${ADK_TARGET_CPU_ARCH}.img,if=virtio,index=0 -net nic,model=virtio -net user
50 endif
52 # target helper text
53 ifeq ($(ADK_TARGET_FS),archive)
54 targethelp:
55 @echo "The RootFS tarball is: $(FW_DIR)/$(ROOTFSTARBALL)"
56 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)
57 @echo 'The kernel file is: $(FW_DIR)/${TARGET_KERNEL}'
58 @echo "Use following command to create a QEMU Image:"
59 @echo "./scripts/create.sh qemu-${ADK_TARGET_CPU_ARCH}.img $(FW_DIR)/$(ROOTFSTARBALL)"
60 @echo "Start qemu with following options:"
61 @echo 'qemu-system-${ADK_TARGET_CPU_ARCH} ${QEMU_ARGS} -kernel $(FW_DIR)/$(TARGET_KERNEL) qemu-${ADK_TARGET_CPU_ARCH}.img'
62 endif
63 ifeq ($(ADK_TARGET_BOARD_BCM28XX)$(ADK_TARGET_SYSTEM_SOLIDRUN_IMX6)$(ADK_TARGET_SYSTEM_SOLIDRUN_CLEARFOG),y)
64 ifeq ($(ADK_RUNTIME_DATA_PARTITION),y)
65 @echo "Use following command to install with a writable data partition"
66 @echo "sudo ./scripts/install.sh -d 256 $(ADK_TARGET_SYSTEM) /dev/sdX $(FW_DIR)/$(ROOTFSTARBALL)"
67 @echo "If you want to update a card without loosing existing data on the writable partition use:"
68 @echo "sudo ./scripts/install.sh -k -d 256 $(ADK_TARGET_SYSTEM) /dev/sdX $(FW_DIR)/$(ROOTFSTARBALL)"
69 @echo "In both cases the cfgfs partition is _not_ removed!"
70 else
71 @echo "Use following command to install it on SD card:"
72 @echo "sudo ./scripts/install.sh $(ADK_TARGET_SYSTEM) /dev/sdX $(FW_DIR)/$(ROOTFSTARBALL)"
73 endif
74 endif
75 ifeq ($(ADK_TARGET_SYSTEM_PHYTEC_WEGA),y)
76 @echo "Use following command to install it on SD card:"
77 @echo "sudo ./scripts/install.sh phytec-wega /dev/sdX $(FW_DIR)/$(ROOTFSTARBALL)"
78 @echo "Use following command to install with a writable data partition"
79 @echo "sudo ./scripts/install.sh -d 256 phytec-wega /dev/sdX $(FW_DIR)/$(ROOTFSTARBALL)"
80 @echo
81 @echo "To boot from SD card do following in barebox bootloader:"
82 @echo "mount /dev/mmc0.0 /mnt"
83 @echo "bootm -o /mnt/am335x-wega-rdk.dtb /mnt/kernel"
84 @echo
85 endif
86 ifeq ($(ADK_TARGET_SYSTEM_BANANA_PRO),y)
87 @echo "Use following command to install it on SD card:"
88 @echo "sudo ./scripts/install.sh banana-pro /dev/sdX $(FW_DIR)/$(ROOTFSTARBALL)"
89 @echo "Use following command to install with a writable data partition"
90 @echo "sudo ./scripts/install.sh -d 256 banana-pro /dev/sdX $(FW_DIR)/$(ROOTFSTARBALL)"
91 endif
92 ifeq ($(ADK_TARGET_SYSTEM_ORANGE_PI0),y)
93 @echo "Use following command to install it on SD card:"
94 @echo "sudo ./scripts/install.sh orange-pi0 /dev/sdX $(FW_DIR)/$(ROOTFSTARBALL)"
95 @echo "Use following command to install with a writable data partition"
96 @echo "sudo ./scripts/install.sh -d 256 orange-pi0 /dev/sdX $(FW_DIR)/$(ROOTFSTARBALL)"
97 endif
98 endif
99 ifeq ($(ADK_TARGET_FS),initramfs)
100 targethelp:
101 @echo 'The kernel file is: $(FW_DIR)/${TARGET_KERNEL}'
102 @echo 'The initramfs image is: ${FW_DIR}/${INITRAMFS}'
103 ifeq ($(ADK_TARGET_QEMU),y)
104 @echo "Start qemu with following command line:"
105 @echo 'qemu-system-arm ${QEMU_ARGS} -kernel $(FW_DIR)/$(TARGET_KERNEL) -initrd ${FW_DIR}/${INITRAMFS}'
106 endif
107 endif
108 ifeq ($(ADK_TARGET_FS),initramfsarchive)
109 targethelp:
110 @echo 'The kernel file is: $(FW_DIR)/${TARGET_KERNEL}'
111 @echo "The RootFS tarball is: $(FW_DIR)/$(ROOTFSUSERTARBALL)"
112 endif
113 ifeq ($(ADK_TARGET_FS),initramfspiggyback)
114 targethelp:
115 @echo 'The kernel+initramfs file is: $(FW_DIR)/${TARGET_KERNEL}'
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)'
119 endif
120 endif
121 ifeq ($(ADK_TARGET_FS),nfsroot)
122 targethelp:
123 @echo 'The kernel file is: $(FW_DIR)/${TARGET_KERNEL}'
124 @echo "The RootFS tarball is: $(FW_DIR)/$(ROOTFSUSERTARBALL)"
125 ifeq ($(ADK_TARGET_SYSTEM_LINKSYS_NSLU2),y)
126 @echo "Use following in RedBoot bootloader:"
127 @echo "RedBoot> ip_address -l <localip> -h <serverip>; load -r -v -b 0x01d00000 ${TARGET_KERNEL}; exec 0x01d00000"
128 endif
129 endif
130 ifeq ($(ADK_TARGET_FS),squashfs)
131 targethelp:
132 @echo 'The kernel file is: $(FW_DIR)/${TARGET_KERNEL}'
133 @echo "The RootFS image is: $(FW_DIR)/$(ROOTFSSQUASHFS)"
134 ifeq ($(ADK_TARGET_QEMU),y)
135 @echo "Start qemu with following options:"
136 @echo 'qemu-system-arm $(QEMU_ARGS) -nographic -kernel $(FW_DIR)/$(TARGET_KERNEL) $(FW_DIR)/$(ROOTFSSQUASHFS)'
137 endif
138 endif
139 ifeq ($(ADK_TARGET_FS),jffs2)
140 targethelp:
141 @echo 'The kernel file is: $(FW_DIR)/${TARGET_KERNEL}'
142 @echo "The RootFS image is: $(FW_DIR)/$(ROOTFSJFFS2)"
143 ifeq ($(ADK_TARGET_QEMU),y)
144 @echo "Start qemu with following options:"
145 @echo 'qemu-system-arm $(QEMU_ARGS) -nographic -kernel $(FW_DIR)/$(TARGET_KERNEL) $(FW_DIR)/$(ROOTFSJFFS2)'
146 endif
147 endif
148 ifeq ($(ADK_TARGET_FS),genimage)
149 targethelp:
150 @echo "The disk image is: $(FW_DIR)/disk.img"
151 @echo "Use following command to install it on SD card:"
152 @echo 'sudo dd if=$(FW_DIR)/disk.img of=/dev/sdX bs=2048k'
153 endif
155 kernel-strip:
156 ifeq ($(ADK_TARGET_KERNEL_GIT_REPO_NAME),rpi)
157 @echo adding DT trailer to kernel $(MAKE_TRACE)
158 PATH='$(HOST_PATH)' perl $(LINUX_DIR)/scripts/mkknlimg $(KERNEL) $(BUILD_DIR)/$(TARGET_KERNEL) $(MAKE_TRACE)
159 else
160 @cp $(KERNEL) $(BUILD_DIR)/$(TARGET_KERNEL)
161 endif
163 kernel-install: kernel-strip
164 @cp $(BUILD_DIR)/$(TARGET_KERNEL) $(FW_DIR)/$(TARGET_KERNEL)
165 ifeq ($(ADK_TARGET_FS),squashfs)
166 env PATH=$(HOST_PATH) qemu-img create -f raw $(FW_DIR)/$(ROOTFSSQUASHFS) $(ADK_TARGET_MTD_SIZE)
167 dd conv=notrunc if=$(BUILD_DIR)/root.squashfs of=$(FW_DIR)/$(ROOTFSSQUASHFS)
168 endif
170 dtb-install:
171 ifeq ($(ADK_TARGET_WITH_DEVICETREE),y)
172 ifeq ($(ADK_TARGET_SYSTEM_QEMU_ARM_XILINX_ZYNQ),y)
173 env $(KERNEL_MAKE_ENV) $(MAKE) -C "${LINUX_DIR}" $(KERNEL_MAKE_OPTS) \
174 dtbs $(MAKE_TRACE)
175 endif
176 ifeq ($(ADK_TARGET_SYSTEM_QEMU_ARM_VEXPRESS_A9),y)
177 env $(KERNEL_MAKE_ENV) $(MAKE) -C "${LINUX_DIR}" $(KERNEL_MAKE_OPTS) \
178 dtbs $(MAKE_TRACE)
179 endif
180 ifeq ($(ADK_TARGET_SYSTEM_QEMU_ARM_VERSATILEPB)$(ADK_TARGET_SYSTEM_QEMU_ARM_VERSATILEPB_NOMMU),y)
181 env $(KERNEL_MAKE_ENV) $(MAKE) -C "${LINUX_DIR}" $(KERNEL_MAKE_OPTS) \
182 dtbs $(MAKE_TRACE)
183 endif
184 ifeq ($(ADK_TARGET_SYSTEM_PHYTEC_WEGA),y)
185 env $(KERNEL_MAKE_ENV) $(MAKE) -C "${LINUX_DIR}" $(KERNEL_MAKE_OPTS) \
186 am335x-wega-rdk.dtb
187 cp $(LINUX_DIR)/arch/arm/boot/dts/am335x-wega-rdk.dtb ${TARGET_DIR}/boot
188 endif
189 ifeq ($(ADK_TARGET_SYSTEM_BEAGLEBONE_BLACK),y)
190 env $(KERNEL_MAKE_ENV) $(MAKE) -C "${LINUX_DIR}" $(KERNEL_MAKE_OPTS) \
191 am335x-boneblack.dtb
192 cp $(LINUX_DIR)/arch/arm/boot/dts/am335x-boneblack.dtb ${TARGET_DIR}/boot
193 endif
194 ifeq ($(ADK_TARGET_BOARD_BCM28XX),y)
195 env $(KERNEL_MAKE_ENV) $(MAKE) -C "${LINUX_DIR}" $(KERNEL_MAKE_OPTS) \
196 dtbs $(MAKE_TRACE)
197 mkdir -p $(FW_DIR)/overlays
198 for x in $(LINUX_DIR)/arch/arm/boot/dts/overlays/*.dtbo; do \
199 [[ -e "$$x" ]] && cp $(LINUX_DIR)/arch/arm/boot/dts/overlays/*.dtbo $(FW_DIR)/overlays; \
200 break; \
201 done
202 endif
203 ifeq ($(ADK_TARGET_SYSTEM_BANANA_PRO),y)
204 env $(KERNEL_MAKE_ENV) $(MAKE) -C "${LINUX_DIR}" $(KERNEL_MAKE_OPTS) \
205 sun7i-a20-bananapro.dtb $(MAKE_TRACE)
206 endif
207 ifeq ($(ADK_TARGET_SYSTEM_ORANGE_PI0),y)
208 env $(KERNEL_MAKE_ENV) $(MAKE) -C "${LINUX_DIR}" $(KERNEL_MAKE_OPTS) \
209 sun8i-h2-plus-orangepi-zero.dtb $(MAKE_TRACE)
210 endif
211 ifeq ($(ADK_TARGET_SYSTEM_SOLIDRUN_IMX6),y)
212 env $(KERNEL_MAKE_ENV) $(MAKE) -C "${LINUX_DIR}" $(KERNEL_MAKE_OPTS) \
213 imx6q-cubox-i.dtb imx6dl-cubox-i.dtb imx6dl-hummingboard.dtb imx6q-hummingboard.dtb $(MAKE_TRACE)
214 endif
215 ifeq ($(ADK_TARGET_SYSTEM_SOLIDRUN_CLEARFOG),y)
216 env $(KERNEL_MAKE_ENV) $(MAKE) -C "${LINUX_DIR}" $(KERNEL_MAKE_OPTS) \
217 armada-388-clearfog.dtb $(MAKE_TRACE)
218 endif
219 ifeq ($(ADK_TARGET_SYSTEM_ST_STM32F769),y)
220 env $(KERNEL_MAKE_ENV) $(MAKE) -C "${LINUX_DIR}" $(KERNEL_MAKE_OPTS) \
221 dtbs $(MAKE_TRACE)
222 endif
223 for x in $(LINUX_DIR)/arch/arm/boot/dts/*.dtb; do \
224 [[ -e "$$x" ]] && cp $(LINUX_DIR)/arch/arm/boot/dts/*.dtb $(FW_DIR); \
225 break; \
226 done
227 endif
229 # filesystem specific targets
230 ifeq ($(ADK_TARGET_FS),archive)
231 imageinstall: dtb-install $(FW_DIR)/$(ROOTFSTARBALL) targethelp
232 endif
233 ifeq ($(ADK_TARGET_FS),initramfs)
234 imageinstall: kernel-install dtb-install $(FW_DIR)/$(INITRAMFS) targethelp
235 endif
236 ifeq ($(ADK_TARGET_FS),initramfsarchive)
237 imageinstall: kernel-install dtb-install $(FW_DIR)/$(ROOTFSUSERTARBALL) targethelp
238 endif
239 ifeq ($(ADK_TARGET_FS),initramfspiggyback)
240 imageinstall: dtb-install createinitramfs targethelp
241 endif
242 ifeq (${ADK_TARGET_FS},genimage)
243 imageinstall: dtb-install $(FW_DIR)/$(GENIMAGE) targethelp
244 endif
245 ifeq ($(ADK_TARGET_FS),nfsroot)
246 imageinstall: kernel-install $(FW_DIR)/$(ROOTFSUSERTARBALL) targethelp
247 endif
248 ifeq ($(ADK_TARGET_FS),squashfs)
249 imageinstall: $(BUILD_DIR)/root.squashfs kernel-install dtb-install targethelp
250 endif
251 ifeq ($(ADK_TARGET_FS),jffs2)
252 imageinstall: kernel-install dtb-install $(FW_DIR)/$(ROOTFSJFFS2) targethelp
253 endif
254 ifeq ($(ADK_TARGET_FS),usb)
255 imageinstall: $(FW_DIR)/$(ROOTFSTARBALL) targethelp
256 endif