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
12 ifeq ($(ADK_TARGET_KERNEL_UIMAGE
),y
)
13 KERNEL
:=$(LINUX_DIR
)/arch
/arm
/boot
/uImage
15 ifeq ($(ADK_TARGET_KERNEL_XIPIMAGE
),y
)
16 KERNEL
:=$(LINUX_DIR
)/arch
/arm
/boot
/xipImage
18 ifeq ($(ADK_TARGET_KERNEL_IMAGE
),y
)
19 KERNEL
:=$(LINUX_DIR
)/arch
/arm
/boot
/Image
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
26 ifeq ($(ADK_TARGET_SYSTEM_QEMU_ARM_SPITZ
),y
)
29 ifeq ($(ADK_TARGET_SYSTEM_QEMU_ARM_TERRIER
),y
)
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
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
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
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
49 ifeq ($(ADK_TARGET_FS
),archive
)
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'
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!"
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)"
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)"
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"
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)"
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)"
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)"
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)"
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)"
112 ifeq ($(ADK_TARGET_FS
),initramfs
)
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}'
121 ifeq ($(ADK_TARGET_FS
),initramfsarchive
)
123 @echo
'The kernel file is: $(FW_DIR)/${TARGET_KERNEL}'
124 @echo
"The RootFS tarball is: $(FW_DIR)/$(ROOTFSUSERTARBALL)"
126 ifeq ($(ADK_TARGET_FS
),initramfspiggyback
)
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)'
134 ifeq ($(ADK_TARGET_FS
),nfsroot
)
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"
143 ifeq ($(ADK_TARGET_FS
),squashfs
)
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)'
152 ifeq ($(ADK_TARGET_FS
),jffs2
)
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)'
161 ifeq ($(ADK_TARGET_FS
),genimage
)
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'
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
)
173 @cp
$(KERNEL
) $(BUILD_DIR
)/$(TARGET_KERNEL
)
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
)
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
)
187 ifeq ($(ADK_TARGET_SYSTEM_QEMU_ARM_REALVIEW_EB_MPCORE
),y
)
190 ifeq ($(ADK_TARGET_SYSTEM_QEMU_ARM_VEXPRESS_A9
),y
)
193 ifeq ($(ADK_TARGET_SYSTEM_QEMU_ARM_XILINX_ZYNQ
),y
)
196 ifeq ($(ADK_TARGET_SYSTEM_ST_STM32F746G
),y
)
199 ifeq ($(ADK_TARGET_SYSTEM_SOLIDRUN_IMX6
),y
)
202 ifeq ($(ADK_TARGET_SYSTEM_BEAGLEBONE_BLACK
),y
)
208 ifeq ($(ADK_TARGET_SYSTEM_QEMU_ARM_XILINX_ZYNQ
),y
)
209 ${KERNEL_MAKE} dtbs
$(MAKE_TRACE
)
211 ifeq ($(ADK_TARGET_SYSTEM_QEMU_ARM_VEXPRESS_A9
),y
)
212 ${KERNEL_MAKE} $(VENDOR
)vexpress-v2p-ca9.dtb
$(MAKE_TRACE
)
214 ifeq ($(ADK_TARGET_SYSTEM_QEMU_ARM_REALVIEW_EB_MPCORE
),y
)
215 ${KERNEL_MAKE} $(VENDOR
)arm-realview-eb-11mp-ctrevb.dtb
$(MAKE_TRACE
)
217 ifeq ($(ADK_TARGET_SYSTEM_QEMU_ARM_VERSATILEPB
),y
)
218 ${KERNEL_MAKE} $(VENDOR
)versatile-pb.dtb
$(MAKE_TRACE
)
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
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
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
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
; \
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
; \
244 ifeq ($(ADK_TARGET_SYSTEM_BANANA_PRO
),y
)
245 ${KERNEL_MAKE} sun7i-a20-bananapro.dtb
$(MAKE_TRACE
)
247 ifeq ($(ADK_TARGET_SYSTEM_ORANGE_PI0
),y
)
248 ${KERNEL_MAKE} sun8i-h2-plus-orangepi-zero.dtb
$(MAKE_TRACE
)
250 ifeq ($(ADK_TARGET_SYSTEM_BANANA_P2_ZERO
),y
)
251 ${KERNEL_MAKE} sun8i-h2-plus-bananapi-m2-zero.dtb
$(MAKE_TRACE
)
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
)
257 ifeq ($(ADK_TARGET_SYSTEM_SOLIDRUN_CLEARFOG
),y
)
258 ${KERNEL_MAKE} armada-388-clearfog.dtb
$(MAKE_TRACE
)
260 ifeq ($(ADK_TARGET_SYSTEM_ST_STM32F429
),y
)
261 ${KERNEL_MAKE} dtbs
$(MAKE_TRACE
)
263 ifeq ($(ADK_TARGET_SYSTEM_ST_STM32F769
),y
)
264 ${KERNEL_MAKE} dtbs
$(MAKE_TRACE
)
266 ifeq ($(ADK_TARGET_SYSTEM_ST_STM32F746G
),y
)
267 ${KERNEL_MAKE} $(VENDOR
)stm32f746-disco.dtb
$(MAKE_TRACE
)
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
); \
274 # filesystem specific targets
275 ifeq ($(ADK_TARGET_FS
),archive
)
276 imageinstall
: dtb-install
$(FW_DIR
)/$(ROOTFSTARBALL
) targethelp
278 ifeq ($(ADK_TARGET_FS
),initramfs
)
279 imageinstall
: kernel-install dtb-install
$(FW_DIR
)/$(INITRAMFS
) targethelp
281 ifeq ($(ADK_TARGET_FS
),initramfsarchive
)
282 imageinstall
: kernel-install dtb-install
$(FW_DIR
)/$(ROOTFSUSERTARBALL
) targethelp
284 ifeq ($(ADK_TARGET_FS
),initramfspiggyback
)
285 imageinstall
: dtb-install createinitramfs targethelp
287 ifeq (${ADK_TARGET_FS},genimage
)
288 imageinstall
: dtb-install
$(FW_DIR
)/$(GENIMAGE
) targethelp
290 ifeq ($(ADK_TARGET_FS
),nfsroot
)
291 imageinstall
: kernel-install
$(FW_DIR
)/$(ROOTFSUSERTARBALL
) targethelp
293 ifeq ($(ADK_TARGET_FS
),squashfs
)
294 imageinstall
: $(BUILD_DIR
)/root.squashfs kernel-install dtb-install targethelp
296 ifeq ($(ADK_TARGET_FS
),jffs2
)
297 imageinstall
: kernel-install dtb-install
$(FW_DIR
)/$(ROOTFSJFFS2
) targethelp
299 ifeq ($(ADK_TARGET_FS
),usb
)
300 imageinstall
: $(FW_DIR
)/$(ROOTFSTARBALL
) targethelp