sysroot: Support /boot on root or as seperate filesystem for syslinux and u-boot
We use a similar trick to having a `sysroot -> .` symlink on the real root here to support both /boot on root as well as on a separate filesystem. No matter how it's mounted `/boot/xyz` will always refer to the file you'd expect. This is nicer than my previous attempts at this because there's no configuration nor auto-detection required.
This commit is contained in:
1 parent
4deb426835
commit
0ced9fde76
4 files changed
+41
-15
No files matched your search
@@ -97,15 +97,32 @@ with open(syslinuxpath) as f:
|
||||
if len(entries) != len(syslinux_entries):
|
||||
fatal("Found {0} loader entries, but {1} SYSLINUX entries\n".format(len(entries), len(syslinux_entries)))
|
||||
|
||||
def assert_matches_key(a, b, key):
|
||||
|
||||
def assert_eq(a, b):
|
||||
assert a == b, "%r == %r" % (a, b)
|
||||
|
||||
|
||||
def assert_key_same_file(a, b, key):
|
||||
aval = a[key]
|
||||
bval = b[key]
|
||||
if aval != bval:
|
||||
fatal("Mismatch on {0}: {1} != {2}".format(key, aval, bval))
|
||||
sys.stderr.write("aval: %r\nbval: %r\n" % (aval, bval))
|
||||
|
||||
# Paths in entries are always relative to /boot
|
||||
entry = os.stat(sysroot + "/boot" + aval)
|
||||
|
||||
# Syslinux entries can be relative to /boot (if it's on another filesystem)
|
||||
# or relative to / if /boot is on /.
|
||||
s1 = os.stat(sysroot + bval)
|
||||
s2 = os.stat(sysroot + "/boot" + bval)
|
||||
|
||||
# A symlink ensures that no matter what they point at the same file
|
||||
assert_eq(entry, s1)
|
||||
assert_eq(entry, s2)
|
||||
|
||||
|
||||
for i,(entry,syslinuxentry) in enumerate(zip(entries, syslinux_entries)):
|
||||
assert_matches_key(entry, syslinuxentry, 'linux')
|
||||
assert_matches_key(entry, syslinuxentry, 'initrd')
|
||||
assert_key_same_file(entry, syslinuxentry, 'linux')
|
||||
assert_key_same_file(entry, syslinuxentry, 'initrd')
|
||||
entry_ostree = get_ostree_option(entry['options'])
|
||||
syslinux_ostree = get_ostree_option(syslinuxentry['options'])
|
||||
if entry_ostree != syslinux_ostree:
|
||||
|
||||
Reference in new issue
Block a user