Skip to content

Commit

Permalink
x86 bios and efi working
Browse files Browse the repository at this point in the history
  • Loading branch information
kenmoini committed Mar 20, 2023
1 parent ce1aeba commit 3b68f46
Show file tree
Hide file tree
Showing 4 changed files with 102 additions and 77 deletions.
31 changes: 20 additions & 11 deletions deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,8 @@
- name: rocky91x8664
displayName: Rocky Linux 9.1
group: rocky91
efi_kernel: vmlinuz
efi_initrd: initrd.img
efi_kernel: images/pxeboot/vmlinuz
efi_initrd: images/pxeboot/initrd.img
arch: x86_64
family: rhel
isoURL: https://download.rockylinux.org/pub/rocky/9/isos/x86_64/Rocky-9.1-x86_64-dvd.iso
Expand All @@ -107,8 +107,8 @@
- name: rocky91arm64
displayName: Rocky Linux 9.1
group: rocky91
efi_kernel: vmlinuz
efi_initrd: initrd.img
efi_kernel: images/pxeboot/vmlinuz
efi_initrd: images/pxeboot/initrd.img
arch: aarch64
family: rhel
isoURL: https://download.rockylinux.org/pub/rocky/9/isos/aarch64/Rocky-9.1-aarch64-dvd.iso
Expand All @@ -125,8 +125,8 @@
group: rhel86
bios_kernel: images/pxeboot/vmlinuz
bios_initrd: images/pxeboot/initrd.img
efi_kernel: casper/linux
efi_initrd: casper/initrd.gz
efi_kernel: images/pxeboot/vmlinuz
efi_initrd: images/pxeboot/initrd.img
arch: x86_64
family: rhel
# Either isoURL or isoSrcPath need to be provided
Expand All @@ -143,8 +143,8 @@
- name: rhel86arm64
displayName: Red Hat Enterprise Linux 8.6
group: rhel86
efi_kernel: casper/linux
efi_initrd: casper/initrd.gz
efi_kernel: images/pxeboot/vmlinuz
efi_initrd: images/pxeboot/initrd.img
arch: aarch64
family: rhel
# Either isoURL or isoSrcPath need to be provided
Expand All @@ -162,6 +162,8 @@
group: rhel87
bios_kernel: images/pxeboot/vmlinuz
bios_initrd: images/pxeboot/initrd.img
efi_kernel: images/pxeboot/vmlinuz
efi_initrd: images/pxeboot/initrd.img
arch: x86_64
family: rhel
# Either isoURL or isoSrcPath need to be provided
Expand All @@ -178,8 +180,8 @@
- name: rhel91x8664
displayName: Red Hat Enterprise Linux 9.1
group: rhel91
kernel: images/pxeboot/vmlinuz
initrd: images/pxeboot/initrd.img
efi_kernel: images/pxeboot/vmlinuz
efi_initrd: images/pxeboot/initrd.img
arch: x86_64
efi_loader_seed: true
efi_loader_path: EFI/BOOT/ # trailing slash is important!
Expand Down Expand Up @@ -378,7 +380,6 @@
ansible.builtin.fail:
msg: "EFI boot method detected for aarch64, but no seeder was detected. Please set the 'efi_loader_seed' variable to 'true' for the distro you wish to seed as the primary bootloader seed."


- name: Seed the X86_64 Bootloader files
when: efi_x86_64_seeder_name is defined and efi_x86_64_seeder_name != "" and efi_x86_64_seeder_name == distro_item.name and distro_item.arch == "x86_64"
ansible.builtin.copy:
Expand Down Expand Up @@ -425,6 +426,14 @@
group: nobody
mode: 0755

- name: Template the EFI Boot Menu for aarch64
template:
src: templates/menu-aarch64-efi.j2
dest: "{{ tftp_server_base_path }}/EFI/aarch64/grub.cfg"
owner: nobody
group: nobody
mode: 0755

- name: Per Distro Operations
block:

Expand Down
16 changes: 16 additions & 0 deletions tasks/copy-iso-files.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,22 @@
loop:
- "{{ distro_item.bios_kernel }}"
- "{{ distro_item.bios_initrd }}"
loop_control:
loop_var: boot_item
label: "{{ boot_item }}"

