1 ## SPDX-License-Identifier: GPL-2.0-only
5 OBJCOPY
:=$(CONFIG_LINUXBOOT_CROSS_COMPILE
)objcopy
7 CROSS_COMPILE
=$(CONFIG_LINUXBOOT_CROSS_COMPILE
) \
9 KBUILD_BUILD_USER
="coreboot" \
10 KBUILD_BUILD_HOST
="reproducible" \
11 KBUILD_BUILD_TIMESTAMP
="$(shell perl -e 'print scalar gmtime($(SOURCE_DATE_EPOCH))')" \
12 KBUILD_BUILD_VERSION
="0"
14 kernel_version
= $(CONFIG_LINUXBOOT_KERNEL_VERSION
)
15 kernel_dir
= build
/kernel-
$(subst .
,_
,$(kernel_version
))
16 kernel_tarball
= linux-
$(kernel_version
).
tar
17 kernel_mirror
= https
://mirrors.edge.kernel.org
/pub
/linux
/kernel
19 ifeq ($(findstring x2.6.
,x
$(kernel_version
)),x2.6.
)
20 kernel_mirror_path
:= $(kernel_mirror
)/v2.6
21 else ifeq ($(findstring x3.
,x
$(kernel_version
)),x3.
)
22 kernel_mirror_path
:= $(kernel_mirror
)/v3.x
23 else ifeq ($(findstring x4.
,x
$(kernel_version
)),x4.
)
24 kernel_mirror_path
:= $(kernel_mirror
)/v4.x
25 else ifeq ($(findstring x5.
,x
$(kernel_version
)),x5.
)
26 kernel_mirror_path
:= $(kernel_mirror
)/v5.x
27 else ifeq ($(findstring x6.
,x
$(kernel_version
)),x6.
)
28 kernel_mirror_path
:= $(kernel_mirror
)/v6.x
31 build
/$(kernel_tarball
).xz
: | build
32 echo
" Test $(kernel_version)"
33 echo
" WWW $(kernel_mirror_path)/$(kernel_tarball).xz";
34 curl
-OLSs
--output-dir build
"$(kernel_mirror_path)/$(kernel_tarball).xz";
36 $(kernel_dir
): build
/$(kernel_tarball
).xz
37 echo
" XZ $(kernel_tarball).xz";
39 tar xJf build
/$(kernel_tarball
).xz
--strip 1 -C
$(kernel_dir
);
41 $(kernel_dir
)/.config
: $(CONFIG_LINUXBOOT_KERNEL_CONFIGFILE
) |
$(kernel_dir
)
42 @echo
" CONFIG Linux $(kernel_version)"
43 cp
$(CONFIG_LINUXBOOT_KERNEL_CONFIGFILE
) $(kernel_dir
)/.config
44 $(MAKE
) -C
$(kernel_dir
) $(KERNEL_MAKE_FLAGS
) olddefconfig
46 $(kernel_dir
)/vmlinux
: $(kernel_dir
)/.config |
$(kernel_dir
)
47 @echo
" MAKE Linux $(kernel_version)"
48 echo
"$(MAKE) -j $(CPUS) -C $(kernel_dir) $(KERNEL_MAKE_FLAGS) vmlinux"
49 $(MAKE
) -j
$(CPUS
) -C
$(kernel_dir
) $(KERNEL_MAKE_FLAGS
) vmlinux
51 build
/vmlinux.bin
: $(kernel_dir
)/vmlinux | build
52 $(OBJCOPY
) -O binary
$< $@
54 build
/vmlinux.bin.lzma
: build
/vmlinux.bin
55 xz
-c
-k
-f
--format
=lzma
--lzma1
=dict
=1MiB
,lc
=3,lp
=0,pb
=3 $< > $@
57 $(kernel_dir
)/arch
/x86
/boot
/bzImage
: $(kernel_dir
)/.config
58 @echo
" MAKE Linux $(kernel_version)"
59 echo
"$(MAKE) -C $(kernel_dir) $(KERNEL_MAKE_FLAGS) bzImage"
60 $(MAKE
) -C
$(kernel_dir
) $(KERNEL_MAKE_FLAGS
) bzImage