[Libguestfs] boot loader detection
Nikos Skalkotos
skalkoto at grnet.gr
Fri Jun 19 10:53:13 UTC 2015
Hello,
I was looking for a way to detect the installed boot loader of an image
and I found this: https://github.com/arvidjaar/bootinfoscript
This script will inspection a lot of things on a running system and will
output a Report. The most interesting part is that it uses known Master
and Volume Boot Record byte-patterns to determine the installed boot loader:
https://github.com/arvidjaar/bootinfoscript/blob/master/bootinfoscript#L2983-L3151
https://github.com/arvidjaar/bootinfoscript/blob/master/bootinfoscript#L2343-L2459
Those signatures (byte patterns) are from real mode machine code but this
code is not generated by a compiler and does not change often.
I’ve isolated and simplified the signatures database here:
https://github.com/skalkoto/snf-image-creator/blob/develop/image_creator/bootloader.py
and I was wondering if you care to add 2 new libguestfs API methods e.g.:
char * guestfs_inspect_get_mbr_bootloader(guestfs *g)
char * guestfs_inspect_get_vbr_bootloader(guests *g, char *device)
that would return a string like “grub2”, “syslinux”, “windows”, etc.
I can write the code.
What do you think?
Nikos
More information about the Libguestfs
mailing list