disable debug
[openadk.git] / target / arm / Makefile
blob80c72c93f58f23110fe8695cbc7338e96b374c1a
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.mk
6 include $(ADK_TOPDIR)/mk/modules.mk
7 include $(ADK_TOPDIR)/mk/kernel-build.mk
8 include $(ADK_TOPDIR)/mk/image.mk
10 KERNEL:=$(LINUX_DIR)/$(ADK_TARGET_KERNEL)
11 ifeq ($(ADK_TARGET_KERNEL_ZIMAGE),y)
12 KERNEL:=$(LINUX_DIR)/arch/arm/boot/zImage
13 endif
14 ifeq ($(ADK_TARGET_KERNEL_UIMAGE),y)
15 KERNEL:=$(LINUX_DIR)/arch/arm/boot/uImage
16 endif
18 QEMU_ARGS:=${ADK_QEMU_ARGS}
19 ifeq ($(ADK_TARGET_QEMU_ARM_MODEL_SPITZ),y)
20 QEMU_ARGS+=-M spitz
21 endif
22 ifeq ($(ADK_TARGET_QEMU_ARM_MODEL_TERRIER),y)
23 QEMU_ARGS+=-M terrier
24 endif
25 ifeq ($(ADK_TARGET_QEMU_ARM_MODEL_VERSATILEPB),y)
26 QEMU_ARGS+=-M versatilepb -net user -net nic,model=smc91c111
27 endif
28 ifeq ($(ADK_TARGET_QEMU_ARM_MODEL_VEXPRESS_A9),y)
29 QEMU_ARGS+=-M vexpress-a9 -cpu cortex-a9 -m 256 -net user -net nic,model=lan9118 -dtb $(FW_DIR)/vexpress-v2p-ca9.dtb
30 endif
31 ifeq ($(ADK_TARGET_QEMU_WITH_VIRTIO),y)
32 QEMU_ARGS+=-drive file=qemu-${ADK_TARGET_CPU_ARCH}.img,if=virtio,index=0 -net nic,model=virtio -net user
33 endif
35 # target helper text
36 ifeq ($(ADK_TARGET_FS),archive)
37 targethelp:
38 @echo "The RootFS tarball is: $(FW_DIR)/$(ROOTFSTARBALL)"
39 ifeq ($(ADK_TARGET_QEMU_ARM_MODEL_VERSATILEPB)$(ADK_TARGET_QEMU_ARM_MODEL_TERRIER)$(ADK_TARGET_QEMU_ARM_MODEL_SPITZ),y)
40 @echo 'The kernel file is: $(FW_DIR)/${TARGET_KERNEL}'
41 @echo "Use following command to create a QEMU Image:"
42 @echo "./scripts/create.sh qemu-${ADK_TARGET_CPU_ARCH}.img $(FW_DIR)/$(ROOTFSTARBALL)"
43 @echo "Start qemu with following options:"
44 @echo 'qemu-system-${ADK_TARGET_CPU_ARCH} ${QEMU_ARGS} -kernel $(FW_DIR)/$(TARGET_KERNEL) qemu-${ADK_TARGET_CPU_ARCH}.img'
45 endif
46 ifeq ($(ADK_TARGET_SYSTEM_RASPBERRY_PI),y)
47 ifeq ($(ADK_APPLIANCE_KODI),y)
48 @echo "Use following command to install with a writable data partition"
49 @echo "sudo ./scripts/install.sh -d 256 raspberry-pi /dev/sdX $(FW_DIR)/$(ROOTFSTARBALL)"
50 @echo "If you want to update a card without loosing existing data on the writable partition use:"
51 @echo "sudo ./scripts/install.sh -k -d 256 raspbrry-pi /dev/sdX $(FW_DIR)/$(ROOTFSTARBALL)"
52 @echo "In both cases the cfgfs partition is _not_ removed!"
53 else
54 @echo "Use following command to install it on SD card:"
55 @echo "sudo ./scripts/install.sh raspberry-pi /dev/sdX $(FW_DIR)/$(ROOTFSTARBALL)"
56 endif
57 endif
58 ifeq ($(ADK_TARGET_SYSTEM_RASPBERRY_PI2),y)
59 ifeq ($(ADK_APPLIANCE_KODI),y)
60 @echo "Use following command to install with a writable data partition"
61 @echo "sudo ./scripts/install.sh -d 256 raspberry-pi2 /dev/sdX $(FW_DIR)/$(ROOTFSTARBALL)"
62 @echo "If you want to update a card without loosing existing data on the writable partition use:"
63 @echo "sudo ./scripts/install.sh -k -d 256 raspberry-pi2 /dev/sdX $(FW_DIR)/$(ROOTFSTARBALL)"
64 @echo "In both cases the cfgfs partition is _not_ removed!"
65 else
66 @echo "Use following command to install it on SD card:"
67 @echo "sudo ./scripts/install.sh raspberry-pi2 /dev/sdX $(FW_DIR)/$(ROOTFSTARBALL)"
68 @echo "Use following command to install with a writable data partition"
69 @echo "sudo ./scripts/install.sh -d 256 raspberry-pi2 /dev/sdX $(FW_DIR)/$(ROOTFSTARBALL)"
70 endif
71 endif
72 ifeq ($(ADK_TARGET_SYSTEM_BANANA_PRO),y)
73 @echo "Use following command to install it on SD card:"
74 @echo "sudo ./scripts/install.sh banana-pro /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 banana-pro /dev/sdX $(FW_DIR)/$(ROOTFSTARBALL)"
77 endif
78 ifeq ($(ADK_TARGET_SYSTEM_SOLIDRUN_IMX6),y)
79 ifeq ($(ADK_APPLIANCE_KODI),y)
80 @echo "Use following command to install with a writable data partition"
81 @echo "sudo ./scripts/install.sh -d 256 solidrun-imx6 /dev/sdX $(FW_DIR)/$(ROOTFSTARBALL)"
82 @echo "If you want to update a card without loosing existing data on the writable partition use:"
83 @echo "sudo ./scripts/install.sh -k -d 256 solidrun-imx6 /dev/sdX $(FW_DIR)/$(ROOTFSTARBALL)"
84 @echo "In both cases the cfgfs partition is _not_ removed!"
85 else
86 @echo "Use following command to install it on SD card:"
87 @echo "sudo ./scripts/install.sh solidrun-imx6 /dev/sdX $(FW_DIR)/$(ROOTFSTARBALL)"
88 endif
89 endif
90 endif
91 ifeq ($(ADK_TARGET_FS),initramfs)
92 targethelp:
93 @echo 'The kernel file is: $(FW_DIR)/${TARGET_KERNEL}'
94 @echo 'The initramfs image is: ${FW_DIR}/${INITRAMFS}'
95 ifeq ($(ADK_TARGET_QEMU),y)
96 @echo "Start qemu with following command line:"
97 @echo 'qemu-system-${ADK_TARGET_CPU_ARCH} ${QEMU_ARGS} -kernel $(FW_DIR)/$(TARGET_KERNEL) -initrd ${FW_DIR}/${INITRAMFS}'
98 endif
99 endif
100 ifeq ($(ADK_TARGET_FS),initramfsarchive)
101 targethelp:
102 @echo 'The kernel file is: $(FW_DIR)/${TARGET_KERNEL}'
103 @echo "The RootFS tarball is: $(FW_DIR)/$(ROOTFSUSERTARBALL)"
104 endif
105 ifeq ($(ADK_TARGET_FS),initramfspiggyback)
106 targethelp:
107 @echo 'The kernel+initramfs file is: $(FW_DIR)/${TARGET_KERNEL}'
108 ifeq ($(ADK_TARGET_QEMU),y)
109 @echo "Start qemu with following command line:"
110 @echo 'qemu-system-${ADK_TARGET_CPU_ARCH} ${QEMU_ARGS} -kernel $(FW_DIR)/$(TARGET_KERNEL)'
111 endif
112 endif
113 ifeq ($(ADK_TARGET_FS),nfsroot)
114 targethelp:
115 @echo 'The kernel file is: $(FW_DIR)/${TARGET_KERNEL}'
116 @echo "The RootFS tarball is: $(FW_DIR)/$(ROOTFSUSERTARBALL)"
117 endif
119 kernel-strip:
120 @cp $(KERNEL) $(BUILD_DIR)/$(TARGET_KERNEL)
121 ifeq ($(ADK_TARGET_SYSTEM_RASPBERRY_PI),y)
122 @echo adding DT trailer to kernel $(MAKE_TRACE)
123 -rm $(BUILD_DIR)/$(TARGET_KERNEL)
124 $(ADK_TOPDIR)/scripts/mkknlimg --dtok $(KERNEL) $(BUILD_DIR)/$(TARGET_KERNEL) $(MAKE_TRACE)
125 endif
126 ifeq ($(ADK_TARGET_SYSTEM_RASPBERRY_PI2),y)
127 @echo adding DT trailer to kernel $(MAKE_TRACE)
128 -rm $(BUILD_DIR)/$(TARGET_KERNEL)
129 $(ADK_TOPDIR)/scripts/mkknlimg --dtok $(KERNEL) $(BUILD_DIR)/$(TARGET_KERNEL) $(MAKE_TRACE)
130 endif
132 kernel-install: kernel-strip
133 @cp $(BUILD_DIR)/$(TARGET_KERNEL) $(FW_DIR)/$(TARGET_KERNEL)
135 dtb-install:
136 ifeq ($(ADK_TARGET_QEMU_ARM_MODEL_VEXPRESS_A9),y)
137 env $(KERNEL_MAKE_ENV) $(MAKE) -C "${LINUX_DIR}" $(KERNEL_MAKE_OPTS) \
138 dtbs $(MAKE_TRACE)
139 endif
140 ifeq ($(ADK_TARGET_SYSTEM_RASPBERRY_PI),y)
141 env $(KERNEL_MAKE_ENV) $(MAKE) -C "${LINUX_DIR}" $(KERNEL_MAKE_OPTS) \
142 dtbs $(MAKE_TRACE)
143 endif
144 ifeq ($(ADK_TARGET_SYSTEM_RASPBERRY_PI2),y)
145 env $(KERNEL_MAKE_ENV) $(MAKE) -C "${LINUX_DIR}" $(KERNEL_MAKE_OPTS) \
146 dtbs $(MAKE_TRACE)
147 endif
148 ifeq ($(ADK_TARGET_SYSTEM_SOLIDRUN_IMX6),y)
149 env $(KERNEL_MAKE_ENV) $(MAKE) -C "${LINUX_DIR}" $(KERNEL_MAKE_OPTS) \
150 imx6q-cubox-i.dtb imx6dl-cubox-i.dtb imx6dl-hummingboard.dtb imx6q-hummingboard.dtb $(MAKE_TRACE)
151 endif
152 for x in $(LINUX_DIR)/arch/arm/boot/dts/*.dtb; do \
153 [[ -e "$$x" ]] && cp $(LINUX_DIR)/arch/arm/boot/dts/*.dtb $(FW_DIR); \
154 break; \
155 done
157 # filesystem specific targets
158 ifeq ($(ADK_TARGET_FS),archive)
159 imageinstall: dtb-install $(FW_DIR)/$(ROOTFSTARBALL) targethelp
160 endif
161 ifeq ($(ADK_TARGET_FS),initramfs)
162 imageinstall: kernel-install dtb-install $(FW_DIR)/$(INITRAMFS) targethelp
163 endif
164 ifeq ($(ADK_TARGET_FS),initramfsarchive)
165 imageinstall: kernel-install dtb-install $(FW_DIR)/$(ROOTFSUSERTARBALL) targethelp
166 endif
167 ifeq ($(ADK_TARGET_FS),initramfspiggyback)
168 imageinstall: dtb-install createinitramfs targethelp
169 endif
170 ifeq ($(ADK_TARGET_FS),nfsroot)
171 imageinstall: kernel-install $(FW_DIR)/$(ROOTFSUSERTARBALL) targethelp
172 endif
173 ifeq ($(ADK_TARGET_FS),usb)
174 imageinstall: $(FW_DIR)/$(ROOTFSTARBALL) targethelp
175 endif