RPi-Distro / pi-gen

Tool used to create the official Raspberry Pi OS images
BSD 3-Clause "New" or "Revised" License
2.57k stars 1.61k forks source link

Can't add new partitions #691

Closed H4kim closed 7 months ago

H4kim commented 1 year ago

I want to add new partitions instead of resizing the root partition to take all the available space on the disk, I tried to play with these two files: file1, file2, but i got no success, i know this is just me not knowing how to do it, and that's why i'm asking for help after 1 week of work.

Thanks a lot for helping me find where do i can make changes to add partitions.

XECDesign commented 1 year ago

Instead of the linked file2, try this one.

o-alquimista commented 7 months ago

Instead of the linked file2, try this one.

I'm trying to figure out how to do this, and my guess is that I need to somehow patch the "firstboot" script - more specifically the do_resize() function, and perform the partitioning there. But how do you patch something that comes from a deb package? I've never done that before.

My first idea was to create another shell script, just like "firstboot", and add init=/path/to/script to cmdline.txt. The problem is that would create a conflict - two scripts wanting the "first boot".

Any ideas? My goal is to separate /var and /home, and encrypt them with cryptsetup. I already do this manually, but it's a lot of work.

XECDesign commented 7 months ago

You can patch the file like you would any other. Although apt will overwrite it when the package is updated, that won't happen before first boot.

Or if you add your own and make it the init script instead, as long as it does the job of the original init script as well, it should be fine.