add special repository short names
[openadk.git] / target / arm / Makefile
blobbdf1cbfa58ce6865bf21087ff2f951b65290c55a
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_APPLIANCE_KODI),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_BANANA_PRO),y)
76 @echo "Use following command to install it on SD card:"
77 @echo "sudo ./scripts/install.sh banana-pro /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 banana-pro /dev/sdX $(FW_DIR)/$(ROOTFSTARBALL)"
80 endif
81 endif
82 ifeq ($(ADK_TARGET_FS),initramfs)
83 targethelp:
84 @echo 'The kernel file is: $(FW_DIR)/${TARGET_KERNEL}'
85 @echo 'The initramfs image is: ${FW_DIR}/${INITRAMFS}'
86 ifeq ($(ADK_TARGET_QEMU),y)
87 @echo "Start qemu with following command line:"
88 @echo 'qemu-system-arm ${QEMU_ARGS} -kernel $(FW_DIR)/$(TARGET_KERNEL) -initrd ${FW_DIR}/${INITRAMFS}'
89 endif
90 endif
91 ifeq ($(ADK_TARGET_FS),initramfsarchive)
92 targethelp:
93 @echo 'The kernel file is: $(FW_DIR)/${TARGET_KERNEL}'
94 @echo "The RootFS tarball is: $(FW_DIR)/$(ROOTFSUSERTARBALL)"
95 endif
96 ifeq ($(ADK_TARGET_FS),initramfspiggyback)
97 targethelp:
98 @echo 'The kernel+initramfs file is: $(FW_DIR)/${TARGET_KERNEL}'
99 ifeq ($(ADK_TARGET_QEMU),y)
100 @echo "Start qemu with following command line:"
101 @echo 'qemu-system-arm ${QEMU_ARGS} -kernel $(FW_DIR)/$(TARGET_KERNEL)'
102 endif
103 endif
104 ifeq ($(ADK_TARGET_FS),nfsroot)
105 targethelp:
106 @echo 'The kernel file is: $(FW_DIR)/${TARGET_KERNEL}'
107 @echo "The RootFS tarball is: $(FW_DIR)/$(ROOTFSUSERTARBALL)"
108 ifeq ($(ADK_TARGET_SYSTEM_LINKSYS_NSLU2),y)
109 @echo "Use following in RedBoot bootloader:"
110 @echo "RedBoot> ip_address -l <localip> -h <serverip>; load -r -v -b 0x01d00000 ${TARGET_KERNEL}; exec 0x01d00000"
111 endif
112 endif
113 ifeq ($(ADK_TARGET_FS),squashfs)
114 targethelp:
115 @echo 'The kernel file is: $(FW_DIR)/${TARGET_KERNEL}'
116 @echo "The RootFS image is: $(FW_DIR)/$(ROOTFSSQUASHFS)"
117 ifeq ($(ADK_TARGET_QEMU),y)
118 @echo "Start qemu with following options:"
119 @echo 'qemu-system-arm $(QEMU_ARGS) -nographic -kernel $(FW_DIR)/$(TARGET_KERNEL) $(FW_DIR)/$(ROOTFSSQUASHFS)'
120 endif
121 endif
122 ifeq ($(ADK_TARGET_FS),jffs2)
123 targethelp:
124 @echo 'The kernel file is: $(FW_DIR)/${TARGET_KERNEL}'
125 @echo "The RootFS image is: $(FW_DIR)/$(ROOTFSJFFS2)"
126 ifeq ($(ADK_TARGET_QEMU),y)
127 @echo "Start qemu with following options:"
128 @echo 'qemu-system-arm $(QEMU_ARGS) -nographic -kernel $(FW_DIR)/$(TARGET_KERNEL) $(FW_DIR)/$(ROOTFSJFFS2)'
129 endif
130 endif
131 ifeq ($(ADK_TARGET_FS),genimage)
132 targethelp:
133 @echo "The disk image is: $(FW_DIR)/disk.img"
134 @echo "Use following command to install it on SD card:"
135 @echo 'sudo dd if=$(FW_DIR)/disk.img of=/dev/sdX bs=2048k'
136 endif
138 kernel-strip:
139 ifeq ($(ADK_TARGET_KERNEL_REPO_NAME),rpi)
140 @echo adding DT trailer to kernel $(MAKE_TRACE)
141 PATH='$(HOST_PATH)' perl $(LINUX_DIR)/scripts/mkknlimg --dtok $(KERNEL) $(BUILD_DIR)/$(TARGET_KERNEL)
142 else
143 @cp $(KERNEL) $(BUILD_DIR)/$(TARGET_KERNEL)
144 endif
146 kernel-install: kernel-strip
147 @cp $(BUILD_DIR)/$(TARGET_KERNEL) $(FW_DIR)/$(TARGET_KERNEL)
148 ifeq ($(ADK_TARGET_FS),squashfs)
149 env PATH=$(HOST_PATH) qemu-img create -f raw $(FW_DIR)/$(ROOTFSSQUASHFS) $(ADK_TARGET_MTD_SIZE)
150 dd conv=notrunc if=$(BUILD_DIR)/root.squashfs of=$(FW_DIR)/$(ROOTFSSQUASHFS)
151 endif
153 dtb-install:
154 ifeq ($(ADK_TARGET_SYSTEM_QEMU_ARM_XILINX_ZYNQ),y)
155 env $(KERNEL_MAKE_ENV) $(MAKE) -C "${LINUX_DIR}" $(KERNEL_MAKE_OPTS) \
156 dtbs $(MAKE_TRACE)
157 endif
158 ifeq ($(ADK_TARGET_SYSTEM_QEMU_ARM_VEXPRESS_A9),y)
159 env $(KERNEL_MAKE_ENV) $(MAKE) -C "${LINUX_DIR}" $(KERNEL_MAKE_OPTS) \
160 dtbs $(MAKE_TRACE)
161 endif
162 ifeq ($(ADK_TARGET_SYSTEM_QEMU_ARM_VERSATILEPB)$(ADK_TARGET_SYSTEM_QEMU_ARM_VERSATILEPB_NOMMU),y)
163 env $(KERNEL_MAKE_ENV) $(MAKE) -C "${LINUX_DIR}" $(KERNEL_MAKE_OPTS) \
164 dtbs $(MAKE_TRACE)
165 endif
166 ifeq ($(ADK_TARGET_SYSTEM_BEAGLEBONE_BLACK),y)
167 env $(KERNEL_MAKE_ENV) $(MAKE) -C "${LINUX_DIR}" $(KERNEL_MAKE_OPTS) \
168 am335x-boneblack.dtb
169 cp $(LINUX_DIR)/arch/arm/boot/dts/am335x-boneblack.dtb ${TARGET_DIR}/boot
170 endif
171 ifeq ($(ADK_TARGET_BOARD_BCM28XX),y)
172 env $(KERNEL_MAKE_ENV) $(MAKE) -C "${LINUX_DIR}" $(KERNEL_MAKE_OPTS) \
173 dtbs $(MAKE_TRACE)
174 mkdir -p $(FW_DIR)/overlays
175 for x in $(LINUX_DIR)/arch/arm/boot/dts/overlays/*.dtb; do \
176 [[ -e "$$x" ]] && cp $(LINUX_DIR)/arch/arm/boot/dts/overlays/*.dtb $(FW_DIR)/overlays; \
177 break; \
178 done
179 endif
180 ifeq ($(ADK_TARGET_SYSTEM_BANANA_PRO),y)
181 env $(KERNEL_MAKE_ENV) $(MAKE) -C "${LINUX_DIR}" $(KERNEL_MAKE_OPTS) \
182 sun7i-a20-bananapro.dtb $(MAKE_TRACE)
183 endif
184 ifeq ($(ADK_TARGET_SYSTEM_SOLIDRUN_IMX6),y)
185 env $(KERNEL_MAKE_ENV) $(MAKE) -C "${LINUX_DIR}" $(KERNEL_MAKE_OPTS) \
186 imx6q-cubox-i.dtb imx6dl-cubox-i.dtb imx6dl-hummingboard.dtb imx6q-hummingboard.dtb $(MAKE_TRACE)
187 endif
188 ifeq ($(ADK_TARGET_SYSTEM_SOLIDRUN_CLEARFOG),y)
189 env $(KERNEL_MAKE_ENV) $(MAKE) -C "${LINUX_DIR}" $(KERNEL_MAKE_OPTS) \
190 armada-388-clearfog.dtb $(MAKE_TRACE)
191 endif
192 for x in $(LINUX_DIR)/arch/arm/boot/dts/*.dtb; do \
193 [[ -e "$$x" ]] && cp $(LINUX_DIR)/arch/arm/boot/dts/*.dtb $(FW_DIR); \
194 break; \
195 done
197 # filesystem specific targets
198 ifeq ($(ADK_TARGET_FS),archive)
199 imageinstall: dtb-install $(FW_DIR)/$(ROOTFSTARBALL) targethelp
200 endif
201 ifeq ($(ADK_TARGET_FS),initramfs)
202 imageinstall: kernel-install dtb-install $(FW_DIR)/$(INITRAMFS) targethelp
203 endif
204 ifeq ($(ADK_TARGET_FS),initramfsarchive)
205 imageinstall: kernel-install dtb-install $(FW_DIR)/$(ROOTFSUSERTARBALL) targethelp
206 endif
207 ifeq ($(ADK_TARGET_FS),initramfspiggyback)
208 imageinstall: dtb-install createinitramfs targethelp
209 endif
210 ifeq (${ADK_TARGET_FS},genimage)
211 imageinstall: dtb-install $(FW_DIR)/$(GENIMAGE) targethelp
212 endif
213 ifeq ($(ADK_TARGET_FS),nfsroot)
214 imageinstall: kernel-install $(FW_DIR)/$(ROOTFSUSERTARBALL) targethelp
215 endif
216 ifeq ($(ADK_TARGET_FS),squashfs)
217 imageinstall: $(BUILD_DIR)/root.squashfs kernel-install dtb-install targethelp
218 endif
219 ifeq ($(ADK_TARGET_FS),jffs2)
220 imageinstall: kernel-install dtb-install $(FW_DIR)/$(ROOTFSJFFS2) targethelp
221 endif
222 ifeq ($(ADK_TARGET_FS),usb)
223 imageinstall: $(FW_DIR)/$(ROOTFSTARBALL) targethelp
224 endif