Skip to content

Commit

Permalink
add support for uefi bootet systems in usb-install
Browse files Browse the repository at this point in the history
  • Loading branch information
equinox0815 committed Feb 6, 2019
1 parent 623a4f9 commit 5b85b2d
Show file tree
Hide file tree
Showing 4 changed files with 56 additions and 1 deletion.
11 changes: 11 additions & 0 deletions ansible/roles/preseed/templates/preseed_debian-stretch.cfg.j2
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,19 @@ d-i partman-md/device_remove_md boolean true
d-i partman-lvm/confirm boolean true
d-i partman-lvm/confirm_nooverwrite boolean true

{% if (hostvars[hostname].install_cooked.efi | default(false)) %}
d-i partman-efi/non_efi_system boolean true
d-i partman/choose_label string gpt
d-i partman/default_label string gpt
{% endif %}
d-i partman-auto/expert_recipe string \
boot-root :: \
{% if (hostvars[hostname].install_cooked.efi | default(false)) %}
100 100 128 fat16 \
$defaultignore{ } $primary{ } $bootable{ } \
method{ efi } format{ } \
. \
{% endif %}
1000 10000 -1 ext4 \
$defaultignore{ } $primary{ } $bootable{ } \
method{ lvm } vg_name{ {{ hostname }} } \
Expand Down
11 changes: 11 additions & 0 deletions ansible/roles/preseed/templates/preseed_ubuntu-bionic.cfg.j2
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,19 @@ d-i partman-md/device_remove_md boolean true
d-i partman-lvm/confirm boolean true
d-i partman-lvm/confirm_nooverwrite boolean true

{% if (hostvars[hostname].install_cooked.efi | default(false)) %}
d-i partman-efi/non_efi_system boolean true
d-i partman/choose_label string gpt
d-i partman/default_label string gpt
{% endif %}
d-i partman-auto/expert_recipe string \
boot-root :: \
{% if (hostvars[hostname].install_cooked.efi | default(false)) %}
100 100 128 fat16 \
$defaultignore{ } $primary{ } $bootable{ } \
method{ efi } format{ } \
. \
{% endif %}
1000 10000 -1 ext4 \
$defaultignore{ } $primary{ } $bootable{ } \
method{ lvm } vg_name{ {{ hostname }} } \
Expand Down
11 changes: 11 additions & 0 deletions ansible/roles/preseed/templates/preseed_ubuntu-xenial.cfg.j2
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,19 @@ d-i partman-md/device_remove_md boolean true
d-i partman-lvm/confirm boolean true
d-i partman-lvm/confirm_nooverwrite boolean true

{% if (hostvars[hostname].install_cooked.efi | default(false)) %}
d-i partman-efi/non_efi_system boolean true
d-i partman/choose_label string gpt
d-i partman/default_label string gpt
{% endif %}
d-i partman-auto/expert_recipe string \
boot-root :: \
{% if (hostvars[hostname].install_cooked.efi | default(false)) %}
100 100 128 fat16 \
$defaultignore{ } $primary{ } $bootable{ } \
method{ efi } format{ } \
. \
{% endif %}
1000 10000 -1 ext4 \
$defaultignore{ } $primary{ } $bootable{ } \
method{ lvm } vg_name{ {{ hostname }} } \
Expand Down
24 changes: 23 additions & 1 deletion ansible/usb-install.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
loop_control:
label: "{{ item | basename }}"

- name: Generate syslinux configuration
- name: Generate syslinux configuration for BIOS boot
copy:
dest: "{{ usbdrive_path }}/syslinux.cfg"
content: |
Expand All @@ -52,6 +52,22 @@
INITRD initrd.preseed.gz
APPEND install {{ (install.kernel_cmdline | default([])) | join(' ') }}
- name: create EFI boot directory
file:
path: "{{ usbdrive_path }}/EFI/boot"
state: directory

- name: Generate syslinux configuration for UEFI boot
copy:
dest: "{{ usbdrive_path }}/EFI/boot/syslinux.cfg"
content: |
DEFAULT linux
SAY SYSLINUX booting an automated installer for {{ hostname }}...
LABEL linux
KERNEL ../../linux
INITRD ../../initrd.preseed.gz
APPEND install {{ (install.kernel_cmdline | default([])) | join(' ') }}
- name: Make the USB disk bootable
pause:
seconds: 0
Expand All @@ -65,4 +81,10 @@
$ sudo fdisk /dev/CHANGEME
[Here, make sure partition 1 is marked bootable.]
for UEFI these steps need to be done
$ sudo apt install syslinux-efi
$ cp /usr/lib/syslinux/modules/efi64/* {{ usbdrive_path }}/EFI/boot/
$ cp /usr/lib/SYSLINUX.EFI/efi64/syslinux.efi {{ usbdrive_path }}/EFI/boot/bootx64.efi
This will NOT be done automatically.

0 comments on commit 5b85b2d

Please sign in to comment.