Commit Graph

21 Commits

Author SHA1 Message Date
Kory Maincent
5916cc5011 fs/iso9660: add support for hybrid image using Grub2 on BIOS and EFI
Add support for building an hybrid ISO9660 image compatible with legacy
and UEFI BIOS. Note that this is not about an (iso)hybrid image, which
can boot from both a CDROM or a USB stick, but really about an image
being bootable from the legay BIOS or EFI; the two are orthognal.

The option -eltorito-alt-boot need to be used in the xorriso command
to generate the hybrid image. That option is a separator, meaning the
previous boot entry is done, and the following boot options define a new
boot entry.

The -no-emul-boot defines the type of the current boot image; that's why
it has to now be repeated in each of the BIOS and EFI options.

Finally, for symetry and consistency between the BIOS and EFI options,
we move the BIOS image option first.

Note: the BIOS boot image options have to be provided before the EFI
ones, or the system won't boot; the underlying reason is not known...

Signed-off-by: Kory Maincent <kory.maincent@bootlin.com>
[yann.morin.1998@free.fr:
  - note about hybrid vs. (iso)hybrid
  - explain -eltorito-alt-boot
  - explain duplication of -no-emul-boot
  - rename the variables
  - note about the BIOS-EFI ordering
]
Signed-off-by: Yann E. MORIN <yann.morin.1998@free.fr>
2021-09-29 22:58:57 +02:00
Kory Maincent
179ae068eb fs/iso9660: add support to Grub EFI bootloader in the image
Add support to boot the Grub bootloader from an EFI BIOS in the ISO9660
image.
For that we need to create EFI System Partition (ESP). The ESP is a vfat
partition which contain the Grub2 binary at the /EFI/BOOT/ location.
xorriso command will generate the iso image including the ESP.

We notice Grub can not read and mount the ESP, therefore we place the Grub
configuration file in the ISO9660 partition. A Grub2 builtin configuration
need to be used to tell Grub2 to search automatically its configuration
file in the ISO9660 partition. Use 'set root=(cd0)' in the configuration
file passed to BR2_TARGET_GRUB2_BUILTIN_CONFIG_EFI.

Signed-off-by: Kory Maincent <kory.maincent@bootlin.com>
[yann.morin.1998@free.fr: fix timestamp fixup hook]
Signed-off-by: Yann E. MORIN <yann.morin.1998@free.fr>
2021-09-27 22:35:20 +02:00
Yann E. MORIN
90867d8fdf fs/iso9660: add option for transparent (de)compression
Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
[Thomas: rename option to BR2_TARGET_ROOTFS_ISO9660_TRANSPARENT_COMPRESSION.]
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
2017-12-31 18:13:36 +01:00
Yann E. MORIN
54a76f08fc fs/iso9660: remove support for grub
grub will be removed soon.

Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
Cc: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Cc: Ricardo Martincoski <ricardo.martincoski@gmail.com>
Signed-off-by: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be>
2017-09-23 20:23:12 +02:00
Arnout Vandecappelle
3e57fa370c fs/iso9660: doesn't support (grub2) EFI
The iso9660 generation for grub2 assumes that grub-eltorito.img is
available. However, this image is only available for the i386-pc target
(i.e. legacy BIOS). An EFI-bootable iso9660 requires a different layout.

Since we currently can't generate the EFI-bootable iso9660 layout,
require the i386-pc target to be selected in grub.

Signed-off-by: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be>
Reported-by: arnaud.miche@orange.com
Reviewed-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
2017-03-01 21:52:58 +01:00
Vivien Didelot
7a691d08e3 fs: iso9660: change boot menu entry text
Replace Grub-specific "menu.lst" with "menu config" in the
BR2_TARGET_ROOTFS_ISO9660_BOOT_MENU Kconfig entry text, and mention
missing grub.cfg for Grub 2.

Signed-off-by: Vivien Didelot <vivien.didelot@savoirfairelinux.com>
Acked-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
2015-08-18 21:42:51 +02:00
Thomas Petazzoni
795df97093 fs/iso9660: add support for grub2
After having extended the iso9660 support to allow isolinux as an
alternative to grub, this commit adds grub2 as a third
alternative. With the previous work done to support isolinux, adding
support for grub2 is fairly trivial.

