I had a search on the net for this but nothing came up exactly as I am looking for. I'm working on a custom Debian Jessie installer for an "obscure" PowerPC platform, AmigaOne XE, and in validating the boot partition I need to scan the start of the HDD and locate a boot block. So I need to convert the boot partition back to the root block device that is pointing to the whole HDD.
To put this into perspective and in a way easy to understand here is an example. Say the boot partition is at:
Code: Select all
/dev/sda2
Code: Select all
/dev/sda
My code is in C so right now I'm opening it as a file and reading in blocks. So if there is also a function in the Linux API that can help that would be fine also. I know hardly anything about the Linux device API except the convenience of being able to transparently open devices as file.
I could keep on searching online and test programs I find to see if that helps but I thought I would just ask. Sorry if root block device is an abuse of terms. But I think you know what I mean there.
I'm happy to use a shell command or a Linux function call for this purpose. Either will be fine. It will be run from a partman hook in d-i.