Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
image-hd: add support for overridding optional fields of the MBR #260
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Uh oh!
There was an error while loading. Please reload this page.
image-hd: add support for overridding optional fields of the MBR #260
Changes from all commits
4fe428fFile filter
Filter by extension
Conversations
Uh oh!
There was an error while loading. Please reload this page.
Jump to
Uh oh!
There was an error while loading. Please reload this page.
The 'holes' property allows to describe holes in an image, for example to allow writing an image that spans accross the MBR partition table. The image-hd code creates a fake partition spanning from 440 bytes to 512 bytes to protect the area used by the partition table. However, it turns out that the Amlogic SoCs have a bootloader that is precisely written accross the partition table, with some bits before the partition table and some bits after. But those Amlogic SoCs use the first 444 bytes, instead of just the first 440 bytes (see [1]). This is possible because the first 2 fields of the MBR are optional fields (see [2]). The first optional field is the disk signature (4 bytes), the second optional field is the "copy protect" field (2 bytes). Therefore, to write a bootloader image for the Amlogic SoCs, we need to write something like: image fip/u-boot.bin.sd.bin { file { holes = {"(444; 512)"} } } But that isn't accepted because it overlaps with the fake MBR partition that starts at offset 440. In order to allow this, the present commit adds a new 'mbr-skip-optionals' property, which tells genimage that we would like to skip writing those optional fields, allowing the full 446 bytes to be used, as is needed for Amlogic SoC bootloader images. Implementation note: we would have preferred to write: mbr_data += sizeof(struct mbr_tail_optionals); but genimage has chosen to not allow arithmetic on void* pointers, so instead we have chosen to use: mbr_data = &mbr.part_entry[0]; when adjusting the start of the MBR data that have to be inserted into the image. This commit also adds two test cases for this new feature: - One positive test case, where we verify that we can write an image where the hole is (444, 512) and the mbr-skip-optionals = "true" option is passed - One negative test case, where we verify that we are not allowed to write an image where the hole is (444, 512) when mbr-skip-optionals = "false". [1] http://docs.khadas.com/products/sbc/vim3/development/create-bootable-tf-card [2] https://wiki.osdev.org/MBR_(x86) Co-Developed-by: Romain Naour <[email protected]> Signed-off-by: Thomas Petazzoni <[email protected]>Uh oh!
There was an error while loading. Please reload this page.
There are no files selected for viewing