[Thomas: set timeout to 10 seconds and not 5 seconds, in order to
match the configuration used for grub.]

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Reviewed-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
2015-06-14 23:25:18 +02:00
Thomas Petazzoni
5bac06e881 fs/iso9660: add hybrid image support
This commit adds a new option, which allows, when isolinux is used as
the bootloader, to generate an "hybrid" ISO image. Such images can
either be booted from CD-ROM or from USB keys. It simply uses the
isohybrid tool provided by syslinux.

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Acked-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
Acked-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
2015-06-14 23:24:52 +02:00
Thomas Petazzoni
f9ac784ee6 fs/iso9660: add isolinux support
After all the preparation commits, this commit finally adds the
iso9660 support itself. Besides adding a new Config.in entry, a little
bit of .mk code and the isolinux.cfg default configuration, not much
is needed.

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Reviewed-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
2015-06-14 23:24:45 +02:00
Thomas Petazzoni
bd256e96c0 fs/iso9660: use 'depends on' instead of 'select' for bootloader
In preparation to the introduction of the support for other
bootloaders than Grub, this commit switches from having the iso9660
support "select" the necessary bootloader to using a "depends on".

The main motivation is that the isolinux bootloader support will
really need to do a "depends on", due to the need of having a certain
option enabled, but this option being a kconfig "choice".

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Acked-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
2015-06-14 23:21:34 +02:00
Thomas Petazzoni
a399f5ebbe fs/iso9660: introduce bootloader choice
In preparation to the introduction for the support of other
bootloaders than Grub, this commit adds a "choice ... endchoice" block
with just the Grub option, and adds some conditionals in the
iso9660.mk code for the Grub specific parts.

Of course, for now those conditionals are a bit useless with just this
commit, but they become useful with the followup commits.

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Reviewed-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
2015-06-14 23:21:27 +02:00
Thomas Petazzoni
7080eef9b8 fs/iso9660: support building a real iso9660 filesystem
Until now, the iso9660 filesystem handling only supported using an
initrd/initramfs to store the root filesystem, which is very different
from what we do with the other filesystems.

This commit changes the iso9660 logic to also allow using directly an
iso9660 filesystem to store the root filesystem. A new option,
BR2_TARGET_ROOTFS_ISO9660_INITRD, is created to tell the iso9660 that
we want to use an initrd and not directly the root filesystem in
iso9660 format. This option defaults to 'y' to preserve the existing
behavior.

