1 # SPDX-License-Identifier: GPL-2.0-only
3 include $(TOPDIR
)/rules.mk
4 include $(INCLUDE_DIR
)/image.mk
6 DEVICE_VARS
+= DTB_SIZE
10 mkdir
-p
$@.bootdir
/boot
12 $(CP
) $@.scr
$@.bootdir
/boot
/boot.scr
13 $(CP
) $(IMAGE_KERNEL
).dtb
$@.bootdir
/boot
/$(DEVICE_DTB
)
14 $(CP
) $(IMAGE_KERNEL
) $@.bootdir
/boot
/uImage
16 genext2fs
--block-size
$(BLOCKSIZE
:%k
=%Ki
) \
17 --size-in-blocks
$$((1024 * $(CONFIG_TARGET_KERNEL_PARTSIZE
))) \
18 --root
$@.bootdir
$@.boot
20 # convert it to revision 1 - needed for u-boot ext2load
21 $(STAGING_DIR_HOST
)/bin
/tune2fs
-O filetype
$@.boot
22 $(STAGING_DIR_HOST
)/bin
/e2fsck
-pDf
$@.boot
> /dev
/null
25 define Build
/boot-script
26 $(STAGING_DIR_HOST
)/bin
/mkimage
-A powerpc
-T script
-C none
-n
"$(PROFILE) Boot Script" \
31 define Build
/copy-file
36 $(call Image
/BuildDTB
,..
/dts
/$(DEVICE_DTS
).dts
,$@.dtb
,,--space
$(DTB_SIZE
))
39 define Build
/export-dtb
40 cp
$(IMAGE_KERNEL
).dtb
$@
43 define Build
/MuImage-initramfs
44 rm -rf
$@.fakerd
$@.new
46 dd if
=/dev
/zero of
=$@.fakerd bs
=32 count
=1 conv
=sync
48 # Netgear used an old uboot that doesn't have FIT support.
49 # So we are stuck with either a full ext2/4 fs in a initrd.
50 # ... or we try to make the "multi" image approach to work
53 # Sadly, the "multi" image has to consists of three
54 # "fixed" parts in the following "fixed" order:
55 # 1. The kernel which is in $@
56 # 2. The (fake) initrd which is in $@.fakerd
57 # 3. The device tree binary which is in $@.dtb
59 # Now, given that we use the function for the kernel which
60 # already has a initramfs image inside, we still have to
61 # add a "fake" initrd (which a mkimage header) in the second
62 # part of the legacy multi image. Since we need to put the
63 # device tree stuff into part 3.
65 -$(STAGING_DIR_HOST
)/bin
/mkimage
-A
$(LINUX_KARCH
) -O linux
-T multi \
66 -C
$(1) -a
$(KERNEL_LOADADDR
) -e
$(KERNEL_ENTRY
) \
67 -n
'$(BOARD_NAME) initramfs' -d
$@
:$@.fakerd
:$@.dtb
$@.new
72 define Build
/prepend-dtb
73 cat
"$@.dtb.uimage" "$@" > "$@.new"
78 ( cd
$(TARGET_DIR
); find . | cpio
-o
-H newc | gzip
-9n
>$(KDIR_TMP
)/$(IMG_PREFIX
)-rootfs.cpio.gz
)
83 KERNEL_DEPENDS
= $$(wildcard ..
/dts
/$$(DEVICE_DTS
).dts
)
85 KERNEL_ENTRY
:= 0x00000000
86 KERNEL_LOADADDR
:= 0x00000000
87 DEVICE_DTS_DIR
:= ..
/dts
88 DEVICE_DTS
= $(subst _
,-,$(1))
91 include $(SUBTARGET
).mk
93 $(eval
$(call BuildImage
))