[LEDE-DEV] [RFC] creating LEDE GPT image using raw GPT partition dump

Alberto Bursi alberto.bursi at outlook.it
Sat Jul 15 07:50:29 PDT 2017


I'm trying to add support for a nas box whose stock "firmware" was 
actually installed in the sata hard drive. Iomega EZ, which is a lower 
end version of Iomega ix2-nd that also has this feature, there are 
others like some single drives from Lacie, I think.

Therefore, it needs to be GPT.

Stock is using GPT too but it's kind of irrelevant for the bootloader as 
the stock kernel/firmware are flashed raw in the first 100MB of 
unallocated space anyway (and both run from RAM, apparently).

By looking around, it seems the LEDE buildsystem is unable to create GPT 
images, it lacks gdisk tool, and I don't even know if it supports using 
loop devices (to use gdisk to make the partition table inside the disk 
image).

Since I don't know enough C to add GPT to the current binary tool used 
to make the mbr for the images, I am experimenting with dumping the main 
GPT partition table (first 2-ish MB) from a drive formatted like the 
target image, then assemble the image with dd like is done for sdcard or 
x86 images.

This would require the resulting LEDE image to do some fixup at first 
boot (like recreating the backup GPT partition table at the end of the 
drive) which would be required anyway to adjust GPT to the actual size 
of the target disk.

That's not a major issue as there is Gdisk package already in package 
repo (I would need to import it in LEDE), and space in these devices 
isn't an issue.

What I ask is if something like this is acceptable for LEDE, as I'm 
using a small (around 500 Bytes when xz-compressed) raw GPT table dump 
in this process.

-Alberto



More information about the Lede-dev mailing list