After this commit, we therefore have three possibilities:

 * BR2_TARGET_ROOTFS_ISO9660=y, with BR2_TARGET_ROOTFS_INITRAMFS and
   BR2_TARGET_ROOTFS_ISO9660_INITRD disabled. In this case, the
   iso9660 filesystem is directly the contents of the root filesystem
   (since is possible thanks to the Rockridge extensions that were
   already enabled using the -R option of genisoimage). Obviously, it
   means that the root filesystem is read-only.

 * BR2_TARGET_ROOTFS_ISO9660=y and BR2_TARGET_ROOTFS_INITRAMFS=y (the
   value of BR2_TARGET_ROOTFS_ISO9660_INITRD doesn't matter). In this
   case, the root filesystem is already linked into the kernel image
   itself, as an initramfs. So the iso9660 filesystem doesn't contain
   the root filesystem as is, but just the bootloader and the kernel
   image.

 * BR2_TARGET_ROOTFS_ISO9660=y, BR2_TARGET_ROOTFS_ISO9660_INITRD=y and
   BR2_TARGET_ROOTFS_INITRAMFS disabled. In this case, a separate
   initrd is used. The iso9660 filesystem only contains the
   bootloader, the kernel and the initrd.

In order to support the first case out of the box, root=/dev/sr0 is
added on the kernel command line in the example Grub configuration
file, so that the kernel knows where the root filesystem is
located. This argument is ignored when initrd/initramfs are used.

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Reviewed-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
2015-06-14 23:21:10 +02:00
Thomas Petazzoni
168cce0496 fs/iso9660: prepare cleaner kernel/initrd path handling
The iso9660.mk modifies the menu.lst file from Grub to set the correct
initrd/kernel image locations. However, with the upcoming support of
other bootloaders for iso9660 filesystems, we need to modify a bit
this logic.

Instead of relying on the specific details of the grub menu.lst
syntax, we introduce the __KERNEL_PATH__ and __INITRD_PATH__ magic
keywords, which iso9660.mk will replace by the appropriate
values. They can therefore be used where needed in grub menu.lst, and
in similar configuration files of other bootloaders, as will be
supported in the following commits.

Also, in order to be consistent with the soon to be introduced support
for having the root filesystem itself as iso9660, this commit changes
the installation location of the initrd and kernel. Instead of being
/initrd and /kernel, they become /boot/initrd and
/boot/$(LINUX_IMAGE_NAME).

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Acked-by: Samuel Martin <s.martin49@gmail.com>
Acked-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
2015-06-14 23:18:53 +02:00
Thomas Petazzoni
48229662ce fs/iso9660: use if ... endif block instead of depends on
In preparation to the addition of numerous additional options to the
iso9660 filesystem logic, use a if ... endif block instead of a
depends on for the only option that currently exists.

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Acked-by: Samuel Martin <s.martin49@gmail.com>
Acked-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
2015-06-14 23:18:12 +02:00
Thomas Petazzoni
418c3a2f90 fs/iso9660: select ISO9660 support in Grub
The fs/iso9660 logic assumes that the Grub bootloader is
used. Therefore, it should make sure that Grub is configured with the
support for the ISO9660 filesystem.

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Acked-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
2013-12-29 12:17:58 +01:00
Thomas De Schampheleire
8da745f04a Config.in files: unification of comments about dependency on Linux kernel
This patch lines up the comments of packages that need a Linux kernel to be
built by buildroot, to the format:
    foo needs a Linux kernel to be built

Signed-off-by: Thomas De Schampheleire <thomas.de.schampheleire@gmail.com>
Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
2013-12-15 16:24:36 +01:00
Thomas De Schampheleire
be084204eb Config.in files: add missing dependencies to toolchain option comments
When a package A depends on config option B and toolchain option C, then
the comment that is given when C is not fulfilled should also depend on B.
For example:

config BR2_PACKAGE_A
	depends on BR2_B
	depends on BR2_LARGEFILE
	depends on BR2_WCHAR

comment "A needs a toolchain w/ largefile, wchar"
	depends on !BR2_LARGEFILE || !BR2_WCHAR

This comment should actually be:

comment "A needs a toolchain w/ largefile, wchar"
	depends on BR2_B
	depends on !BR2_LARGEFILE || !BR2_WCHAR

or if possible (typically when B is a package config option declared in that
same Config.in file):

if BR2_B

comment "A needs a toolchain w/ largefile, wchar"
	depends on !BR2_LARGEFILE || !BR2_WCHAR

[other config options depending on B]

endif

Otherwise, the comment would be visible even though the other dependencies
are not met.

This patch adds such missing dependencies, and changes existing such
dependencies from
  depends on BR2_BASE_DEP && !BR2_TOOLCHAIN_USES_GLIBC
to
  depends on BR2_BASE_DEP
  depends on !BR2_TOOLCHAIN_USES_GLIBC
so that (positive) base dependencies are separate from the (negative)
toolchain dependencies. This strategy makes it easier to write such comments
(because one can simply copy the base dependency from the actual package
config option), but also avoids complex and long boolean expressions.

Signed-off-by: Thomas De Schampheleire <thomas.de.schampheleire@gmail.com>
Acked-by: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be>
 (untested)
Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
2013-11-10 23:59:57 +01:00
Arnout Vandecappelle
ff3391323a iso9660 fs: use cpio initrd instead of ext2
The ext2 initrd is pretty broken, because it requires an additional
root=/dev/ram0 command line parameter, and a /init to mount
devtmps that isn't there in out ext2 rootfs.  So just use a cpio
instead.

Note that there is no check if the kernel supports initramfs or the
selected compression method.

Also removed a bit of dead code in iso9660.mk.

Signed-off-by: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be>
Signed-off-by: Peter Korsgaard <jacmet@sunsite.dk>
2012-11-14 22:53:25 +01:00
Thomas Petazzoni
c7ee5853a0 iso9660: take into account the linux changes
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
2010-06-22 21:20:26 +02:00
Peter Korsgaard
376549b755 iso9660: menu.lst fixup after move to fs
Signed-off-by: Peter Korsgaard <jacmet@sunsite.dk>
2010-04-15 13:51:33 +02:00
Thomas Petazzoni
0585241505 Move all filesystem generation code to fs/
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
2010-04-09 11:04:36 +02:00