Commit graph

24 commits

Author SHA1 Message Date
Matthijs Kooijman
99f702f0ff Use parted for partitioning (#285)
Previously, fdisk was used by sending commands into its stdin, which is
not very robust (since it heavily relies on the interactive prompts
offered by fdisk as well as the default values it offers, which seem
prone to changing in future version).

It seems likely that in the past, fdisk was easier than parted since it
provides default values that make it easier to create adjacent
partitions, without precalculating all positions in the script. However
now that partitions are manually being aligned, all data must be
calculated anyway.

This commit changes the partition generation to use parted rather than
fdisk. For this, it rewrites various calculations and renames variables
to be easier to read as well. All values are now in number of bytes,
rather than mixing bytes and sectors.

This commit also makes makes sure that the boot partition and root
partition are always adjacent (previously the root partition was aligned
without also rounding the boot partition size, leaving some empty space
in between).

As a side effect of using parted, this also causes the "bootcode" part
of the MBR to be filled with some default x86 bootcode. This is totally
irrelevant for booting the Raspberry Pi, but it does prevent triggering
a bug in parted. When using parted to change the partition table (e.g.
when resizing the root partition on first boot by raspi-config's
init_resize.sh), the disk identifier would be changed due to this bug,
which would change the PARTUUID of all partitions. The init_resize.sh
script would work around this by updating the PARTUUID in e.g. fstab,
but that's fragile at best.  This commit prevents the bug from
triggering and keeps the disk identifier the same.

See https://debbugs.gnu.org/35714 for details about this parted bug.

This commit fixes #284.
2019-09-25 13:46:38 +01:00
Serge Schneider
0308e92705 export-image: Set /boot size to 256MB 2019-06-07 15:54:22 +01:00
Andrew Scheller
30a1528ae1 Switch to using parted's machine parseable output (#270) 2019-03-18 14:49:18 +00:00
Sam Tygier
82bcfa427a Use different rsync options for boot and root
When copying files to boot, options that are not supported on fat32 can cause errors. For example owner, group and xattrs.
2019-02-18 09:45:10 +00:00
Błażej Sowa
d88f536536 IMG_SUFFIX evaluation in export image (fix #241) 2019-01-22 17:33:18 +10:00
Błażej Sowa
08405eb792 Allow custom image filename 2018-12-21 04:11:13 +00:00
Serge Schneider
ff2d5edee1 shellcheck 2018-03-13 12:50:50 +00:00
Serge Schneider
4d689a25fd export-image: don't round up if already a multiple of 4MB
Fixes #156
2018-03-01 18:02:01 +00:00
James Ruan
40eae05204 make root filesystem 4M aligned (#154) 2018-03-01 17:52:26 +00:00
Serge Schneider
aa8731012e Round image size up to nearest 4M block 2017-11-24 10:12:08 +00:00
XECDesign
31fcc80953
Fix typo in export-image
Fixes #132
2017-11-07 05:43:01 +00:00
XECDesign
90adfb1551
Label root partition
Fixes #131
2017-11-06 10:53:05 +00:00
Serge Schneider
c2db8285a1 Disable 64bit filesystem feature 2017-08-11 17:39:58 +01:00
TJ Rana
3441133d1c Corrected various typos (#91)
* Rename License.md to LICENSE

* Correct typos

* Clean up code layout

Organize layout with extra lines
2017-07-27 12:11:07 +02:00
Russ Kubes
4d65b2b357 Export-image: Only disable metadata_csum feature if it's possibly enabled. 2017-07-17 11:36:43 +02:00
Serge Schneider
234c4b7937 Export-image: disable metadata_csum for compatibility with older SD card copiers 2017-07-03 16:40:23 +01:00
Serge Schneider
a0060bd475 export-image: increase free space padding 2017-06-21 10:56:07 +01:00
Serge Schneider
d2b8d634b9 export-image: switch from fallocate to truncate 2017-06-21 10:46:10 +01:00
Serge Schneider
02728fe65e export-image: use apparent size when calculating disk usage 2017-06-20 16:13:59 +01:00
Serge Schneider
6c146a7bb7 Clean up clean up 2017-04-03 16:01:13 +01:00
Serge Schneider
37902fb114 export-image: Format /boot as FAT32 2017-03-06 09:27:48 +00:00
Claus F. Strasburger
667318116a Added Docker support (#40)
* Added Docker support

- replaced necessity for devicemapper (through kpartx) by using parted and
  losetup with offsets
- added Dockerfile
- added dependency for parted and grep
- added hints to README.md
- common: loop through unmounts, fix shellcheck warnings

* stage2: use debconf instead of console-setup patch. Fixes #41
2017-01-23 12:44:03 +00:00
chz^3
017d3a4341 rsync single file system (#25)
If proc is mounted in rootfs (e.g., via chroot), rsync will try copying kcore
when permitted to cross file system boundaries.
2016-10-09 22:09:25 +01:00
Serge Schneider
bdca3e3b48 Rework 2016-05-05 21:21:42 +01:00