- name: Copy the Kernel and Initrd files to the distro tftpboot directory - EFI
when: '"EFI" in distro_item.boot_methods'
ansible.builtin.copy:
src: "{{ install_iso_mount_base_path }}/{{ distro_item.arch }}/{{ distro_item.group }}/ext/{{ iso_basename }}/{{ boot_item }}"
dest: "{{ tftp_server_base_path }}/EFI/{{ distro_item.arch }}/{{ distro_item.group }}/{{ distro_item.name }}/{{ boot_item | basename }}"
mode: 0644
owner: nobody
group: nobody
remote_src: true
loop:
- "{{ distro_item.efi_kernel }}"
- "{{ distro_item.efi_initrd }}"
loop_control:
loop_var: boot_item
label: "{{ boot_item }}"
55 changes: 39 additions & 16 deletions templates/menu-aarch64-efi.j2
Original file line number Diff line number Diff line change
Expand Up @@ -25,22 +25,45 @@ set timeout=60

search --no-floppy --set=root -l 'RHEL-9-1-0-BaseOS-aarch64'

### BEGIN /etc/grub.d/10_linux ###
menuentry 'Install Red Hat Enterprise Linux 9.1' --class red --class gnu-linux --class gnu --class os {
linux /images/pxeboot/vmlinuz inst.stage2=hd:LABEL=RHEL-9-1-0-BaseOS-aarch64 ro
initrd /images/pxeboot/initrd.img
submenu 'Install Linux, GUI Mode, AARCH64 -->' {
{% for distro in distros %}
{% if "EFI" in distro.boot_methods and distro.arch == "aarch64" and distro.efi_options is defined and "gui-install" in distro.efi_options %}
{% if distro.isoURL is defined %}{% set isoFileName = distro.isoURL | basename %}{% endif %}
{% if distro.isoSrcPath is defined %}{% set isoFileName = distro.isoSrcPath | basename %}{% endif %}
menuentry '{{ distro.displayName }} - {{ distro.protocol | upper }}' --class {{ distro.family }} --class {{ distro.name }} {
linux /EFI/{{ distro.arch }}/{{ distro.group }}/{{ distro.name }}/{{ distro.efi_kernel | basename }}{% if distro.family == "rhel" %} inst.stage2={{ distro.protocol | lower }}://{{ pxe_server_ip }}/{{ 'pub/' if (distro.protocol|lower) == "ftp" }}{{ install_iso_mount_sub_path }}/{{ distro.arch }}/{{ distro.group }}/ext/{{ isoFileName | replace('.iso','') }} inst.repo={{ distro.protocol | lower }}://{{ pxe_server_ip }}/{{ 'pub/' if (distro.protocol|lower) == "ftp" }}{{ install_iso_mount_sub_path }}/{{ distro.arch }}/{{ distro.group }}/ext/{{ isoFileName | replace('.iso','') }} quiet{% elif distro.family == "ubuntu" %} root=/dev/ram0 ramdisk_size=1500000 ip=dhcp url={{ distro.protocol | lower }}://{{ pxe_server_ip }}/{{ 'pub/' if (distro.protocol|lower) == "ftp" }}{{ install_iso_mount_sub_path }}/{{ distro.arch }}/{{ distro.group }}/iso/{{ isoFileName }}{% endif %}

initrd /EFI/{{ distro.arch }}/{{ distro.group }}/{{ distro.name }}/{{ distro.efi_initrd | basename }}
}

{% endif %}
{% endfor %}
}
menuentry 'Test this media & install Red Hat Enterprise Linux 9.1' --class red --class gnu-linux --class gnu --class os {
linux /images/pxeboot/vmlinuz inst.stage2=hd:LABEL=RHEL-9-1-0-BaseOS-aarch64 rd.live.check
initrd /images/pxeboot/initrd.img

submenu 'Install Linux, Text Mode, AARCH64 -->' {
{% for distro in distros %}
{% if "EFI" in distro.boot_methods and distro.arch == "aarch64" and distro.efi_options is defined and "text-install" in distro.efi_options %}
{% if distro.isoURL is defined %}{% set isoFileName = distro.isoURL | basename %}{% endif %}
{% if distro.isoSrcPath is defined %}{% set isoFileName = distro.isoSrcPath | basename %}{% endif %}
menuentry '{{ distro.displayName }} - {{ distro.protocol | upper }}' --class {{ distro.family }} --class {{ distro.name }} {
linux /EFI/{{ distro.arch }}/{{ distro.group }}/{{ distro.name }}/{{ distro.efi_kernel | basename }}{% if distro.family == "rhel" %} inst.stage2={{ distro.protocol | lower }}://{{ pxe_server_ip }}/{{ 'pub/' if (distro.protocol|lower) == "ftp" }}{{ install_iso_mount_sub_path }}/{{ distro.arch }}/{{ distro.group }}/ext/{{ isoFileName | replace('.iso','') }} inst.repo={{ distro.protocol | lower }}://{{ pxe_server_ip }}/{{ 'pub/' if (distro.protocol|lower) == "ftp" }}{{ install_iso_mount_sub_path }}/{{ distro.arch }}/{{ distro.group }}/ext/{{ isoFileName | replace('.iso','') }} inst.text quiet{% elif distro.family == "ubuntu" %} root=/dev/ram0 ramdisk_size=1500000 ip=dhcp url={{ distro.protocol | lower }}://{{ pxe_server_ip }}/{{ 'pub/' if (distro.protocol|lower) == "ftp" }}{{ install_iso_mount_sub_path }}/{{ distro.arch }}/{{ distro.group }}/iso/{{ isoFileName }}{% endif %}

initrd /EFI/{{ distro.arch }}/{{ distro.group }}/{{ distro.name }}/{{ distro.efi_initrd | basename }}
}
{% endif %}
{% endfor %}
}
submenu 'Troubleshooting -->' {
menuentry 'Install Red Hat Enterprise Linux 9.1 in text mode' --class red --class gnu-linux --class gnu --class os {
linux /images/pxeboot/vmlinuz inst.stage2=hd:LABEL=RHEL-9-1-0-BaseOS-aarch64 inst.text
initrd /images/pxeboot/initrd.img
}
menuentry 'Rescue a Red Hat Enterprise Linux system' --class red --class gnu-linux --class gnu --class os {
linux /images/pxeboot/vmlinuz inst.stage2=hd:LABEL=RHEL-9-1-0-BaseOS-aarch64 inst.rescue
initrd /images/pxeboot/initrd.img
}

submenu 'Rescue Linux, AARCH64 -->' {
{% for distro in distros %}
{% if "EFI" in distro.boot_methods and distro.arch == "aarch64" and distro.efi_options is defined and "linux-rescue" in distro.efi_options %}
{% if distro.isoURL is defined %}{% set isoFileName = distro.isoURL | basename %}{% endif %}
{% if distro.isoSrcPath is defined %}{% set isoFileName = distro.isoSrcPath | basename %}{% endif %}
menuentry '{{ distro.displayName }} - {{ distro.protocol | upper }}' --class {{ distro.family }} --class {{ distro.name }} {
linux /EFI/{{ distro.arch }}/{{ distro.group }}/{{ distro.name }}/{{ distro.efi_kernel | basename }}{% if distro.family == "rhel" %} inst.stage2={{ distro.protocol | lower }}://{{ pxe_server_ip }}/{{ 'pub/' if (distro.protocol|lower) == "ftp" }}{{ install_iso_mount_sub_path }}/{{ distro.arch }}/{{ distro.group }}/ext/{{ isoFileName | replace('.iso','') }} inst.repo={{ distro.protocol | lower }}://{{ pxe_server_ip }}/{{ 'pub/' if (distro.protocol|lower) == "ftp" }}{{ install_iso_mount_sub_path }}/{{ distro.arch }}/{{ distro.group }}/ext/{{ isoFileName | replace('.iso','') }} inst.rescue quiet{% elif distro.family == "ubuntu" %} root=/dev/ram0 ramdisk_size=1500000 ip=dhcp url={{ distro.protocol | lower }}://{{ pxe_server_ip }}/{{ 'pub/' if (distro.protocol|lower) == "ftp" }}{{ install_iso_mount_sub_path }}/{{ distro.arch }}/{{ distro.group }}/iso/{{ isoFileName }}{% endif %}

initrd /EFI/{{ distro.arch }}/{{ distro.group }}/{{ distro.name }}/{{ distro.efi_initrd | basename }}
}
{% endif %}
{% endfor %}
}
77 changes: 27 additions & 50 deletions templates/menu-x86_64-efi.j2
Original file line number Diff line number Diff line change
Expand Up @@ -19,70 +19,47 @@ insmod ext2
set timeout=60
### END /etc/grub.d/00_header ###

# search --no-floppy --set=root -l 'Rocky-9-1-x86_64-dvd'

### BEGIN /etc/grub.d/10_linux ###

submenu 'Install Linux, GUI Mode, x86_64 -->' {
{% for distro in distros %}
{% if "EFI" in distro.boot_methods and distro.arch == "x86_64" and "gui-install" in distro.efi_options %}
{% if "EFI" in distro.boot_methods and distro.arch == "x86_64" and distro.efi_options is defined and "gui-install" in distro.efi_options %}
{% if distro.isoURL is defined %}{% set isoFileName = distro.isoURL | basename %}{% endif %}
{% if distro.isoSrcPath is defined %}{% set isoFileName = distro.isoSrcPath | basename %}{% endif %}
label {{ distro.name }}
menu label {{ distro.displayName }} - {{ distro.protocol | upper }}
kernel {{ distro.group }}/{{ distro.name }}/{{ distro.bios_kernel | basename }}
initrd {{ distro.group }}/{{ distro.name }}/{{ distro.bios_initrd | basename }}
{% if distro.family == "rhel" %}
append inst.stage2={{ distro.protocol | lower }}://{{ pxe_server_ip }}/{{ 'pub/' if (distro.protocol|lower) == "ftp" }}{{ install_iso_mount_sub_path }}/{{ distro.arch }}/{{ distro.group }}/ext/{{ isoFileName | replace('.iso','') }} inst.repo={{ distro.protocol | lower }}://{{ pxe_server_ip }}/{{ 'pub/' if (distro.protocol|lower) == "ftp" }}{{ install_iso_mount_sub_path }}/{{ distro.arch }}/{{ distro.group }}/ext/{{ isoFileName | replace('.iso','') }} quiet
{% elif distro.family == "ubuntu" %}
append root=/dev/ram0 ramdisk_size=1500000 ip=dhcp url={{ distro.protocol | lower }}://{{ pxe_server_ip }}/{{ 'pub/' if (distro.protocol|lower) == "ftp" }}{{ install_iso_mount_sub_path }}/{{ distro.arch }}/{{ distro.group }}/iso/{{ isoFileName }}
{% endif %}
{% endif %}
{% endfor %}

menuentry 'Install RHEL 8.6 - FTP' --class fedora --class gnu-linux --class gnu --class os {
linuxefi /EFI/x86/rhel8.6/boot/vmlinuz inst.stage2=ftp://192.168.42.16/pub/pxe/install/x86_64/rhel8/ext/rhel-8.6-x86_64-dvd inst.repo=ftp://192.168.42.16/pub/pxe/install/x86_64/rhel8/ext/rhel-8.6-x86_64-dvd quiet
initrdefi /EFI/x86/rhel8.6/boot/initrd.img
}
menuentry 'Install RHEL 8.7 - FTP' --class fedora --class gnu-linux --class gnu --class os {
linuxefi /EFI/x86/rhel8.7/boot/vmlinuz inst.stage2=ftp://192.168.42.16/pub/pxe/install/x86_64/rhel8/ext/rhel-8.7-x86_64-dvd inst.repo=http://192.168.42.16/pub/pxe/install/x86_64/rhel8/ext/rhel-8.7-x86_64-dvd quiet
initrdefi /EFI/x86/rhel8.7/boot/initrd.img
menuentry '{{ distro.displayName }} - {{ distro.protocol | upper }}' --class {{ distro.family }} --class {{ distro.name }} {
linuxefi /EFI/{{ distro.arch }}/{{ distro.group }}/{{ distro.name }}/{{ distro.efi_kernel | basename }}{% if distro.family == "rhel" %} inst.stage2={{ distro.protocol | lower }}://{{ pxe_server_ip }}/{{ 'pub/' if (distro.protocol|lower) == "ftp" }}{{ install_iso_mount_sub_path }}/{{ distro.arch }}/{{ distro.group }}/ext/{{ isoFileName | replace('.iso','') }} inst.repo={{ distro.protocol | lower }}://{{ pxe_server_ip }}/{{ 'pub/' if (distro.protocol|lower) == "ftp" }}{{ install_iso_mount_sub_path }}/{{ distro.arch }}/{{ distro.group }}/ext/{{ isoFileName | replace('.iso','') }} quiet{% elif distro.family == "ubuntu" %} root=/dev/ram0 ramdisk_size=1500000 ip=dhcp url={{ distro.protocol | lower }}://{{ pxe_server_ip }}/{{ 'pub/' if (distro.protocol|lower) == "ftp" }}{{ install_iso_mount_sub_path }}/{{ distro.arch }}/{{ distro.group }}/iso/{{ isoFileName }}{% endif %}

initrdefi /EFI/{{ distro.arch }}/{{ distro.group }}/{{ distro.name }}/{{ distro.efi_initrd | basename }}
}

menuentry 'Install Rocky Linux 9.1 - HTTP' --class fedora --class gnu-linux --class gnu --class os {
linuxefi /EFI/x86/rocky9.1/boot/vmlinuz inst.stage2=http://192.168.42.16/pxe/install/x86_64/rocky9/ext/Rocky-9.1-x86_64-dvd inst.repo=http://192.168.42.16/pxe/install/x86_64/rocky9/ext/Rocky-9.1-x86_64-dvd quiet
initrdefi /EFI/x86/rocky9.1/boot/initrd.img
}
{% endif %}
{% endfor %}
}

submenu 'Install Linux, Text Mode, x86_64 -->' {
menuentry 'Install RHEL 8.6 - FTP' --class fedora --class gnu-linux --class gnu --class os {
linuxefi /EFI/x86/rhel8.6/boot/vmlinuz inst.stage2=ftp://192.168.42.16/pub/pxe/install/x86_64/rhel8/ext/rhel-8.6-x86_64-dvd inst.repo=ftp://192.168.42.16/pub/pxe/install/x86_64/rhel8/ext/rhel-8.6-x86_64-dvd inst.text quiet
initrdefi /EFI/x86/rhel8.6/boot/initrd.img
}
menuentry 'Install RHEL 8.7 - FTP' --class fedora --class gnu-linux --class gnu --class os {
linuxefi /EFI/x86/rhel8.7/boot/vmlinuz inst.stage2=ftp://192.168.42.16/pub/pxe/install/x86_64/rhel8/ext/rhel-8.7-x86_64-dvd inst.text quiet
initrdefi /EFI/x86/rhel8.7/boot/initrd.img
}

menuentry 'Install Rocky Linux 9.1 - HTTP' --class fedora --class gnu-linux --class gnu --class os {
linuxefi /EFI/x86/rocky9.1/boot/vmlinuz inst.stage2=http://192.168.42.16/pxe/install/x86_64/rocky9/ext/Rocky-9.1-x86_64-dvd inst.repo=http://192.168.42.16/pxe/install/x86_64/rocky9/ext/Rocky-9.1-x86_64-dvd inst.text quiet
initrdefi /EFI/x86/rocky9.1/boot/initrd.img
{% for distro in distros %}
{% if "EFI" in distro.boot_methods and distro.arch == "x86_64" and distro.efi_options is defined and "text-install" in distro.efi_options %}
{% if distro.isoURL is defined %}{% set isoFileName = distro.isoURL | basename %}{% endif %}
{% if distro.isoSrcPath is defined %}{% set isoFileName = distro.isoSrcPath | basename %}{% endif %}
menuentry '{{ distro.displayName }} - {{ distro.protocol | upper }}' --class {{ distro.family }} --class {{ distro.name }} {
linuxefi /EFI/{{ distro.arch }}/{{ distro.group }}/{{ distro.name }}/{{ distro.efi_kernel | basename }}{% if distro.family == "rhel" %} inst.stage2={{ distro.protocol | lower }}://{{ pxe_server_ip }}/{{ 'pub/' if (distro.protocol|lower) == "ftp" }}{{ install_iso_mount_sub_path }}/{{ distro.arch }}/{{ distro.group }}/ext/{{ isoFileName | replace('.iso','') }} inst.repo={{ distro.protocol | lower }}://{{ pxe_server_ip }}/{{ 'pub/' if (distro.protocol|lower) == "ftp" }}{{ install_iso_mount_sub_path }}/{{ distro.arch }}/{{ distro.group }}/ext/{{ isoFileName | replace('.iso','') }} inst.text quiet{% elif distro.family == "ubuntu" %} root=/dev/ram0 ramdisk_size=1500000 ip=dhcp url={{ distro.protocol | lower }}://{{ pxe_server_ip }}/{{ 'pub/' if (distro.protocol|lower) == "ftp" }}{{ install_iso_mount_sub_path }}/{{ distro.arch }}/{{ distro.group }}/iso/{{ isoFileName }}{% endif %}

initrdefi /EFI/{{ distro.arch }}/{{ distro.group }}/{{ distro.name }}/{{ distro.efi_initrd | basename }}
}
{% endif %}
{% endfor %}
}

submenu 'Rescue Linux, x86_64 -->' {
menuentry 'Rescue RHEL 8.6 - FTP' --class fedora --class gnu-linux --class gnu --class os {
linuxefi /EFI/x86/rhel8.6/boot/vmlinuz inst.stage2=ftp://192.168.42.16/pub/pxe/install/x86_64/rhel8/ext/rhel-8.6-x86_64-dvd inst.rescue quiet
initrdefi /EFI/x86/rhel8.6/boot/initrd.img
}
menuentry 'Rescue RHEL 8.7 - FTP' --class fedora --class gnu-linux --class gnu --class os {
linuxefi /EFI/x86/rhel8.7/boot/vmlinuz inst.stage2=ftp://192.168.42.16/pub/pxe/install/x86_64/rhel8/ext/rhel-8.7-x86_64-dvd inst.rescue quiet
initrdefi /EFI/x86/rhel8.7/boot/initrd.img
}

menuentry 'Install Rocky Linux 9.1 - HTTP' --class fedora --class gnu-linux --class gnu --class os {
linuxefi /EFI/x86/rocky9.1/boot/vmlinuz inst.stage2=http://192.168.42.16/pxe/install/x86_64/rocky9/ext/Rocky-9.1-x86_64-dvd inst.rescue quiet
initrdefi /EFI/x86/rocky9.1/boot/initrd.img
{% for distro in distros %}
{% if "EFI" in distro.boot_methods and distro.arch == "x86_64" and distro.efi_options is defined and "linux-rescue" in distro.efi_options %}
{% if distro.isoURL is defined %}{% set isoFileName = distro.isoURL | basename %}{% endif %}
{% if distro.isoSrcPath is defined %}{% set isoFileName = distro.isoSrcPath | basename %}{% endif %}
menuentry '{{ distro.displayName }} - {{ distro.protocol | upper }}' --class {{ distro.family }} --class {{ distro.name }} {
linuxefi /EFI/{{ distro.arch }}/{{ distro.group }}/{{ distro.name }}/{{ distro.efi_kernel | basename }}{% if distro.family == "rhel" %} inst.stage2={{ distro.protocol | lower }}://{{ pxe_server_ip }}/{{ 'pub/' if (distro.protocol|lower) == "ftp" }}{{ install_iso_mount_sub_path }}/{{ distro.arch }}/{{ distro.group }}/ext/{{ isoFileName | replace('.iso','') }} inst.repo={{ distro.protocol | lower }}://{{ pxe_server_ip }}/{{ 'pub/' if (distro.protocol|lower) == "ftp" }}{{ install_iso_mount_sub_path }}/{{ distro.arch }}/{{ distro.group }}/ext/{{ isoFileName | replace('.iso','') }} inst.rescue quiet{% elif distro.family == "ubuntu" %} root=/dev/ram0 ramdisk_size=1500000 ip=dhcp url={{ distro.protocol | lower }}://{{ pxe_server_ip }}/{{ 'pub/' if (distro.protocol|lower) == "ftp" }}{{ install_iso_mount_sub_path }}/{{ distro.arch }}/{{ distro.group }}/iso/{{ isoFileName }}{% endif %}

initrdefi /EFI/{{ distro.arch }}/{{ distro.group }}/{{ distro.name }}/{{ distro.efi_initrd | basename }}
}
{% endif %}
{% endfor %}
}

0 comments on commit 3b68f46

Please sign in to comment.