HOWTO create UEFI/BIOS bootable ISO
I've noted that the Ubuntu ISO file is bootable on systems with BIOS and with UEFI. I've remastered Ubuntu from scratch and I'd like my ISO file to be bootable in both cases.
My remastering of Ubuntu is done by first installing debootstrap into a chroot jail, and then gradually adding files until I have all desired programs. However, the resulting ISO file is only bootable on a system with BIOS.
I believe I need some different magic with mkisofs, but what about the files in EFI/BOOT? What is the origin of those files? Is there anything else I need?
Thanks!
AndyS
boot uefi bios
add a comment |
I've noted that the Ubuntu ISO file is bootable on systems with BIOS and with UEFI. I've remastered Ubuntu from scratch and I'd like my ISO file to be bootable in both cases.
My remastering of Ubuntu is done by first installing debootstrap into a chroot jail, and then gradually adding files until I have all desired programs. However, the resulting ISO file is only bootable on a system with BIOS.
I believe I need some different magic with mkisofs, but what about the files in EFI/BOOT? What is the origin of those files? Is there anything else I need?
Thanks!
AndyS
boot uefi bios
1
The ISO has a pre-configured grub renamed to /EFI/Boot/bootx64.efi. UEFI only boots from /EFI/Boot/bootx64.efi. So BIOS boot is from syslinux and UEFI boot is from grub. The version of grub in the ISO is uses just the files needed to boot the installer, not the full install of grub in a standard install.See long answer, not script: askubuntu.com/questions/549647/…
– oldfred
Nov 11 '17 at 21:08
Create one partition with typeEFI System
and do as @oldfred suggested
– Arpit Agarwal
Nov 11 '17 at 22:11
That reply talks about preparing a boot medium with partitions and such, whereas I'm trying to create the ISO file that others can easily boot via BIOS or UEFI. If I take the Ubuntu ISO file and mount it read-only/loopback, I see EFI/BOOT with two files in it: BOOTx64.EFI and grubx64.efi. Specifically, how are those files created?
– AndyS
Nov 12 '17 at 0:27
I see in oldfred's reference that there are clear instructions for creating bootx64.efi, but is that the same as BOOTx64.EFI? I see also an example of grub.cfg, but on the Ubuntu ISO, I see two grub.cfg files at these locations: /boot/grub/x86_64-efi/grub.cfg and /boot/grub/grub.cfg. My guess is that two files are needed, one for BIOS and the other for EFI boot.
– AndyS
Nov 12 '17 at 0:31
The grub.cfg file from oldfred's link references vmlinuz.efi. How is that file created?
– AndyS
Nov 12 '17 at 0:33
add a comment |
I've noted that the Ubuntu ISO file is bootable on systems with BIOS and with UEFI. I've remastered Ubuntu from scratch and I'd like my ISO file to be bootable in both cases.
My remastering of Ubuntu is done by first installing debootstrap into a chroot jail, and then gradually adding files until I have all desired programs. However, the resulting ISO file is only bootable on a system with BIOS.
I believe I need some different magic with mkisofs, but what about the files in EFI/BOOT? What is the origin of those files? Is there anything else I need?
Thanks!
AndyS
boot uefi bios
I've noted that the Ubuntu ISO file is bootable on systems with BIOS and with UEFI. I've remastered Ubuntu from scratch and I'd like my ISO file to be bootable in both cases.
My remastering of Ubuntu is done by first installing debootstrap into a chroot jail, and then gradually adding files until I have all desired programs. However, the resulting ISO file is only bootable on a system with BIOS.
I believe I need some different magic with mkisofs, but what about the files in EFI/BOOT? What is the origin of those files? Is there anything else I need?
Thanks!
AndyS
boot uefi bios
boot uefi bios
asked Nov 11 '17 at 18:40
AndySAndyS
64
64
1
The ISO has a pre-configured grub renamed to /EFI/Boot/bootx64.efi. UEFI only boots from /EFI/Boot/bootx64.efi. So BIOS boot is from syslinux and UEFI boot is from grub. The version of grub in the ISO is uses just the files needed to boot the installer, not the full install of grub in a standard install.See long answer, not script: askubuntu.com/questions/549647/…
– oldfred
Nov 11 '17 at 21:08
Create one partition with typeEFI System
and do as @oldfred suggested
– Arpit Agarwal
Nov 11 '17 at 22:11
That reply talks about preparing a boot medium with partitions and such, whereas I'm trying to create the ISO file that others can easily boot via BIOS or UEFI. If I take the Ubuntu ISO file and mount it read-only/loopback, I see EFI/BOOT with two files in it: BOOTx64.EFI and grubx64.efi. Specifically, how are those files created?
– AndyS
Nov 12 '17 at 0:27
I see in oldfred's reference that there are clear instructions for creating bootx64.efi, but is that the same as BOOTx64.EFI? I see also an example of grub.cfg, but on the Ubuntu ISO, I see two grub.cfg files at these locations: /boot/grub/x86_64-efi/grub.cfg and /boot/grub/grub.cfg. My guess is that two files are needed, one for BIOS and the other for EFI boot.
– AndyS
Nov 12 '17 at 0:31
The grub.cfg file from oldfred's link references vmlinuz.efi. How is that file created?
– AndyS
Nov 12 '17 at 0:33
add a comment |
1
The ISO has a pre-configured grub renamed to /EFI/Boot/bootx64.efi. UEFI only boots from /EFI/Boot/bootx64.efi. So BIOS boot is from syslinux and UEFI boot is from grub. The version of grub in the ISO is uses just the files needed to boot the installer, not the full install of grub in a standard install.See long answer, not script: askubuntu.com/questions/549647/…
– oldfred
Nov 11 '17 at 21:08
Create one partition with typeEFI System
and do as @oldfred suggested
– Arpit Agarwal
Nov 11 '17 at 22:11
That reply talks about preparing a boot medium with partitions and such, whereas I'm trying to create the ISO file that others can easily boot via BIOS or UEFI. If I take the Ubuntu ISO file and mount it read-only/loopback, I see EFI/BOOT with two files in it: BOOTx64.EFI and grubx64.efi. Specifically, how are those files created?
– AndyS
Nov 12 '17 at 0:27
I see in oldfred's reference that there are clear instructions for creating bootx64.efi, but is that the same as BOOTx64.EFI? I see also an example of grub.cfg, but on the Ubuntu ISO, I see two grub.cfg files at these locations: /boot/grub/x86_64-efi/grub.cfg and /boot/grub/grub.cfg. My guess is that two files are needed, one for BIOS and the other for EFI boot.
– AndyS
Nov 12 '17 at 0:31
The grub.cfg file from oldfred's link references vmlinuz.efi. How is that file created?
– AndyS
Nov 12 '17 at 0:33
1
1
The ISO has a pre-configured grub renamed to /EFI/Boot/bootx64.efi. UEFI only boots from /EFI/Boot/bootx64.efi. So BIOS boot is from syslinux and UEFI boot is from grub. The version of grub in the ISO is uses just the files needed to boot the installer, not the full install of grub in a standard install.See long answer, not script: askubuntu.com/questions/549647/…
– oldfred
Nov 11 '17 at 21:08
The ISO has a pre-configured grub renamed to /EFI/Boot/bootx64.efi. UEFI only boots from /EFI/Boot/bootx64.efi. So BIOS boot is from syslinux and UEFI boot is from grub. The version of grub in the ISO is uses just the files needed to boot the installer, not the full install of grub in a standard install.See long answer, not script: askubuntu.com/questions/549647/…
– oldfred
Nov 11 '17 at 21:08
Create one partition with type
EFI System
and do as @oldfred suggested– Arpit Agarwal
Nov 11 '17 at 22:11
Create one partition with type
EFI System
and do as @oldfred suggested– Arpit Agarwal
Nov 11 '17 at 22:11
That reply talks about preparing a boot medium with partitions and such, whereas I'm trying to create the ISO file that others can easily boot via BIOS or UEFI. If I take the Ubuntu ISO file and mount it read-only/loopback, I see EFI/BOOT with two files in it: BOOTx64.EFI and grubx64.efi. Specifically, how are those files created?
– AndyS
Nov 12 '17 at 0:27
That reply talks about preparing a boot medium with partitions and such, whereas I'm trying to create the ISO file that others can easily boot via BIOS or UEFI. If I take the Ubuntu ISO file and mount it read-only/loopback, I see EFI/BOOT with two files in it: BOOTx64.EFI and grubx64.efi. Specifically, how are those files created?
– AndyS
Nov 12 '17 at 0:27
I see in oldfred's reference that there are clear instructions for creating bootx64.efi, but is that the same as BOOTx64.EFI? I see also an example of grub.cfg, but on the Ubuntu ISO, I see two grub.cfg files at these locations: /boot/grub/x86_64-efi/grub.cfg and /boot/grub/grub.cfg. My guess is that two files are needed, one for BIOS and the other for EFI boot.
– AndyS
Nov 12 '17 at 0:31
I see in oldfred's reference that there are clear instructions for creating bootx64.efi, but is that the same as BOOTx64.EFI? I see also an example of grub.cfg, but on the Ubuntu ISO, I see two grub.cfg files at these locations: /boot/grub/x86_64-efi/grub.cfg and /boot/grub/grub.cfg. My guess is that two files are needed, one for BIOS and the other for EFI boot.
– AndyS
Nov 12 '17 at 0:31
The grub.cfg file from oldfred's link references vmlinuz.efi. How is that file created?
– AndyS
Nov 12 '17 at 0:33
The grub.cfg file from oldfred's link references vmlinuz.efi. How is that file created?
– AndyS
Nov 12 '17 at 0:33
add a comment |
1 Answer
1
active
oldest
votes
You can generate an ESP (EFI System Partition) image suitable for booting on UEFI with:
#! /bin/sh
BOOT_IMG_DATA=$(mktemp -d)
BOOT_IMG=efi.img
mkdir -p $(dirname $BOOT_IMG)
truncate -s 4M $BOOT_IMG
mkfs.vfat $BOOT_IMG
mkdir -p $BOOT_IMG_DATA/efi/boot
grub-mkimage
-C xz
-O x86_64-efi
-p /boot/grub
-o $BOOT_IMG_DATA/efi/boot/bootx64.efi
boot linux search normal configfile
part_gpt btrfs fat iso9660 loopback
test keystatus gfxmenu regexp probe
efi_gop efi_uga all_video gfxterm font
echo read ls cat png jpeg halt reboot
mcopy -i $BOOT_IMG -s $BOOT_IMG_DATA/efi ::
That will generate a FAT-formatted file (change the location of the file by changing the $BOOT_IMG
variable), which is, in turn, an ESP image.
You can use the generated image by adding the flag -append_partition 2 0xef efi.img
to the xorriso
command.
The resulting xorriso
command may be something like this:
xorriso -as mkisofs
-r -V <ISO_LABEL>
-o <OUTPUT_ISO_IMAGE>
-J -J -joliet-long -cache-inodes
-isohybrid-mbr /usr/lib/ISOLINUX/isohdpfx.bin
-b isolinux/isolinux.bin
-c isolinux/boot.cat
-boot-load-size 4 -boot-info-table -no-emul-boot
-eltorito-alt-boot
-e --interval:appended_partition_2:all::
-append_partition 2 0xef efi.img
-no-emul-boot -isohybrid-gpt-basdat
<ISO_DIRECTORY>
Bear in mind that you also need to use ISOLINUX if you want your image to boot on BIOS systems. GRUB2 is for UEFI.
Also, you should use a recent version of xorriso
(the flag --interval:appended_partition_2:all::
was added a couple years ago, so old versions doesn't support it).
For further guidance, also take a look to this question.
New contributor
add a comment |
Your Answer
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "89"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f975521%2fhowto-create-uefi-bios-bootable-iso%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
You can generate an ESP (EFI System Partition) image suitable for booting on UEFI with:
#! /bin/sh
BOOT_IMG_DATA=$(mktemp -d)
BOOT_IMG=efi.img
mkdir -p $(dirname $BOOT_IMG)
truncate -s 4M $BOOT_IMG
mkfs.vfat $BOOT_IMG
mkdir -p $BOOT_IMG_DATA/efi/boot
grub-mkimage
-C xz
-O x86_64-efi
-p /boot/grub
-o $BOOT_IMG_DATA/efi/boot/bootx64.efi
boot linux search normal configfile
part_gpt btrfs fat iso9660 loopback
test keystatus gfxmenu regexp probe
efi_gop efi_uga all_video gfxterm font
echo read ls cat png jpeg halt reboot
mcopy -i $BOOT_IMG -s $BOOT_IMG_DATA/efi ::
That will generate a FAT-formatted file (change the location of the file by changing the $BOOT_IMG
variable), which is, in turn, an ESP image.
You can use the generated image by adding the flag -append_partition 2 0xef efi.img
to the xorriso
command.
The resulting xorriso
command may be something like this:
xorriso -as mkisofs
-r -V <ISO_LABEL>
-o <OUTPUT_ISO_IMAGE>
-J -J -joliet-long -cache-inodes
-isohybrid-mbr /usr/lib/ISOLINUX/isohdpfx.bin
-b isolinux/isolinux.bin
-c isolinux/boot.cat
-boot-load-size 4 -boot-info-table -no-emul-boot
-eltorito-alt-boot
-e --interval:appended_partition_2:all::
-append_partition 2 0xef efi.img
-no-emul-boot -isohybrid-gpt-basdat
<ISO_DIRECTORY>
Bear in mind that you also need to use ISOLINUX if you want your image to boot on BIOS systems. GRUB2 is for UEFI.
Also, you should use a recent version of xorriso
(the flag --interval:appended_partition_2:all::
was added a couple years ago, so old versions doesn't support it).
For further guidance, also take a look to this question.
New contributor
add a comment |
You can generate an ESP (EFI System Partition) image suitable for booting on UEFI with:
#! /bin/sh
BOOT_IMG_DATA=$(mktemp -d)
BOOT_IMG=efi.img
mkdir -p $(dirname $BOOT_IMG)
truncate -s 4M $BOOT_IMG
mkfs.vfat $BOOT_IMG
mkdir -p $BOOT_IMG_DATA/efi/boot
grub-mkimage
-C xz
-O x86_64-efi
-p /boot/grub
-o $BOOT_IMG_DATA/efi/boot/bootx64.efi
boot linux search normal configfile
part_gpt btrfs fat iso9660 loopback
test keystatus gfxmenu regexp probe
efi_gop efi_uga all_video gfxterm font
echo read ls cat png jpeg halt reboot
mcopy -i $BOOT_IMG -s $BOOT_IMG_DATA/efi ::
That will generate a FAT-formatted file (change the location of the file by changing the $BOOT_IMG
variable), which is, in turn, an ESP image.
You can use the generated image by adding the flag -append_partition 2 0xef efi.img
to the xorriso
command.
The resulting xorriso
command may be something like this:
xorriso -as mkisofs
-r -V <ISO_LABEL>
-o <OUTPUT_ISO_IMAGE>
-J -J -joliet-long -cache-inodes
-isohybrid-mbr /usr/lib/ISOLINUX/isohdpfx.bin
-b isolinux/isolinux.bin
-c isolinux/boot.cat
-boot-load-size 4 -boot-info-table -no-emul-boot
-eltorito-alt-boot
-e --interval:appended_partition_2:all::
-append_partition 2 0xef efi.img
-no-emul-boot -isohybrid-gpt-basdat
<ISO_DIRECTORY>
Bear in mind that you also need to use ISOLINUX if you want your image to boot on BIOS systems. GRUB2 is for UEFI.
Also, you should use a recent version of xorriso
(the flag --interval:appended_partition_2:all::
was added a couple years ago, so old versions doesn't support it).
For further guidance, also take a look to this question.
New contributor
add a comment |
You can generate an ESP (EFI System Partition) image suitable for booting on UEFI with:
#! /bin/sh
BOOT_IMG_DATA=$(mktemp -d)
BOOT_IMG=efi.img
mkdir -p $(dirname $BOOT_IMG)
truncate -s 4M $BOOT_IMG
mkfs.vfat $BOOT_IMG
mkdir -p $BOOT_IMG_DATA/efi/boot
grub-mkimage
-C xz
-O x86_64-efi
-p /boot/grub
-o $BOOT_IMG_DATA/efi/boot/bootx64.efi
boot linux search normal configfile
part_gpt btrfs fat iso9660 loopback
test keystatus gfxmenu regexp probe
efi_gop efi_uga all_video gfxterm font
echo read ls cat png jpeg halt reboot
mcopy -i $BOOT_IMG -s $BOOT_IMG_DATA/efi ::
That will generate a FAT-formatted file (change the location of the file by changing the $BOOT_IMG
variable), which is, in turn, an ESP image.
You can use the generated image by adding the flag -append_partition 2 0xef efi.img
to the xorriso
command.
The resulting xorriso
command may be something like this:
xorriso -as mkisofs
-r -V <ISO_LABEL>
-o <OUTPUT_ISO_IMAGE>
-J -J -joliet-long -cache-inodes
-isohybrid-mbr /usr/lib/ISOLINUX/isohdpfx.bin
-b isolinux/isolinux.bin
-c isolinux/boot.cat
-boot-load-size 4 -boot-info-table -no-emul-boot
-eltorito-alt-boot
-e --interval:appended_partition_2:all::
-append_partition 2 0xef efi.img
-no-emul-boot -isohybrid-gpt-basdat
<ISO_DIRECTORY>
Bear in mind that you also need to use ISOLINUX if you want your image to boot on BIOS systems. GRUB2 is for UEFI.
Also, you should use a recent version of xorriso
(the flag --interval:appended_partition_2:all::
was added a couple years ago, so old versions doesn't support it).
For further guidance, also take a look to this question.
New contributor
You can generate an ESP (EFI System Partition) image suitable for booting on UEFI with:
#! /bin/sh
BOOT_IMG_DATA=$(mktemp -d)
BOOT_IMG=efi.img
mkdir -p $(dirname $BOOT_IMG)
truncate -s 4M $BOOT_IMG
mkfs.vfat $BOOT_IMG
mkdir -p $BOOT_IMG_DATA/efi/boot
grub-mkimage
-C xz
-O x86_64-efi
-p /boot/grub
-o $BOOT_IMG_DATA/efi/boot/bootx64.efi
boot linux search normal configfile
part_gpt btrfs fat iso9660 loopback
test keystatus gfxmenu regexp probe
efi_gop efi_uga all_video gfxterm font
echo read ls cat png jpeg halt reboot
mcopy -i $BOOT_IMG -s $BOOT_IMG_DATA/efi ::
That will generate a FAT-formatted file (change the location of the file by changing the $BOOT_IMG
variable), which is, in turn, an ESP image.
You can use the generated image by adding the flag -append_partition 2 0xef efi.img
to the xorriso
command.
The resulting xorriso
command may be something like this:
xorriso -as mkisofs
-r -V <ISO_LABEL>
-o <OUTPUT_ISO_IMAGE>
-J -J -joliet-long -cache-inodes
-isohybrid-mbr /usr/lib/ISOLINUX/isohdpfx.bin
-b isolinux/isolinux.bin
-c isolinux/boot.cat
-boot-load-size 4 -boot-info-table -no-emul-boot
-eltorito-alt-boot
-e --interval:appended_partition_2:all::
-append_partition 2 0xef efi.img
-no-emul-boot -isohybrid-gpt-basdat
<ISO_DIRECTORY>
Bear in mind that you also need to use ISOLINUX if you want your image to boot on BIOS systems. GRUB2 is for UEFI.
Also, you should use a recent version of xorriso
(the flag --interval:appended_partition_2:all::
was added a couple years ago, so old versions doesn't support it).
For further guidance, also take a look to this question.
New contributor
edited Jan 23 at 17:32
New contributor
answered Jan 23 at 17:12
Luis LavaireLuis Lavaire
167
167
New contributor
New contributor
add a comment |
add a comment |
Thanks for contributing an answer to Ask Ubuntu!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f975521%2fhowto-create-uefi-bios-bootable-iso%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
1
The ISO has a pre-configured grub renamed to /EFI/Boot/bootx64.efi. UEFI only boots from /EFI/Boot/bootx64.efi. So BIOS boot is from syslinux and UEFI boot is from grub. The version of grub in the ISO is uses just the files needed to boot the installer, not the full install of grub in a standard install.See long answer, not script: askubuntu.com/questions/549647/…
– oldfred
Nov 11 '17 at 21:08
Create one partition with type
EFI System
and do as @oldfred suggested– Arpit Agarwal
Nov 11 '17 at 22:11
That reply talks about preparing a boot medium with partitions and such, whereas I'm trying to create the ISO file that others can easily boot via BIOS or UEFI. If I take the Ubuntu ISO file and mount it read-only/loopback, I see EFI/BOOT with two files in it: BOOTx64.EFI and grubx64.efi. Specifically, how are those files created?
– AndyS
Nov 12 '17 at 0:27
I see in oldfred's reference that there are clear instructions for creating bootx64.efi, but is that the same as BOOTx64.EFI? I see also an example of grub.cfg, but on the Ubuntu ISO, I see two grub.cfg files at these locations: /boot/grub/x86_64-efi/grub.cfg and /boot/grub/grub.cfg. My guess is that two files are needed, one for BIOS and the other for EFI boot.
– AndyS
Nov 12 '17 at 0:31
The grub.cfg file from oldfred's link references vmlinuz.efi. How is that file created?
– AndyS
Nov 12 '17 at 0:33