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
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
39 QEMU_ARGS
+=-M versatilepb
-net user
-net nic
,model
=smc91c111
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
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
53 ifeq ($(ADK_TARGET_FS
),archive
)
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'
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!"
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)"
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)"
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"
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)"
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)"
99 ifeq ($(ADK_TARGET_FS
),initramfs
)
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}'
108 ifeq ($(ADK_TARGET_FS
),initramfsarchive
)
110 @echo
'The kernel file is: $(FW_DIR)/${TARGET_KERNEL}'
111 @echo
"The RootFS tarball is: $(FW_DIR)/$(ROOTFSUSERTARBALL)"
113 ifeq ($(ADK_TARGET_FS
),initramfspiggyback
)
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)'
121 ifeq ($(ADK_TARGET_FS
),nfsroot
)
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"
130 ifeq ($(ADK_TARGET_FS
),squashfs
)
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)'
139 ifeq ($(ADK_TARGET_FS
),jffs2
)
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)'
148 ifeq ($(ADK_TARGET_FS
),genimage
)
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'
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
)
160 @cp
$(KERNEL
) $(BUILD_DIR
)/$(TARGET_KERNEL
)
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
)
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
) \
176 ifeq ($(ADK_TARGET_SYSTEM_QEMU_ARM_VEXPRESS_A9
),y
)
177 env
$(KERNEL_MAKE_ENV
) $(MAKE
) -C
"${LINUX_DIR}" $(KERNEL_MAKE_OPTS
) \
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
) \
184 ifeq ($(ADK_TARGET_SYSTEM_PHYTEC_WEGA
),y
)
185 env
$(KERNEL_MAKE_ENV
) $(MAKE
) -C
"${LINUX_DIR}" $(KERNEL_MAKE_OPTS
) \
187 cp
$(LINUX_DIR
)/arch
/arm
/boot
/dts
/am335x-wega-rdk.dtb
${TARGET_DIR}/boot
189 ifeq ($(ADK_TARGET_SYSTEM_BEAGLEBONE_BLACK
),y
)
190 env
$(KERNEL_MAKE_ENV
) $(MAKE
) -C
"${LINUX_DIR}" $(KERNEL_MAKE_OPTS
) \
192 cp
$(LINUX_DIR
)/arch
/arm
/boot
/dts
/am335x-boneblack.dtb
${TARGET_DIR}/boot
194 ifeq ($(ADK_TARGET_BOARD_BCM28XX
),y
)
195 env
$(KERNEL_MAKE_ENV
) $(MAKE
) -C
"${LINUX_DIR}" $(KERNEL_MAKE_OPTS
) \
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
; \
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
)
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
)
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
)
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
)
219 ifeq ($(ADK_TARGET_SYSTEM_ST_STM32F769
),y
)
220 env
$(KERNEL_MAKE_ENV
) $(MAKE
) -C
"${LINUX_DIR}" $(KERNEL_MAKE_OPTS
) \
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
); \
229 # filesystem specific targets
230 ifeq ($(ADK_TARGET_FS
),archive
)
231 imageinstall
: dtb-install
$(FW_DIR
)/$(ROOTFSTARBALL
) targethelp
233 ifeq ($(ADK_TARGET_FS
),initramfs
)
234 imageinstall
: kernel-install dtb-install
$(FW_DIR
)/$(INITRAMFS
) targethelp
236 ifeq ($(ADK_TARGET_FS
),initramfsarchive
)
237 imageinstall
: kernel-install dtb-install
$(FW_DIR
)/$(ROOTFSUSERTARBALL
) targethelp
239 ifeq ($(ADK_TARGET_FS
),initramfspiggyback
)
240 imageinstall
: dtb-install createinitramfs targethelp
242 ifeq (${ADK_TARGET_FS},genimage
)
243 imageinstall
: dtb-install
$(FW_DIR
)/$(GENIMAGE
) targethelp
245 ifeq ($(ADK_TARGET_FS
),nfsroot
)
246 imageinstall
: kernel-install
$(FW_DIR
)/$(ROOTFSUSERTARBALL
) targethelp
248 ifeq ($(ADK_TARGET_FS
),squashfs
)
249 imageinstall
: $(BUILD_DIR
)/root.squashfs kernel-install dtb-install targethelp
251 ifeq ($(ADK_TARGET_FS
),jffs2
)
252 imageinstall
: kernel-install dtb-install
$(FW_DIR
)/$(ROOTFSJFFS2
) targethelp
254 ifeq ($(ADK_TARGET_FS
),usb
)
255 imageinstall
: $(FW_DIR
)/$(ROOTFSTARBALL
) targethelp