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_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)"
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)"
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)"
107 ifeq ($(ADK_TARGET_FS
),initramfs
)
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}'
116 ifeq ($(ADK_TARGET_FS
),initramfsarchive
)
118 @echo
'The kernel file is: $(FW_DIR)/${TARGET_KERNEL}'
119 @echo
"The RootFS tarball is: $(FW_DIR)/$(ROOTFSUSERTARBALL)"
121 ifeq ($(ADK_TARGET_FS
),initramfspiggyback
)
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)'
129 ifeq ($(ADK_TARGET_FS
),nfsroot
)
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"
138 ifeq ($(ADK_TARGET_FS
),squashfs
)
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)'
147 ifeq ($(ADK_TARGET_FS
),jffs2
)
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)'
156 ifeq ($(ADK_TARGET_FS
),genimage
)
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'
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
)
168 @cp
$(KERNEL
) $(BUILD_DIR
)/$(TARGET_KERNEL
)
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
)
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
)
182 ifeq ($(ADK_TARGET_SYSTEM_QEMU_ARM_REALVIEW_EB_MPCORE
),y
)
185 ifeq ($(ADK_TARGET_SYSTEM_QEMU_ARM_VEXPRESS_A9
),y
)
188 ifeq ($(ADK_TARGET_SYSTEM_QEMU_ARM_XILINX_ZYNQ
),y
)
191 ifeq ($(ADK_TARGET_SYSTEM_ST_STM32F746G
),y
)
194 ifeq ($(ADK_TARGET_SYSTEM_SOLIDRUN_IMX6
),y
)
200 ifeq ($(ADK_TARGET_SYSTEM_QEMU_ARM_XILINX_ZYNQ
),y
)
201 ${KERNEL_MAKE} dtbs
$(MAKE_TRACE
)
203 ifeq ($(ADK_TARGET_SYSTEM_QEMU_ARM_VEXPRESS_A9
),y
)
204 ${KERNEL_MAKE} $(VENDOR
)vexpress-v2p-ca9.dtb
$(MAKE_TRACE
)
206 ifeq ($(ADK_TARGET_SYSTEM_QEMU_ARM_REALVIEW_EB_MPCORE
),y
)
207 ${KERNEL_MAKE} $(VENDOR
)arm-realview-eb-11mp-ctrevb.dtb
$(MAKE_TRACE
)
209 ifeq ($(ADK_TARGET_SYSTEM_QEMU_ARM_VERSATILEPB
),y
)
210 ${KERNEL_MAKE} $(VENDOR
)versatile-pb.dtb
$(MAKE_TRACE
)
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
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
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
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
; \
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
; \
236 ifeq ($(ADK_TARGET_SYSTEM_BANANA_PRO
),y
)
237 ${KERNEL_MAKE} sun7i-a20-bananapro.dtb
$(MAKE_TRACE
)
239 ifeq ($(ADK_TARGET_SYSTEM_ORANGE_PI0
),y
)
240 ${KERNEL_MAKE} sun8i-h2-plus-orangepi-zero.dtb
$(MAKE_TRACE
)
242 ifeq ($(ADK_TARGET_SYSTEM_BANANA_P2_ZERO
),y
)
243 ${KERNEL_MAKE} sun8i-h2-plus-bananapi-m2-zero.dtb
$(MAKE_TRACE
)
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
)
249 ifeq ($(ADK_TARGET_SYSTEM_SOLIDRUN_CLEARFOG
),y
)
250 ${KERNEL_MAKE} armada-388-clearfog.dtb
$(MAKE_TRACE
)
252 ifeq ($(ADK_TARGET_SYSTEM_ST_STM32F429
),y
)
253 ${KERNEL_MAKE} dtbs
$(MAKE_TRACE
)
255 ifeq ($(ADK_TARGET_SYSTEM_ST_STM32F769
),y
)
256 ${KERNEL_MAKE} dtbs
$(MAKE_TRACE
)
258 ifeq ($(ADK_TARGET_SYSTEM_ST_STM32F746G
),y
)
259 ${KERNEL_MAKE} $(VENDOR
)stm32f746-disco.dtb
$(MAKE_TRACE
)
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
); \
266 # filesystem specific targets
267 ifeq ($(ADK_TARGET_FS
),archive
)
268 imageinstall
: dtb-install
$(FW_DIR
)/$(ROOTFSTARBALL
) targethelp
270 ifeq ($(ADK_TARGET_FS
),initramfs
)
271 imageinstall
: kernel-install dtb-install
$(FW_DIR
)/$(INITRAMFS
) targethelp
273 ifeq ($(ADK_TARGET_FS
),initramfsarchive
)
274 imageinstall
: kernel-install dtb-install
$(FW_DIR
)/$(ROOTFSUSERTARBALL
) targethelp
276 ifeq ($(ADK_TARGET_FS
),initramfspiggyback
)
277 imageinstall
: dtb-install createinitramfs targethelp
279 ifeq (${ADK_TARGET_FS},genimage
)
280 imageinstall
: dtb-install
$(FW_DIR
)/$(GENIMAGE
) targethelp
282 ifeq ($(ADK_TARGET_FS
),nfsroot
)
283 imageinstall
: kernel-install
$(FW_DIR
)/$(ROOTFSUSERTARBALL
) targethelp
285 ifeq ($(ADK_TARGET_FS
),squashfs
)
286 imageinstall
: $(BUILD_DIR
)/root.squashfs kernel-install dtb-install targethelp
288 ifeq ($(ADK_TARGET_FS
),jffs2
)
289 imageinstall
: kernel-install dtb-install
$(FW_DIR
)/$(ROOTFSJFFS2
) targethelp
291 ifeq ($(ADK_TARGET_FS
),usb
)
292 imageinstall
: $(FW_DIR
)/$(ROOTFSTARBALL
) targethelp