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