Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

x86/build: Fix broken copy command in genimage.sh when making isoimage

Problem: Currently when running the "make isoimage" command there is an
error related to wrong parameters passed to the cp command:

"cp: missing destination file operand after 'arch/x86/boot/isoimage/'"

This is caused because FDINITRDS is an empty array.

Solution: Check if FDINITRDS is empty before executing the "cp" command,
similar to how it is done in the case of hdimage.

Signed-off-by: Nir Lichtman <nir@lichtman.org>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Cc: "H. Peter Anvin" <hpa@zytor.com>
Cc: Ard Biesheuvel <ardb@kernel.org>
Cc: Masahiro Yamada <yamada.masahiro@socionext.com>
Cc: Michal Marek <michal.lkml@markovi.net>
Link: https://lore.kernel.org/r/20250110120500.GA923218@lichtman.org

authored by

Nir Lichtman and committed by
Ingo Molnar
e4516302 d082ecbc

+4 -1
+4 -1
arch/x86/boot/genimage.sh
··· 22 22 # This script requires: 23 23 # bash 24 24 # syslinux 25 + # genisoimage 25 26 # mtools (for fdimage* and hdimage) 26 27 # edk2/OVMF (for hdimage) 27 28 # ··· 252 251 cp "$isolinux" "$ldlinux" "$tmp_dir" 253 252 cp "$FBZIMAGE" "$tmp_dir"/linux 254 253 echo default linux "$KCMDLINE" > "$tmp_dir"/isolinux.cfg 255 - cp "${FDINITRDS[@]}" "$tmp_dir"/ 254 + if [ ${#FDINITRDS[@]} -gt 0 ]; then 255 + cp "${FDINITRDS[@]}" "$tmp_dir"/ 256 + fi 256 257 genisoimage -J -r -appid 'LINUX_BOOT' -input-charset=utf-8 \ 257 258 -quiet -o "$FIMAGE" -b isolinux.bin \ 258 259 -c boot.cat -no-emul-boot -boot-load-size 4 \