grub2.inst: Add support for creating iso9660 boot image

Don't include the "location" offset, and use just a path for the prefix
section to set the path of the grub2 modules on the iso. eg.

{
    "filename": "eltorito.img",
    "platform": "i386-pc",
    "core": {
        "type": "mkimage",
        "partlabel": "gpt",
        "filesystem": "iso9660"
    },
    "prefix": {
        "path": "/boot/grub2/"
    }
}
This commit is contained in:
Brian C. Lane 2024-11-21 13:13:56 -08:00 committed by Simon de Vlieger
parent 41c0550a1f
commit 3bed7c7ace
3 changed files with 70 additions and 17 deletions

View file

@ -31,3 +31,22 @@ def test_grub2_partition(tmp_path, stage_module):
with open(treedir / "disk.img", "rb") as f:
msg = f.read(12)
assert msg != b"Just testing"
def test_grub2_iso9660(tmp_path, stage_module):
treedir = tmp_path / "tree"
os.makedirs(treedir, exist_ok=True)
options = {
"filename": "eltorito.img",
"platform": "i386-pc",
"core": {
"type": "mkimage",
"partlabel": "gpt",
"filesystem": "iso9660",
},
"prefix": {
"path": "/boot/grub2/",
},
}
stage_module.main(treedir, options)
assert os.path.exists(treedir / "eltorito.img")