2024-02-22 17:27:03

by ns

[permalink] [raw]
Subject: make install doesn't install proper files for some architectures

Greetings,

The kernel's build system has an install target. Most of the time this
works fine, but it is limited to only one file, which can make it busted
for some arches.

One example of a target where it is busted is a generic ppc32 kernel,
where there are plenty of supported platforms, some of which can boot
perfectly fine through Open Firmware & some which are from bad, bad
times o' yore where you had to embed the DT straight into the kernel. &
some more on top of that. When you run make install for ppc32, it only
installs the uncompressed vmlinux. This is almost certainly not the
correct decision for _any_ of the platforms in question, & it totally
leaves out the properly wrapped images that many of these platforms
absolutely need in order to boot (e.g. PS3 & Wii, which need an image
with an embedded DT).

This is not really great. By contrast, the all target built all the
specific images that my config selected. I didn't have to read the
arch's boot Makefile to figure out what files I have to build. Is there
any target which does the same but for installing every image the all
target produced? It'd be a much better experience than leaving the
details of every arch & bizzare platform supported by it up to (most
likely incomplete) scripts, when the Makefiles already have all that
information properly written. I suppose it'd also come in handy if e.g.
x86 had a saner image format [1] in the future or something of the sort.

[1]:
https://source.denx.de/u-boot/u-boot/-/blob/master/doc/usage/fit/x86-fit-boot.rst


2024-02-23 03:32:35

by Masahiro Yamada

[permalink] [raw]
Subject: Re: make install doesn't install proper files for some architectures

On Fri, Feb 23, 2024 at 2:07 AM <[email protected]> wrote:
>
> Greetings,
>
> The kernel's build system has an install target. Most of the time this
> works fine, but it is limited to only one file, which can make it busted
> for some arches.
>
> One example of a target where it is busted is a generic ppc32 kernel,
> where there are plenty of supported platforms, some of which can boot
> perfectly fine through Open Firmware & some which are from bad, bad
> times o' yore where you had to embed the DT straight into the kernel. &
> some more on top of that. When you run make install for ppc32, it only
> installs the uncompressed vmlinux. This is almost certainly not the
> correct decision for _any_ of the platforms in question, & it totally
> leaves out the properly wrapped images that many of these platforms
> absolutely need in order to boot (e.g. PS3 & Wii, which need an image
> with an embedded DT).
>
> This is not really great. By contrast, the all target built all the
> specific images that my config selected. I didn't have to read the
> arch's boot Makefile to figure out what files I have to build. Is there
> any target which does the same but for installing every image the all
> target produced? It'd be a much better experience than leaving the
> details of every arch & bizzare platform supported by it up to (most
> likely incomplete) scripts, when the Makefiles already have all that
> information properly written. I suppose it'd also come in handy if e.g.
> x86 had a saner image format [1] in the future or something of the sort.
>
> [1]:
> https://source.denx.de/u-boot/u-boot/-/blob/master/doc/usage/fit/x86-fit-boot.rst




If you see scripts/install.sh, the second parameter
to 'installkernel' is ${KBUILD_IMAGE}.



arch Makefile can set the best image to install,
but there is no such code in arch/powerpc/Makefile.

Presumably, 'make install' will install the default
'vmlinux' for powerpc.






$ git grep KBUILD_IMAGE -- arch/
arch/arm/Makefile:KBUILD_IMAGE := $(boot)/xipImage
arch/arm/Makefile:KBUILD_IMAGE := $(boot)/zImage
arch/arm/Makefile:all: $(notdir $(KBUILD_IMAGE))
arch/arm/Makefile:$(INSTALL_TARGETS): KBUILD_IMAGE =
$(boot)/$(patsubst %install,%Image,$@)
arch/arm64/Makefile:KBUILD_IMAGE := $(boot)/Image.gz
arch/arm64/Makefile:KBUILD_IMAGE := $(boot)/vmlinuz.efi
arch/arm64/Makefile:all: $(notdir $(KBUILD_IMAGE))
arch/arm64/Makefile:install: KBUILD_IMAGE := $(boot)/Image
arch/loongarch/Makefile:KBUILD_IMAGE := $(boot)/vmlinux.elf
arch/loongarch/Makefile:KBUILD_IMAGE := $(boot)/$(image-name-y).efi
arch/loongarch/Makefile:all: $(notdir $(KBUILD_IMAGE)) $(KBUILD_DTBS)
arch/loongarch/Makefile: $(Q)install -D -m 755 $(KBUILD_IMAGE)
$(INSTALL_PATH)/$(image-name-y)-$(KERNELRELEASE)
arch/m68k/Makefile:install: KBUILD_IMAGE := vmlinux.gz
arch/mips/boot/compressed/Makefile:$(obj)/vmlinux.bin: $(KBUILD_IMAGE) FORCE
arch/nios2/Makefile:KBUILD_IMAGE := $(nios2-boot)/vmImage
arch/nios2/Makefile: echo '* vmImage - Kernel-only image for
U-Boot ($(KBUILD_IMAGE))'
arch/parisc/Makefile:KBUILD_IMAGE := $(boot)/bzImage
arch/parisc/Makefile:install: KBUILD_IMAGE := vmlinux
arch/parisc/Makefile:zinstall: KBUILD_IMAGE := vmlinuz
arch/riscv/Makefile:KBUILD_IMAGE := $(boot)/xipImage
arch/riscv/Makefile:KBUILD_IMAGE := $(boot)/Image.gz
arch/riscv/Makefile:KBUILD_IMAGE := $(boot)/loader.bin
arch/riscv/Makefile:KBUILD_IMAGE := $(boot)/Image.gz
arch/riscv/Makefile:KBUILD_IMAGE := $(boot)/vmlinuz.efi
arch/riscv/Makefile:all: $(notdir $(KBUILD_IMAGE))
arch/riscv/Makefile:install: KBUILD_IMAGE := $(boot)/Image
arch/riscv/Makefile:zinstall: KBUILD_IMAGE := $(boot)/Image.gz
arch/s390/Makefile:#KBUILD_IMAGE is necessary for packaging targets
like rpm-pkg, deb-pkg...
arch/s390/Makefile:KBUILD_IMAGE := $(boot)/bzImage
arch/sh/Makefile:KBUILD_IMAGE := $(boot)/$(defaultimage-y)
arch/sh/Makefile:all: $(notdir $(KBUILD_IMAGE))
arch/sparc/Makefile:KBUILD_IMAGE := $(boot)/zImage
arch/x86/Makefile:# KBUILD_IMAGE specify target image being built
arch/x86/Makefile:KBUILD_IMAGE := $(boot)/bzImage
arch/x86/Makefile: $(Q)$(MAKE) $(build)=$(boot) $(KBUILD_IMAGE)




--
Best Regards
Masahiro Yamada