Linutronix / elbe

Embedded Linux Build Environment
https://elbe-rfs.org
GNU General Public License v3.0
163 stars 59 forks source link

How to extract first partition only in <gpthd>? #360

Closed coveritytest closed 1 year ago

coveritytest commented 1 year ago

I need to extract the first sectors of sda and the partition sda1 so I can boot the rfs from my hard drive on x86_64. While it works fine with examples/x86_64-pc-hdimg-grub-uefi-buster.xml I do not want to extract sda2 as it is too big. So instead of the example:

<images>
    <!-- use GPT for UEFI -->
    <gpthd>
        <name>sda.img</name>
        <size>2GiB</size>
        <!-- install grub -->
        <grub-install/>
        <!-- the EFI system partition -->
        <partition> 
            <size>200MiB</size>
            <label>uefi</label>
            <bootable>true</bootable>
        </partition>
        <partition>
            <size>remain</size>
            <label>rfs</label>
        </partition>
    </gpthd>
</images>

<project-finetuning>
    <losetup img="sda.img">
        <extract_partition part="1">sda1.img</extract_partition>
        <extract_partition part="2">sda2.img</extract_partition>
        <command part="1">
            ls $ELBE_MNT
        </command>
    </losetup>
    <set_packer packer="none">sda1.img</set_packer>
    <set_packer packer="tarxz">sda2.img</set_packer>
</project-finetuning>

I tried to omit the rfs on sda2:

<images>
    <!-- use GPT for UEFI -->
    <gpthd>
        <name>sda.img</name>
        <size>1GiB</size>
        <!-- install grub -->
        <grub-install/>
        <!-- the EFI system partition -->
        <partition> 
            <size>200MiB</size>
            <label>uefi</label>
            <bootable>true</bootable>
        </partition>
    </gpthd>
</images>

<project-finetuning>
    <losetup img="sda.img">
        <extract_partition part="1">sda1.img</extract_partition>
        <command part="1">
            ls $ELBE_MNT
        </command>
    </losetup>
    <set_packer packer="none">sda1.img</set_packer>
</project-finetuning>

While the first sectors on sda.img look fine, sda1.img is only formatted but EFI/BOOT is not on it. What am I doing wrong here?

bgermann commented 1 year ago

Without using fstab you will not get any data on the partitions.