Mount efivarfs in loader and propagate it to the SWI

This commit is contained in:
Carl D. Roth
2017-08-07 17:51:37 -07:00
parent 15efbdc540
commit a57d222661
4 changed files with 23 additions and 0 deletions

View File

@@ -49,7 +49,13 @@ done <${mtab}
rm -f ${mtab}
mount --move /proc /newroot/proc
if [ -d /sys/firmware/efi/efivars ]; then
umount /sys/firmware/efi/efivars || :
fi
mount --move /sys /newroot/sys
if [ -d /newroot/sys/firmware/efi/efivars ]; then
mount -t efivarfs efivarfs /newroot/sys/firmware/efi/efivars
fi
mount --move /dev /newroot/dev
# Switch to /newroot if possible, else re-execute /init
@@ -58,3 +64,8 @@ if [ -x /newroot/sbin/init ]; then
else
exec /init
fi
# Local variables:
# sh-indentation: 4
# sh-basic-offset: 4
# End:

View File

@@ -35,6 +35,9 @@ trap "restoreconsole; reboot -f" EXIT
# Mount special filesystems
mount -t proc proc /proc
mount -t sysfs sysfs /sys
if [ -d /sys/firmware/efi/efivars ]; then
mount -t efivarfs efivarfs /sys/firmware/efi/efivars
fi
mount -o remount,size=1M /dev
case "$(stat -f -c "%T" /tmp)" in
tmpfs|ramfs) ;;
@@ -144,4 +147,5 @@ trap - EXIT
# Local variables:
# sh-basic-offset: 4
# sh-indentation: 4
# End:

View File

@@ -113,6 +113,9 @@ installer_mkchroot() {
mkdir -p ${rootdir}/dev/pts
fi
mount -t devpts devpts "${rootdir}/dev/pts"
if test -d "${rootdir}/sys/firmware/efi/efivars"; then
mount -t efivarfs efivarfs "${rootdir}/sys/firmware/efi/efivars"
fi
if test ${TMPDIR+set}; then
# make the tempdir available to the chroot

View File

@@ -821,6 +821,11 @@ class InitrdContext(SubprocessMixin):
cmd = ('mount', '-t', 'sysfs', 'sysfs', dst,)
self.check_call(cmd, vmode=self.V1)
dst = os.path.join(self.dir, "sys/firmware/efi/efivars")
if os.path.exists(dst):
cmd = ('mount', '-t', 'efivarfs', 'efivarfs', dst,)
self.check_call(cmd, vmode=self.V1)
# maybe mount devtmpfs
if self._hasDevTmpfs:
dst = os.path.join(self.dir, "dev")