linux 4.15.4: add missing patches
[openadk.git] / mk / image.mk
blob461c981258e7f351ab226bc2cee095b39d51ba3e
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 ifeq ($(ADK_RUNTIME_FIX_PERMISSION),y)
5 FAKEROOT:=$(STAGING_HOST_DIR)/usr/bin/fakeroot --
6 else
7 FAKEROOT:=
8 endif
10 ifeq ($(ADK_TARGET_OS_LINUX),y)
11 # relative paths, like 'mksh' or '../usr/bin/foosh'
12 ifeq (${ADK_BINSH_ASH},y)
13 BINSH:=ash
14 else ifeq (${ADK_BINSH_BASH},y)
15 BINSH:=bash
16 else ifeq (${ADK_BINSH_SASH},y)
17 BINSH:=sash
18 else ifeq (${ADK_BINSH_HUSH},y)
19 BINSH:=hush
20 else ifeq (${ADK_BINSH_MKSH},y)
21 BINSH:=mksh
22 else ifeq (${ADK_BINSH_ZSH},y)
23 BINSH:=zsh
24 else
25 $(error No /bin/sh configured!)
26 endif
28 # absolute paths
29 ifeq (${ADK_ROOTSH_ASH},y)
30 ROOTSH:=/bin/ash
31 else ifeq (${ADK_ROOTSH_BASH},y)
32 ROOTSH:=/bin/bash
33 else ifeq (${ADK_ROOTSH_SASH},y)
34 ROOTSH:=/bin/sash
35 else ifeq (${ADK_ROOTSH_HUSH},y)
36 ROOTSH:=/bin/hush
37 else ifeq (${ADK_ROOTSH_MKSH},y)
38 ROOTSH:=/bin/mksh
39 else ifeq (${ADK_ROOTSH_TCSH},y)
40 ROOTSH:=/usr/bin/tcsh
41 else ifeq (${ADK_ROOTSH_ZSH},y)
42 ROOTSH:=/bin/zsh
43 else
44 $(error No login shell configured!)
45 endif
46 endif
48 imageprepare: image-prepare-post extra-install prelink
50 # if an extra directory exist in ADK_TOPDIR, copy all content over the
51 # root directory, do the same if make extra=/dir/to/extra is used
52 extra-install:
53 @-if [ -h ${TARGET_DIR}/etc/resolv.conf -a -f $(ADK_TOPDIR)/extra/etc/resolv.conf ];then \
54 rm ${TARGET_DIR}/etc/resolv.conf;\
56 @if test -d '${ADK_TOPDIR}/extra'; then \
57 (cd '${ADK_TOPDIR}/extra' && tar -cf - .) | \
58 (cd ${TARGET_DIR}; tar -xf -); \
60 ifneq (,$(strip ${extra}))
61 @(cd '${extra}' && tar -cf - .) | (cd ${TARGET_DIR}; tar -xf -)
62 endif
64 image-prepare-post:
65 $(BASH) $(ADK_TOPDIR)/scripts/update-rcconf
66 rng=/dev/arandom; test -e $$rng || rng=/dev/urandom; \
67 dd if=$$rng bs=512 count=1 >>${TARGET_DIR}/etc/.rnd 2>/dev/null; \
68 chmod 600 ${TARGET_DIR}/etc/.rnd
69 -for dir in X11 truetype; do \
70 if [ -d ${TARGET_DIR}/usr/share/fonts/$${dir} ];then \
71 for i in $$(ls ${TARGET_DIR}/usr/share/fonts/$${dir}/);do \
72 mkfontdir ${TARGET_DIR}/usr/share/fonts/$${dir}/$${i}; \
73 mkfontscale ${TARGET_DIR}/usr/share/fonts/$${dir}/$${i}; \
74 done; \
75 fi; \
76 done
77 $(SED) '/^root:/s!:/bin/sh$$!:${ROOTSH}!' ${TARGET_DIR}/etc/passwd
78 -rm -f ${TARGET_DIR}/bin/sh
79 ln -sf ${BINSH} ${TARGET_DIR}/bin/sh
81 ifeq ($(ADK_RUNTIME_INIT_SYSTEMD),y)
82 ln -fs ../usr/${ADK_TARGET_LIBC_PATH}/systemd/systemd $(TARGET_DIR)/sbin/init
83 ln -fs ../usr/bin/systemctl $(TARGET_DIR)/sbin/halt
84 ln -fs ../usr/bin/systemctl $(TARGET_DIR)/sbin/poweroff
85 ln -fs ../usr/bin/systemctl $(TARGET_DIR)/sbin/reboot
86 endif
87 test -z $(GIT) || \
88 $(GIT) log -1|head -1|sed -e 's#commit ##' \
89 > $(TARGET_DIR)/etc/.adkgithash
90 echo $(ADK_APPLIANCE_VERSION) > $(TARGET_DIR)/etc/.adkversion
91 echo $(ADK_TARGET_SYSTEM) > $(TARGET_DIR)/etc/.adktarget
92 $(TARGET_CC) -v 2> $(TARGET_DIR)/etc/.adkcompiler
93 $(TARGET_LD) -v > $(TARGET_DIR)/etc/.adklinker
94 ifneq (${ADK_PACKAGE_CONFIG_IN_ETC},)
95 gzip -9c ${ADK_TOPDIR}/.config > $(TARGET_DIR)/etc/adkconfig.gz
96 chmod 600 $(TARGET_DIR)/etc/adkconfig.gz
97 endif
98 ifneq ($(ADK_TARGET_ARCH_AARCH64)$(ADK_TARGET_ARCH_X86_64)$(ADK_TARGET_ARCH_PPC64)$(ADK_TARGET_ARCH_SPARC64)$(ADK_TARGET_ABI_N32)$(ADK_TARGET_ABI_N64),)
99 test ! -d ${TARGET_DIR}/lib || mv ${TARGET_DIR}/lib/* ${TARGET_DIR}/${ADK_TARGET_LIBC_PATH}
100 test ! -d ${TARGET_DIR}/lib || rm -rf ${TARGET_DIR}/lib
101 ln -sf /${ADK_TARGET_LIBC_PATH} ${TARGET_DIR}/lib
102 mkdir -p ${TARGET_DIR}/usr/${ADK_TARGET_LIBC_PATH} 2>/dev/null
103 -test ! -d ${TARGET_DIR}/usr/lib || mv ${TARGET_DIR}/usr/lib/* ${TARGET_DIR}/usr/${ADK_TARGET_LIBC_PATH} 2>/dev/null
104 test ! -d ${TARGET_DIR}/usr/lib || rm -rf ${TARGET_DIR}/usr/lib/
105 (cd ${TARGET_DIR}/usr ; ln -sf ${ADK_TARGET_LIBC_PATH} lib)
106 endif
107 ifeq ($(ADK_TARGET_ARCH_S390),y)
108 (cd ${TARGET_DIR}/; ln -sf lib lib64)
109 endif
111 ifeq (${ADK_PRELINK},)
112 prelink:
113 else
114 ${TARGET_DIR}/etc/prelink.conf:
115 echo '/' > $@
117 prelink: ${TARGET_DIR}/etc/prelink.conf
118 $(TRACE) target/prelink
119 ${TARGET_CROSS}prelink ${ADK_PRELINK_OPTS} \
120 --ld-library-path=${STAGING_TARGET_DIR}/usr/lib:${STAGING_TARGET_DIR}/lib \
121 --root=${TARGET_DIR} -a $(MAKE_TRACE)
122 endif
124 KERNEL_PKGDIR:=$(LINUX_BUILD_DIR)/kernel-pkg
125 KERNEL_PKG:=$(PACKAGE_DIR)/kernel_$(KERNEL_VERSION)_$(ADK_TARGET_CPU_ARCH).$(PKG_SUFFIX)
126 TARGET_KERNEL= ${ADK_TARGET_SYSTEM}-${ADK_TARGET_FS}-kernel
127 INITRAMFS= ${ADK_TARGET_SYSTEM}-${ADK_TARGET_LIBC}-${ADK_TARGET_FS}
128 ROOTFSSQUASHFS= ${ADK_TARGET_SYSTEM}-${ADK_TARGET_LIBC}-${ADK_TARGET_FS}.img
129 ROOTFSJFFS2= ${ADK_TARGET_SYSTEM}-${ADK_TARGET_LIBC}-jffs2.img
130 ROOTFSUBIFS= ${ADK_TARGET_SYSTEM}-${ADK_TARGET_LIBC}-ubifs.img
131 ROOTFSTARBALL= ${ADK_TARGET_SYSTEM}-${ADK_TARGET_LIBC}-${ADK_TARGET_FS}+kernel.tar.xz
132 ROOTFSUSERTARBALL= ${ADK_TARGET_SYSTEM}-${ADK_TARGET_LIBC}-${ADK_TARGET_FS}.tar.xz
133 ROOTFSISO= ${ADK_TARGET_SYSTEM}-${ADK_TARGET_LIBC}.iso
135 kernel-package: kernel-strip
136 $(START_TRACE) "target/$(ADK_TARGET_ARCH)-create-kernel-package.. "
137 rm -rf $(KERNEL_PKGDIR)
138 ifeq ($(ADK_TARGET_DUAL_BOOT),y)
139 @mkdir -p $(KERNEL_PKGDIR)
140 cp $(BUILD_DIR)/$(TARGET_KERNEL) $(KERNEL_PKGDIR)/kernel
141 else
142 @mkdir -p $(KERNEL_PKGDIR)/boot
143 cp $(BUILD_DIR)/$(TARGET_KERNEL) $(KERNEL_PKGDIR)/boot/kernel
144 endif
145 @${BASH} ${SCRIPT_DIR}/make-ipkg-dir.sh ${KERNEL_PKGDIR} \
146 ../linux/kernel.control ${KERNEL_VERSION} ${ADK_TARGET_CPU_ARCH}
147 PATH='$(HOST_PATH)' $(PKG_BUILD) $(KERNEL_PKGDIR) $(PACKAGE_DIR) $(MAKE_TRACE)
148 $(PKG_INSTALL) $(KERNEL_PKG) $(MAKE_TRACE)
149 $(CMD_TRACE) " done"
150 $(END_TRACE)
152 ${FW_DIR}/${ROOTFSTARBALL}: ${TARGET_DIR}/.adk kernel-package
153 cd ${TARGET_DIR}; find . | sed -n '/^\.\//s///p' | sort | \
154 $(CPIO) --quiet -o -Hustar --owner=0:0 | $(XZ) -c >$@
155 ifeq ($(ADK_TARGET_QEMU),y)
156 @cp $(KERNEL) $(FW_DIR)/$(TARGET_KERNEL)
157 endif
159 ${FW_DIR}/${ROOTFSUSERTARBALL}: ${TARGET_DIR}/.adk
160 cd ${TARGET_DIR}; find . | grep -v ./boot/ | sed -n '/^\.\//s///p' | sort | \
161 $(CPIO) --quiet -o -Hustar --owner=0:0 | $(XZ) -c >$@
163 ${STAGING_TARGET_DIR}/${INITRAMFS}_list: ${TARGET_DIR}/.adk
164 PATH='${HOST_PATH}' $(BASH) ${LINUX_DIR}/scripts/gen_initramfs_list.sh -u squash -g squash \
165 ${TARGET_DIR}/ >$@
167 echo "nod /dev/console 0644 0 0 c 5 1"; \
168 echo "nod /dev/tty 0644 0 0 c 5 0"; \
169 for i in 0 1 2 3 4; do \
170 echo "nod /dev/tty$$i 0644 0 0 c 4 $$$$i"; \
171 done; \
172 echo "nod /dev/null 0644 0 0 c 1 3"; \
173 echo "nod /dev/ram 0655 0 0 b 1 1"; \
174 echo "nod /dev/ttyS0 0660 0 0 c 4 64"; \
175 echo "nod /dev/ttyS1 0660 0 0 c 4 65"; \
176 echo "nod /dev/ttyB0 0660 0 0 c 11 0"; \
177 echo "nod /dev/ttyB1 0660 0 0 c 11 1"; \
178 echo "nod /dev/ttyAMA0 0660 0 0 c 204 64"; \
179 echo "nod /dev/ttyAMA1 0660 0 0 c 204 65"; \
180 echo "nod /dev/ttySC0 0660 0 0 c 204 8"; \
181 echo "nod /dev/ttySC1 0660 0 0 c 204 9"; \
182 echo "nod /dev/ttySC2 0660 0 0 c 204 10"; \
183 echo "nod /dev/ttyBF0 0660 0 0 c 204 64"; \
184 echo "nod /dev/ttyBF1 0660 0 0 c 204 65"; \
185 echo "nod /dev/ttyUL0 0660 0 0 c 204 187"; \
186 echo "nod /dev/ttyUL1 0660 0 0 c 204 188"; \
187 ) >>$@
190 ${FW_DIR}/${INITRAMFS}: ${STAGING_TARGET_DIR}/${INITRAMFS}_list
191 ${LINUX_DIR}/usr/gen_init_cpio ${STAGING_TARGET_DIR}/${INITRAMFS}_list | \
192 ${ADK_COMPRESSION_TOOL} -c >$@
194 ${BUILD_DIR}/root.squashfs: ${TARGET_DIR}/.adk
195 ${STAGING_HOST_DIR}/usr/bin/mksquashfs ${TARGET_DIR} \
196 ${BUILD_DIR}/root.squashfs -comp xz \
197 -nopad -noappend -root-owned $(MAKE_TRACE)
199 ${FW_DIR}/${ROOTFSJFFS2}: ${TARGET_DIR}
200 PATH='${HOST_PATH}' mkfs.jffs2 $(ADK_JFFS2_OPTS) -q -r ${TARGET_DIR} \
201 --pad=$(ADK_TARGET_MTD_SIZE) -o ${FW_DIR}/${ROOTFSJFFS2} $(MAKE_TRACE)
203 ${FW_DIR}/${ROOTFSUBIFS}: ${TARGET_DIR}
205 PATH='${HOST_PATH}'; \
206 SP_SIZE='${ADK_TARGET_FLASH_SUBPAGE_SIZE}'; \
207 PG_SIZE='${ADK_TARGET_FLASH_PAGE_SIZE}'; \
208 LEB_SIZE=$$(((($$SP_SIZE + $$PG_SIZE) / $$PG_SIZE) * $$PG_SIZE)); \
209 mkfs.ubifs -r ${TARGET_DIR} \
210 -m $$PG_SIZE \
211 -e $$((${ADK_TARGET_FLASH_PEB_SIZE} - $$LEB_SIZE)) \
212 -c $$(((${ADK_TARGET_MTD_SIZE} / $$LEB_SIZE))) \
213 -o ${FW_DIR}/rootfs.ubifs; \
214 cd ${FW_DIR} && ubinize -o $@ \
215 -p ${ADK_TARGET_FLASH_PEB_SIZE} \
216 -m ${ADK_TARGET_FLASH_PAGE_SIZE} \
217 -s ${ADK_TARGET_FLASH_SUBPAGE_SIZE} \
218 "${ADK_TOPDIR}/target/${ADK_TARGET_ARCH}/${ADK_TARGET_SYSTEM}/ubinize.cfg"; \
219 ) $(MAKE_TRACE)
221 createinitramfs: ${STAGING_TARGET_DIR}/${INITRAMFS}_list
222 ${SED} 's/.*CONFIG_\(RD_\|BLK_DEV_INITRD\|INITRAMFS_\).*//' \
223 ${LINUX_DIR}/.config
225 echo "CONFIG_BLK_DEV_INITRD=y"; \
226 echo "CONFIG_ACPI_INITRD_TABLE_OVERRIDE=n"; \
227 echo 'CONFIG_INITRAMFS_SOURCE="${STAGING_TARGET_DIR}/${INITRAMFS}_list"'; \
228 echo '# CONFIG_INITRAMFS_COMPRESSION_NONE is not set'; \
229 echo 'CONFIG_CRC32_BIT=y'; \
230 echo '# CONFIG_CRC32_SELFTEST is not set'; \
231 echo '# CONFIG_CRC32_SLICEBY8 is not set'; \
232 echo '# CONFIG_CRC32_SLICEBY4 is not set'; \
233 echo '# CONFIG_CRC32_SARWATE is not set'; \
234 echo 'CONFIG_INITRAMFS_ROOT_UID=0'; \
235 echo 'CONFIG_INITRAMFS_ROOT_GID=0'; \
236 echo 'CONFIG_INITRAMFS_IS_LARGE=n'; \
237 ) >> ${LINUX_DIR}/.config
238 ifeq ($(ADK_KERNEL_COMP_XZ),y)
239 echo "CONFIG_RD_BZIP2=n" >> ${LINUX_DIR}/.config
240 echo "CONFIG_RD_GZIP=n" >> ${LINUX_DIR}/.config
241 echo "CONFIG_RD_LZMA=n" >> ${LINUX_DIR}/.config
242 echo "CONFIG_RD_LZ4=n" >> ${LINUX_DIR}/.config
243 echo "CONFIG_RD_LZO=n" >> ${LINUX_DIR}/.config
244 echo "CONFIG_RD_XZ=y" >> ${LINUX_DIR}/.config
245 echo "CONFIG_INITRAMFS_COMPRESSION_XZ=y" >> ${LINUX_DIR}/.config
246 echo "CONFIG_XZ_DEC_X86=n" >> ${LINUX_DIR}/.config
247 echo "CONFIG_XZ_DEC_POWERPC=n" >> ${LINUX_DIR}/.config
248 echo "CONFIG_XZ_DEC_IA64=n" >> ${LINUX_DIR}/.config
249 echo "CONFIG_XZ_DEC_ARM=n" >> ${LINUX_DIR}/.config
250 echo "CONFIG_XZ_DEC_ARMTHUMB=n" >> ${LINUX_DIR}/.config
251 echo "CONFIG_XZ_DEC_SPARC=n" >> ${LINUX_DIR}/.config
252 echo "CONFIG_XZ_DEC_TEST=n" >> ${LINUX_DIR}/.config
253 endif
254 ifeq ($(ADK_KERNEL_COMP_LZ4),y)
255 echo "CONFIG_RD_XZ=n" >> ${LINUX_DIR}/.config
256 echo "CONFIG_RD_BZIP2=n" >> ${LINUX_DIR}/.config
257 echo "CONFIG_RD_GZIP=n" >> ${LINUX_DIR}/.config
258 echo "CONFIG_RD_LZO=n" >> ${LINUX_DIR}/.config
259 echo "CONFIG_RD_LZ4=y" >> ${LINUX_DIR}/.config
260 echo "CONFIG_RD_LZMA=n" >> ${LINUX_DIR}/.config
261 echo "CONFIG_INITRAMFS_COMPRESSION_LZ4=y" >> ${LINUX_DIR}/.config
262 endif
263 ifeq ($(ADK_KERNEL_COMP_LZMA),y)
264 echo "CONFIG_RD_XZ=n" >> ${LINUX_DIR}/.config
265 echo "CONFIG_RD_BZIP2=n" >> ${LINUX_DIR}/.config
266 echo "CONFIG_RD_GZIP=n" >> ${LINUX_DIR}/.config
267 echo "CONFIG_RD_LZO=n" >> ${LINUX_DIR}/.config
268 echo "CONFIG_RD_LZ4=n" >> ${LINUX_DIR}/.config
269 echo "CONFIG_RD_LZMA=y" >> ${LINUX_DIR}/.config
270 echo "CONFIG_INITRAMFS_COMPRESSION_LZMA=y" >> ${LINUX_DIR}/.config
271 endif
272 ifeq ($(ADK_KERNEL_COMP_LZO),y)
273 echo "CONFIG_RD_XZ=n" >> ${LINUX_DIR}/.config
274 echo "CONFIG_RD_BZIP2=n" >> ${LINUX_DIR}/.config
275 echo "CONFIG_RD_GZIP=n" >> ${LINUX_DIR}/.config
276 echo "CONFIG_RD_LZMA=n" >> ${LINUX_DIR}/.config
277 echo "CONFIG_RD_LZ4=n" >> ${LINUX_DIR}/.config
278 echo "CONFIG_RD_LZO=y" >> ${LINUX_DIR}/.config
279 echo "CONFIG_INITRAMFS_COMPRESSION_LZO=y" >> ${LINUX_DIR}/.config
280 endif
281 ifeq ($(ADK_KERNEL_COMP_GZIP),y)
282 echo "CONFIG_RD_XZ=n" >> ${LINUX_DIR}/.config
283 echo "CONFIG_RD_BZIP2=n" >> ${LINUX_DIR}/.config
284 echo "CONFIG_RD_LZO=n" >> ${LINUX_DIR}/.config
285 echo "CONFIG_RD_LZMA=n" >> ${LINUX_DIR}/.config
286 echo "CONFIG_RD_LZ4=n" >> ${LINUX_DIR}/.config
287 echo "CONFIG_RD_GZIP=y" >> ${LINUX_DIR}/.config
288 echo "CONFIG_INITRAMFS_COMPRESSION_GZIP=y" >> ${LINUX_DIR}/.config
289 endif
290 ifeq ($(ADK_KERNEL_COMP_BZIP2),y)
291 echo "CONFIG_RD_XZ=n" >> ${LINUX_DIR}/.config
292 echo "CONFIG_RD_GZIP=n" >> ${LINUX_DIR}/.config
293 echo "CONFIG_RD_LZMA=n" >> ${LINUX_DIR}/.config
294 echo "CONFIG_RD_LZO=n" >> ${LINUX_DIR}/.config
295 echo "CONFIG_RD_LZ4=n" >> ${LINUX_DIR}/.config
296 echo "CONFIG_RD_BZIP2=y" >> ${LINUX_DIR}/.config
297 echo "CONFIG_INITRAMFS_COMPRESSION_BZIP2=y" >> ${LINUX_DIR}/.config
298 endif
299 ifeq ($(ADK_KERNEL_COMPRESS_NONE),y)
300 echo "CONFIG_RD_XZ=n" >> ${LINUX_DIR}/.config
301 echo "CONFIG_RD_BZIP2=n" >> ${LINUX_DIR}/.config
302 echo "CONFIG_RD_LZO=n" >> ${LINUX_DIR}/.config
303 echo "CONFIG_RD_LZMA=n" >> ${LINUX_DIR}/.config
304 echo "CONFIG_RD_LZ4=n" >> ${LINUX_DIR}/.config
305 echo "CONFIG_RD_GZIP=n" >> ${LINUX_DIR}/.config
306 endif
307 @-rm $(LINUX_DIR)/usr/initramfs_data.cpio* 2>/dev/null
308 env $(KERNEL_MAKE_ENV) $(MAKE) -C "${LINUX_DIR}" $(KERNEL_MAKE_OPTS) \
309 -j${ADK_MAKE_JOBS} $(ADK_TARGET_KERNEL) $(MAKE_TRACE)
310 @cp $(KERNEL) $(FW_DIR)/$(TARGET_KERNEL)
312 ${FW_DIR}/${ROOTFSISO}: ${TARGET_DIR} kernel-package
313 mkdir -p ${TARGET_DIR}/boot/syslinux
314 cp ${STAGING_HOST_DIR}/usr/share/syslinux/{isolinux.bin,ldlinux.c32} \
315 ${TARGET_DIR}/boot/syslinux
316 echo 'DEFAULT /boot/kernel root=/dev/sr0' > \
317 ${TARGET_DIR}/boot/syslinux/isolinux.cfg
318 PATH='${HOST_PATH}' mkisofs -R -uid 0 -gid 0 -o $@ \
319 -b boot/syslinux/isolinux.bin \
320 -c boot/syslinux/boot.cat -no-emul-boot \
321 -boot-load-size 4 -boot-info-table ${TARGET_DIR}
323 ifeq (,$(wildcard $(ADK_TOPDIR)/target/$(ADK_TARGET_ARCH)/$(ADK_TARGET_SYSTEM)/$(ADK_TARGET_GENIMAGE_FILENAME)))
324 GENCFG:=$(ADK_TOPDIR)/adk/genimage/$(ADK_TARGET_GENIMAGE_FILENAME)
325 else
326 GENCFG:=$(ADK_TOPDIR)/target/$(ADK_TARGET_ARCH)/$(ADK_TARGET_SYSTEM)/$(ADK_TARGET_GENIMAGE_FILENAME)
327 endif
329 ${FW_DIR}/${GENIMAGE}: ${TARGET_DIR} kernel-package
330 @rm -rf ${FW_DIR}/temp
331 @mkdir -p ${FW_DIR}/temp
332 @$(CP) $(KERNEL) $(FW_DIR)/kernel
333 @dd if=/dev/zero of=${FW_DIR}/cfgfs.img bs=16384 count=1 $(MAKE_TRACE)
334 ifeq ($(ADK_RUNTIME_FIX_PERMISSION),y)
335 echo '#!/bin/sh' > $(ADK_TOPDIR)/scripts/fakeroot.sh
336 echo "chown -R 0:0 $(TARGET_DIR)" >> $(ADK_TOPDIR)/scripts/fakeroot.sh
337 echo 'cd $(TARGET_DIR)' >> $(ADK_TOPDIR)/scripts/fakeroot.sh
338 -@cat $(STAGING_TARGET_DIR)/scripts/permissions.sh >> $(ADK_TOPDIR)/scripts/fakeroot.sh 2>/dev/null
339 chmod 755 $(ADK_TOPDIR)/scripts/fakeroot.sh
340 PATH='$(HOST_PATH)' $(FAKEROOT) $(ADK_TOPDIR)/scripts/fakeroot.sh
341 rm $(ADK_TOPDIR)/scripts/fakeroot.sh $(STAGING_TARGET_DIR)/scripts/permissions.sh
342 endif
343 PATH='${HOST_PATH}' $(FAKEROOT) mke2img \
344 -G 4 \
345 -d "$(TARGET_DIR)" \
346 -o $(FW_DIR)/rootfs.ext $(MAKE_TRACE)
347 PATH='${HOST_PATH}' genimage \
348 --config "$(GENCFG)" \
349 --tmppath "${FW_DIR}/temp" \
350 --rootpath "$(TARGET_DIR)" \
351 --inputpath "$(FW_DIR)" \
352 --outputpath "$(FW_DIR)" $(MAKE_TRACE)
353 ifeq ($(ADK_TARGET_DUAL_BOOT),y)
354 (cd ${TARGET_DIR}; find . | grep -v ./boot/ | sed -n '/^\.\//s///p' | sort | \
355 PATH='${HOST_PATH}' $(CPIO) -o --quiet -Hustar --owner=0:0 | \
356 ${XZ} -c > ${FW_DIR}/openadk.tar.xz)
357 (cd ${FW_DIR}; PATH='${HOST_PATH}' sha256sum openadk.tar.xz \
358 | cut -d\ -f1 > sha256.txt)
359 (cd ${FW_DIR}; PATH='${HOST_PATH}' tar -cf ${ADK_TARGET_SYSTEM}-update.tar openadk.tar.xz sha256.txt)
360 @rm -rf ${FW_DIR}/temp
361 endif
362 ifeq ($(ADK_PACKAGE_GRUB_EFI_X86)$(ADK_PACKAGE_GRUB_EFI_X86_64),y)
363 @if [ ! -f $(ADK_TOPDIR)/bios-$(ADK_TARGET_ARCH).bin ]; then \
364 cd $(ADK_TOPDIR); wget http://distfiles.openadk.org/bios-$(ADK_TARGET_ARCH).bin ;\
366 endif
368 imageclean:
369 rm -f $(FW_DIR)/$(ADK_TARGET_SYSTEM)-* ${BUILD_DIR}/$(ADK_TARGET_SYSTEM)-*