2 # This is free software, licensed under the GNU General Public License v2.
3 # See /LICENSE for more information.
5 include $(TOPDIR
)/rules.mk
6 include $(INCLUDE_DIR
)/image.mk
8 DEVICE_VARS
+= DTB_SIZE
12 mkdir
-p
$@.bootdir
/boot
14 $(CP
) $@.scr
$@.bootdir
/boot
/boot.scr
15 $(CP
) $(IMAGE_KERNEL
).dtb
$@.bootdir
/boot
/$(DEVICE_DTB
)
16 $(CP
) $(IMAGE_KERNEL
) $@.bootdir
/boot
/uImage
18 genext2fs
--block-size
$(BLOCKSIZE
:%k
=%Ki
) \
19 --size-in-blocks
$$((1024 * $(CONFIG_TARGET_KERNEL_PARTSIZE
))) \
20 --root
$@.bootdir
$@.boot
22 # convert it to revision 1 - needed for u-boot ext2load
23 $(STAGING_DIR_HOST
)/bin
/tune2fs
-O filetype
$@.boot
24 $(STAGING_DIR_HOST
)/bin
/e2fsck
-pDf
$@.boot
> /dev
/null
27 define Build
/boot-script
28 $(STAGING_DIR_HOST
)/bin
/mkimage
-A powerpc
-T script
-C none
-n
"$(PROFILE) Boot Script" \
33 define Build
/copy-file
38 $(call Image
/BuildDTB
,..
/dts
/$(DEVICE_DTS
).dts
,$@.dtb
,,--space
$(DTB_SIZE
))
41 define Build
/export-dtb
42 cp
$(IMAGE_KERNEL
).dtb
$@
45 define Build
/MuImage-initramfs
46 rm -rf
$@.fakerd
$@.new
48 dd if
=/dev
/zero of
=$@.fakerd bs
=32 count
=1 conv
=sync
50 # Netgear used an old uboot that doesn't have FIT support.
51 # So we are stuck with either a full ext2/4 fs in a initrd.
52 # ... or we try to make the "multi" image approach to work
55 # Sadly, the "multi" image has to consists of three
56 # "fixed" parts in the following "fixed" order:
57 # 1. The kernel which is in $@
58 # 2. The (fake) initrd which is in $@.fakerd
59 # 3. The device tree binary which is in $@.dtb
61 # Now, given that we use the function for the kernel which
62 # already has a initramfs image inside, we still have to
63 # add a "fake" initrd (which a mkimage header) in the second
64 # part of the legacy multi image. Since we need to put the
65 # device tree stuff into part 3.
67 -$(STAGING_DIR_HOST
)/bin
/mkimage
-A
$(LINUX_KARCH
) -O linux
-T multi \
68 -C
$(1) -a
$(KERNEL_LOADADDR
) -e
$(KERNEL_ENTRY
) \
69 -n
'$(BOARD_NAME) initramfs' -d
$@
:$@.fakerd
:$@.dtb
$@.new
74 define Build
/prepend-dtb
75 cat
"$@.dtb.uimage" "$@" > "$@.new"
80 ( cd
$(TARGET_DIR
); find . | cpio
-o
-H newc | gzip
-9n
>$(KDIR_TMP
)/$(IMG_PREFIX
)-rootfs.cpio.gz
)
85 KERNEL_DEPENDS
= $$(wildcard ..
/dts
/$$(DEVICE_DTS
).dts
)
87 KERNEL_ENTRY
:= 0x00000000
88 KERNEL_LOADADDR
:= 0x00000000
89 DEVICE_DTS_DIR
:= ..
/dts
90 DEVICE_DTS
= $(subst _
,-,$(1))
93 include $(SUBTARGET
).mk
95 $(eval
$(call BuildImage
))