Finish enabling EFI boot mode
- Fix up issues with efi mode grub serial configuration - Modify blockdev model to order storage configuration output - Handle when we're running in uefi mode Signed-off-by: Ryan Harper <ryan.harper@canonical.com>
This commit is contained in:
parent
b5b1a00744
commit
d85bb52a63
4
Makefile
4
Makefile
|
@ -37,11 +37,11 @@ tarball: $(NAME)_$(VERSION).orig.tar.gz
|
|||
install_deps_amd64:
|
||||
sudo apt-get install grub-efi-amd64-signed
|
||||
|
||||
install_deps_$(ARCH):
|
||||
install_deps: install_deps_$(ARCH)
|
||||
sudo apt-get install python3-urwid python3-pyudev python3-netifaces python3-nose python3-flake8 python3-yaml git bzr ubuntu-cloudimage-keyring python3-jinja2 python3-coverage ovfm shim shim-signed
|
||||
|
||||
dryrun: probert
|
||||
$(MAKE) ui-view DRYRUN="--dry-run"
|
||||
$(MAKE) ui-view DRYRUN="--dry-run --uefi"
|
||||
|
||||
ui-view:
|
||||
(PYTHONPATH=$(PYTHONPATH) bin/$(PYTHONSRC) $(DRYRUN) $(MACHARGS))
|
||||
|
|
|
@ -36,6 +36,9 @@ def parse_options(argv):
|
|||
parser.add_argument('--machine-config', metavar='CONFIG',
|
||||
dest='machine_config',
|
||||
help="Don't Probe. Use probe data file")
|
||||
parser.add_argument('--uefi', action='store_true',
|
||||
dest='uefi',
|
||||
help='run in uefi support mode')
|
||||
return parser.parse_args(argv)
|
||||
|
||||
|
||||
|
|
|
@ -43,7 +43,8 @@ INSTALLER_DEPS=(
|
|||
"python3-tornado"
|
||||
)
|
||||
CACHEDIR=""
|
||||
GRUB_MODS="configfile fat part_gpt part_msdos cat echo test search search_label search_fs_uuid boot chain linux reboot halt normal efi_gop efi_uga font gfxterm"
|
||||
GRUB_MODS="configfile fat part_gpt part_msdos cat echo test search search_label search_fs_uuid boot chain linux reboot halt normal efi_gop efi_uga font gfxterm gfxterm_menu gfxterm_background gfxmenu serial"
|
||||
|
||||
|
||||
cleanup_noexit() {
|
||||
[ -n "${CACHEDIR}" ] && {
|
||||
|
|
|
@ -34,6 +34,7 @@ insmod part_msdos
|
|||
insmod png
|
||||
insmod probe
|
||||
insmod regexp
|
||||
insmod serial
|
||||
|
||||
# Set up display
|
||||
set gfxmode=auto
|
||||
|
|
|
@ -14,6 +14,7 @@
|
|||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
import logging
|
||||
import os
|
||||
from subiquity.controller import ControllerPolicy
|
||||
from subiquity.models.actions import preserve_action
|
||||
from subiquity.models import (FilesystemModel, IscsiDiskModel, RaidModel,
|
||||
|
@ -30,6 +31,7 @@ from subiquity.curtin import (curtin_write_storage_actions,
|
|||
log = logging.getLogger("subiquity.controller.filesystem")
|
||||
|
||||
BIOS_GRUB_SIZE_BYTES = 2 * 1024 * 1024 # 2MiB
|
||||
UEFI_GRUB_SIZE_BYTES = 512 * 1024 * 1024 # 512MiB EFI partition
|
||||
|
||||
|
||||
class FilesystemController(ControllerPolicy):
|
||||
|
@ -105,12 +107,21 @@ class FilesystemController(ControllerPolicy):
|
|||
''' create a gpt boot partition if one doesn't exist '''
|
||||
if current_disk.parttype == 'gpt' and \
|
||||
len(current_disk.disk.partitions) == 0:
|
||||
log.debug('Adding grub_bios gpt partition first')
|
||||
size_added = \
|
||||
current_disk.add_partition(partnum=1,
|
||||
size=BIOS_GRUB_SIZE_BYTES,
|
||||
fstype=None,
|
||||
flag='bios_grub')
|
||||
if self.is_uefi():
|
||||
log.debug('Adding EFI partition first')
|
||||
size_added = \
|
||||
current_disk.add_partition(partnum=1,
|
||||
size=UEFI_GRUB_SIZE_BYTES,
|
||||
flag='bios_grub',
|
||||
fstype='fat32',
|
||||
mountpoint='/boot/efi')
|
||||
else:
|
||||
log.debug('Adding grub_bios gpt partition first')
|
||||
size_added = \
|
||||
current_disk.add_partition(partnum=1,
|
||||
size=BIOS_GRUB_SIZE_BYTES,
|
||||
fstype=None,
|
||||
flag='bios_grub')
|
||||
|
||||
# adjust downward the partition size to accommodate
|
||||
# the offset and bios/grub partition
|
||||
|
@ -197,3 +208,10 @@ class FilesystemController(ControllerPolicy):
|
|||
self.signal,
|
||||
result)
|
||||
self.ui.set_body(disk_info_view)
|
||||
|
||||
def is_uefi(self):
|
||||
if self.opts.dry_run and self.opts.uefi:
|
||||
log.debug('forcing is_uefi True beacuse of options')
|
||||
return True
|
||||
return os.path.exists('/sys/firmware/efi')
|
||||
|
||||
|
|
|
@ -113,11 +113,9 @@ storage:
|
|||
# 12_ds_to_none: [curtin, in-target, --, sh, '-c', "echo 'datasource_list: [ None ]' > /etc/cloud/cloud.cfg.d/
|
||||
POST_INSTALL = '''
|
||||
late_commands:
|
||||
10_set_hostname: curtin in-target -- sh -c 'echo $(petname) > /etc/hostname'
|
||||
11_postinst_seed: [curtin, in-target, --, sh, '-c',"/bin/echo -e '#cloud-config\\npassword: passw0rd\\nchpasswd: {{ expire: False }}\\nusers:\\n{users}' > /var/lib/cloud/seed/nocloud-net/user-data"]
|
||||
12_disable_subiquity: curtin in-target -- systemctl disable subiquity.service
|
||||
13_delete_subiquity: curtin in-target -- rm -f /lib/systemd/system/subiquity.service
|
||||
14_remove_subiquity: curtin in-target -- sh -c 'for d in probert curtin subiquity; do rm -rf /usr/local/${{d}}; rm -rf /usr/local/bin/${{d}}*; done'
|
||||
10_mkdir_seed: curtin in-target -- mkdir -p /var/lib/cloud/seed/nocloud-net
|
||||
11_postinst_metadata: [curtin, in-target, --, sh, '-c',"/bin/echo -e instance-id: inst-3011 > /var/lib/cloud/seed/nocloud-net/meta-data"]
|
||||
12_postinst_userdata: [curtin, in-target, --, sh, '-c',"/bin/echo -e '#cloud-config\\npassword: passw0rd\\nchpasswd: {{ expire: False }}\\nusers:\\n{users}' > /var/lib/cloud/seed/nocloud-net/user-data"]
|
||||
'''
|
||||
|
||||
|
||||
|
|
|
@ -296,7 +296,27 @@ class Blockdev():
|
|||
self._mounts[partpath])
|
||||
actions.append(mount_action)
|
||||
|
||||
return [action] + [a.get() for a in actions]
|
||||
return self.sort_actions([action] + [a.get() for a in actions])
|
||||
|
||||
def sort_actions(self, actions):
|
||||
def type_index(t):
|
||||
order = ['disk', 'partition', 'format', 'mount']
|
||||
return order.index(t.get('type'))
|
||||
|
||||
def path_count(p):
|
||||
return p.get('path').count('/')
|
||||
|
||||
def order_sort(a):
|
||||
# sort by type first
|
||||
score = type_index(a)
|
||||
# for type==mount, count the number of dirs
|
||||
if a.get('type') == 'mount':
|
||||
score += path_count(a)
|
||||
return score
|
||||
|
||||
actions = sorted(actions, key=order_sort)
|
||||
|
||||
return actions
|
||||
|
||||
def get_fs_table(self):
|
||||
''' list(mountpoint, humansize, fstype, partition_path) '''
|
||||
|
|
Loading…
Reference in New Issue