-
Notifications
You must be signed in to change notification settings - Fork 246
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
fixed output usb format script for none efi cases #2656
Conversation
if [[ "$USB_DEVICE_PARTED_LABEL" == "gpt" ]] ; then | ||
LogPrint "Creating bootloader system partition on '$RAW_USB_DEVICE' from sector 34 to 2047" | ||
bootloader_partition_start_byte=34 | ||
bootloader_partition_end_byte=2047 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The LogPrint message tells about 'sector'
but the variable names are '..._byte'.
I guess the variable names should be '..._sector'.
@DEvil0000 In case of GPT with BIOS there is now
so first a But I assume that actually FYI: |
You are correct about the GPT partitions. The first one contains the |
In ReaR we use in general not sectors because their size can vary. Therefore we use in general only byte values for parted calls. With 4K sectors the current code creates the BIOS boot partition But with 4K sectors the current code would fail if a user sets e.g. But that is a minor issue. If you like you may make it safe against this issue
to let the BIOS boot partition end just before the '/boot' partition starts. |
As far as I understand
it now depends on what sector 34 means for parted. Because even 139264 bytes is much less than 1 MiB But because according to
and call parted with bios_boot_partition_start_byte and the above bios_boot_partition_end_byte And explain all this in exhaustive comments in the code |
You are correct, my USB sticks all have 512byte sectors and the code may not be safe for bigger sectors. Also have a look at wiki: bios boot partition and the svg there (lower half) partition layout for gpt with efi and bios grub this would be the layout for a EFI+BIOS hybrid formatting. |
https://en.wikipedia.org/wiki/GUID_Partition_Table reads (excerpts)
so this vaules are minumum values but the whole GPT partitioning space The German
So what the first byte on a GPT disk is that can be used by partitions This is why I wrote in
because format/USB/default/300_format_usb_disk.sh calls
which creates a default GPT area. But the size of a default GPT area is different depending on the sector size. I think if a firmware assumes the first parition starts at a fixed byte value Partitions start and end as specified in the partition table |
When some BIOS firmware refuses to boot from USB disk Therefore all data that is needed by the firmware to boot |
I am quite sure our understanding of this is the same. Maybe I was just not clear enough. |
Not sure what would be the best way of fixing the sector size (bios boot partition start/end) issue. Would appreciate a merge and fix from you. |
OK. @rear/contributors |
Type: Bug Fix
Impact: High
Reference to related issue (URL): most parts of OUTPUT=USB bug summary #2648
How was this pull request tested?
output usb on apu1 and apu2 boards - with msdos and gpt using extlinux/syslinux boot.
Brief description of the changes in this pull request:
this PR fixes all blocking bugs for output usb on none efi devices.
** fixing boot by adding gpt boot partition (ef02)
** adding boot partition to get it closer to how efi formatting works
** adding option for gpt boot flag on separate boot partition
Additional note:
you may need to set OUTPUT_URL=usb:///dev/disk/by-label/REAR-BOOT