diff options
author | kroy <kroy@kroy.io> | 2020-04-28 13:54:00 -0500 |
---|---|---|
committer | kroy <kroy@kroy.io> | 2020-04-29 09:30:37 -0500 |
commit | 3ee8d560dc91173a2f1834cbad119b29177a6b3c (patch) | |
tree | 52d757c1e2361ceeaedceb2c9bed5052b286f40a /roles/install-grub | |
parent | 4e0f2e4c6a648343a8132f1eadc0cdb89bda8c4a (diff) | |
download | vyos-vm-images-3ee8d560dc91173a2f1834cbad119b29177a6b3c.tar.gz vyos-vm-images-3ee8d560dc91173a2f1834cbad119b29177a6b3c.zip |
Build BIOS/UEFI Hybrid Images
Diffstat (limited to 'roles/install-grub')
-rw-r--r-- | roles/install-grub/tasks/main.yml | 29 | ||||
-rw-r--r-- | roles/install-grub/templates/boot/grub/grub.cfg.j2 | 2 |
2 files changed, 27 insertions, 4 deletions
diff --git a/roles/install-grub/tasks/main.yml b/roles/install-grub/tasks/main.yml index 33a1049..f9cc772 100644 --- a/roles/install-grub/tasks/main.yml +++ b/roles/install-grub/tasks/main.yml @@ -1,7 +1,8 @@ + - name: Create GRUB directory become: true file: - path: "{{ vyos_write_root }}/boot/grub" + path: "{{ vyos_install_root }}/boot/grub" state: directory # It is necessary to mount and bind /dev, /proc, /sys and /boot in order to execute grub-install @@ -14,15 +15,27 @@ shell: mount --bind /dev {{ vyos_install_root }}/dev && mount --bind /proc {{ vyos_install_root }}/proc && mount --bind /sys {{ vyos_install_root }}/sys && - mount --bind {{ vyos_write_root }} {{ vyos_install_root }}/boot + mount --bind {{ vyos_write_root }} {{ vyos_install_root }}/boot args: warn: no + +- name: Mount EFI + mount: + src: "{{ vyos_target_drive }}p2" + path: "{{ vyos_install_root }}/boot/efi" + fstype: vfat + state: mounted + - name: Install GRUB in the boot sector of {{ vyos_target_drive }} become: true - command: chroot {{ vyos_install_root }} grub-install --no-floppy --root-directory=/boot {{ vyos_target_drive }} --force --target=i386-pc + command: "chroot {{ vyos_install_root }} grub-install --no-floppy --root-directory=/boot {{ vyos_grub_drive }} --force" args: - creates: "{{ vyos_install_root }}/boot/grub/grubenv" + creates: "{{ vyos_install_root }}/boot/grub/grubenv" + +- name: Install EFI GRUB to {{ vyos_target_drive }}p2 + become: true + command: "chroot {{ vyos_install_root }} grub-install --no-floppy --recheck --target=x86_64-efi --force-extra-removable --root-directory=/boot --efi-directory=/boot/efi --bootloader-id='VyOS' --no-uefi-secure-boot" - name: Configure GRUB become: true @@ -30,3 +43,11 @@ src: templates/boot/grub/grub.cfg.j2 dest: "{{ vyos_write_root }}/boot/grub/grub.cfg" mode: 0644 + +- name: Unmount EFI + mount: + src: "{{ vyos_target_drive }}p2" + path: "{{ vyos_install_root }}/boot/efi" + fstype: vfat + state: absent + diff --git a/roles/install-grub/templates/boot/grub/grub.cfg.j2 b/roles/install-grub/templates/boot/grub/grub.cfg.j2 index 6cfea8f..45aec3b 100644 --- a/roles/install-grub/templates/boot/grub/grub.cfg.j2 +++ b/roles/install-grub/templates/boot/grub/grub.cfg.j2 @@ -7,6 +7,8 @@ set timeout=5 serial --unit=0 terminal_output --append serial terminal_input serial console +insmod efi_gop +insmod efi_uga menuentry "VyOS {{ vyos_version }} for {{ vyos_platform }} (KVM console)" { linux /boot/{{ vyos_version }}/vmlinuz boot=live rootdelay=5 noautologin net.ifnames=0 biosdevname=0 vyos-union=/boot/{{ vyos_version }} console=ttyS0 console=tty0 |