Commit Graph

617 Commits

Author SHA1 Message Date
Michael Olbrich
e29218cccb
Merge pull request #275 from Emantor/topic/gpt-readme
README: document GPT partition flags
2024-11-22 07:29:14 +00:00
Rouven Czerwinski
b025b03ee9 README: document additional partition flags
Document all partition flags.

Signed-off-by: Rouven Czerwinski <rouven@czerwinskis.de>
2024-11-21 12:14:06 +01:00
Rouven Czerwinski
dbb796b8e9 README: document GPT partition flags
Document how partition configuration is translated to GPT Flags for GPT
partition tables.

Signed-off-by: Rouven Czerwinski <rouven@czerwinskis.de>
2024-11-21 11:54:18 +01:00
Michael Olbrich
485cfe5ffe
Merge pull request #272 from michaelolbrich/squashfs-doc
README.rst: clarify and update squashfs compression option documentation
2024-11-08 15:50:09 +00:00
Michael Olbrich
179ee8dffb README.rst: clarify and update squashfs compression option documentation
Fixes: #271

Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de>
2024-11-08 16:38:03 +01:00
Michael Olbrich
f76db3c7b3
Merge pull request #269 from blmaier/guid-u-boot-env
image-hd: gpt: add type GUID shortcut for u-boot-env
2024-11-08 14:42:03 +00:00
Michael Olbrich
d7852398af
Merge pull request #268 from Villemoes/fsync
util.c: add fsync_close() helper, use where appropriate
2024-11-08 14:32:28 +00:00
Brandon Maier
3e0a2aea8d image-hd: gpt: add type GUID shortcut for u-boot-env
U-Boot documents a GPT partition type GUID for U-Boot environment
partitions.

Add a shorthand to make it easier to use.

[1] https://github.com/u-boot/u-boot/blob/v2024.10/doc/README.gpt#L288

Signed-off-by: Brandon Maier <brandon.maier@gmail.com>
2024-11-04 15:37:33 -06:00
Rasmus Villemoes
ec5fb97d94 util.c: add fsync_close() helper, use where appropriate
Using genimage directly on an eMMC on target, I'm seeing that the
BLKRRPART ioctl fails with EBUSY, presumably because there's still
lots of data in flight, and then subsequent parts of my bootstrap
procedure fail because the expected partitions can't be found.

Whenever we've written some data, we really should ensure that all
data has hit the disk before proceeding, and close() itself is not
synchronous.

Add a fsync_close() helper that does exactly what it says on the
tin. Use that wherever we close an fd that has been open for writing
and actually written to (i.e., no point in doing that in the
reload_partitions() function).

Currently, the return value of these close() calls are ignored, so at
least for now continue to do that, but at least we do see an error
message in case something went wrong.

A test case is updated to reflect the new, and more accurate, disk
usage. It turns out that the lack of this fsync'ing has really created
images which later (long after genimage is done and the test framework
has accepted them) would increase in disk usage, i.e. once the kernel
gets around to write out any buffered data. With current master, one
can observe this:

  $ mkdir images input tmp
  $ dd if=/dev/zero of=input/part1.img bs=512 count=7 && dd if=/dev/zero of=input/part2.img bs=512 count=11 && touch input/part3.img
  $ ./genimage --outputpath=images --inputpath=input --rootpath=/no/such/dir --tmppath=tmp --config test/hdimage.config
  $ date ; du -B 1 images/test.hdimage-2
  Fri Nov  1 08:20:39 PM CET 2024
  61440   images/test.hdimage-2
  # Let time pass...
  $ date ; du -B 1 images/test.hdimage-2
  Fri Nov  1 08:21:10 PM CET 2024
  65536   images/test.hdimage-2

Signed-off-by: Rasmus Villemoes <ravi@prevas.dk>
2024-11-01 20:32:47 +01:00
Michael Olbrich
92cc7c509a
Merge pull request #264 from airtower-luna/btrfs-support
Add Btrfs support
2024-09-26 19:23:55 +00:00
Fiona Klute
8abb8709cb btrfs: Install btrfs-progs in CI workflow
Signed-off-by: Fiona Klute <fiona.klute@gmx.de>
2024-09-26 21:08:23 +02:00
Fiona Klute (WIWA)
b4b597f3f8 btrfs: Implement extraargs
Signed-off-by: Fiona Klute (WIWA) <fiona.klute@gmx.de>
2024-08-08 11:58:05 +02:00
Fiona Klute (WIWA)
c9c015894e btrfs: Tidy up test
* Avoid checks for unused dependencies
* Replace deprecated "btrfsck" with "btrfs check"
* Check if label has been set

Signed-off-by: Fiona Klute (WIWA) <fiona.klute@gmx.de>
2024-08-08 11:58:05 +02:00
Fiona Klute (WIWA)
cf8ea7624f btrfs: Fix handling of -r for initial fs content
Signed-off-by: Fiona Klute (WIWA) <fiona.klute@gmx.de>
2024-08-08 11:57:29 +02:00
liberodark
4b6551016b Add BTRFS
Signed-off-by: liberodark <liberodark@gmail.com>
[Fiona: rebased on v18, dropped conflicting change in README.rst]
Signed-off-by: Fiona Klute (WIWA) <fiona.klute@gmx.de>
2024-08-08 11:52:43 +02:00
Michael Olbrich
00009af6e2
Merge pull request #259 from michaelolbrich/release
release version 18
2024-07-04 14:07:20 +00:00
Michael Olbrich
bfcfa45e59 release version 18
Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de>
2024-07-04 16:03:00 +02:00
Michael Olbrich
a270e207d1
Merge pull request #258 from michaelolbrich/rauc-versions
test: handle more rauc versions
2024-07-04 14:02:07 +00:00
Michael Olbrich
768eb1fa56 test: handle more rauc versions
Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de>
2024-07-04 15:12:25 +02:00
Michael Olbrich
68608a36e1
Merge pull request #256 from michaelolbrich/ext-cleanup
tests: ext: use different output files to compare to instead of trying to patch the output
2024-06-28 09:39:43 +00:00
Michael Olbrich
0887e44090 tests: ext: use different output files to compare to instead of trying to patch the output
Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de>
2024-06-28 09:25:34 +02:00
Michael Olbrich
0fc8b3bea4
Merge pull request #257 from michaelolbrich/hdimage
tests: hdimage: add missing dependencies
2024-06-27 09:12:29 +00:00
Michael Olbrich
4130cc95d2
Merge pull request #255 from michaelolbrich/sparse
image-android-sparse: initialize chunk_header
2024-06-27 09:10:05 +00:00
Michael Olbrich
54c317a318 tests: hdimage: add missing dependencies
Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de>
2024-06-27 11:07:10 +02:00
Michael Olbrich
650d9bb963 image-android-sparse: initialize chunk_header
It contains a reserved field that remains uninitialized otherwise and is
written to the output file.

Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de>
2024-06-27 10:49:17 +02:00
Michael Olbrich
187b69c036
Merge pull request #253 from michaelolbrich/hdimage-cleanup
Hdimage cleanup
2024-06-26 14:20:45 +00:00
Michael Olbrich
b7d3e498ae
Merge pull request #251 from ian-abbott/mke2fs-quote-label
image-ext2: use single quotes around label for mke2fs
2024-06-21 15:49:52 +00:00
Michael Olbrich
72c1bc090c image-hd: split out partition image handling and fix the file_size
The last partition may not be the one at the end of the image, so it
could happen, that file_size is overwritten with a smaller value.

It's usually not notiable because the value is only used for the initial
image size. The file can grow larger when it is actually filled.

Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de>
2024-06-21 17:43:39 +02:00
Michael Olbrich
ac183cde5f image-hd: split out partition autoresize
Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de>
2024-06-21 17:43:26 +02:00
Michael Olbrich
ab4fbee156 image-hd: split out uuid / disk signature setup
Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de>
2024-06-21 17:43:26 +02:00
Michael Olbrich
f30437711c image-hd: merge the two partition loops in hdimage_setup()
With the extended partition handling split out, there is no need to loop
twice here.

Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de>
2024-06-21 17:43:26 +02:00
Michael Olbrich
77c0335587 image-hd: factor out extended partition setup
Handle the whole thing separately and more explicitly:

 - check if an extended partition is needed first
 - insert the extended partition and mark all logical partitions

Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de>
2024-06-21 17:43:26 +02:00
Michael Olbrich
6d217c0bf1
Merge pull request #248 from sairon/mbr-forced-primary
image-hd: add forced-primary flag for higher MBR layout flexibility
2024-06-21 15:43:09 +00:00
Jan Čermák
d52b233e00 image-hd: add forced-primary flag for higher MBR layout flexibility
The current limitation of Genimage is that it is not able to create
MBR images that have primary partitions that start after a logical
partition. This can be useful for images that can be later resized based
on the actual device size - for this operation the partition must be at
the end of the device, and if it is present in a logical partition, it
must be resized first, making it a two-step process.

This commit adds the "forced-primary" flag which can be used to indicate
that the partition should be put into the disk's MBR instead of creating
another logical partition. Validation ensures that this syntax allows to
create such partitions only after an existing logical partition, and
that the maximum number of MBR entries woudn't be exceeded by doing so.

Test cases for valid and invalid configuiration has been added. Also
added few more details in the debug print to make it more obvious how
the MBR/EBR layout looks like.

Signed-off-by: Jan Čermák <sairon@sairon.cz>
2024-06-21 17:38:05 +02:00
Michael Olbrich
df4923c8c3
Merge pull request #249 from sairon/hdimage-fix-extended-partition-chs
image-hd: fix CHS addresses in EBR
2024-06-21 15:11:59 +00:00
Jan Čermák
86d9a34028 image-hd: fix CHS addresses in EBR
All CHS addresses in the EBR should point to absolute address in the
image instead of the relative addresses, currently they are only
LBA-to-CHS conversion of the relative offsets. If correct, output of
`sfdisk -d` of the genimage-produced disk image piped back to `sfdisk
file.img` should produce binary identical (see note below) output.
However, it is not true, because the CHS addresses differ. Even though
the extended partition uses the 0xf type (LBA addressing) and CHS
addressing is limited to 1023 sectors, the generated output should be
comparable to other tools for easier debugging.

With this change the calculation of CHS addresses of the next EBRs and
logical partitions within the extended partition adds the proper offset,
so the addresses are absolute within the image.

Note: At least with the version of sfdisk I have tested with (from
util-linux 2.37.2), the image is not completely identical - there are
one byte differences in the MBR and each MBR. This is because even if
the partition type is set as 0xf, sfdisk produces the extended partition
and all the logical partition with 0x5 type.

Signed-off-by: Jan Čermák <sairon@sairon.cz>
2024-06-21 15:07:45 +00:00
Michael Olbrich
b3eac8e65f
Merge pull request #252 from michaelolbrich/check-missing-config
run_genimage_impl: abort for missing config file
2024-06-21 14:36:53 +00:00
Michael Olbrich
b0d050e80c run_genimage_impl: abort for missing config file
Otherwise, a missing config file is not detected for tests that are
expected to fail.

Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de>
2024-06-21 16:27:00 +02:00
Ian Abbott
4301c34451 image-ext2: use single quotes around label for mke2fs
When the volume label is set using tune2fs, the parameter is wrapped in
single quotes, so do the same when the label is set using mke2fs.  This
allows the label to contain spaces and other special characters (except
for single quotes!).

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
2024-06-06 17:05:52 +01:00
Michael Olbrich
0d9f207169
Merge pull request #243 from michaelolbrich/mke2fs
image-ext2: default to mke2fs
2024-04-04 10:29:47 +00:00
Michael Olbrich
6545138b06
Merge pull request #245 from pengutronix/barebox-env
image-hd: gpt: add type GUID shortcut for barebox-env
2024-04-04 08:35:08 +00:00
Ahmad Fatoum
67b2a26488 image-hd: gpt: add type GUID shortcut for barebox-env
barebox has been documenting a dedicated GPT partition type GUID for
barebox environment partitions for a while[1] and has started
making actual use of it at runtime in its v2024.03.0 release[2][3].

Add a shorthand to make it easier to use.

[1]: https://github.com/barebox/barebox/commit/ef25a0ce960d
[2]: https://github.com/barebox/barebox/commit/9f868f78bc54
[3]: https://github.com/barebox/barebox/commit/287bd01a6a26

Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
2024-04-04 09:25:10 +02:00
Ahmad Fatoum
54eb9d445c image-hd: gpt: drop "B" Type GUID shorthand for barebox-state
Follow-up commit will add a barebox-env type GUID, so the plain
B shortcut will become confusing. In future, there might be even a
partition type GUID for the barebox binary itself making this even more
ambiguous. Avoid the confusion by just removing the B shorthand.

Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
2024-04-04 09:24:47 +02:00
Michael Olbrich
fc9286c93f
Merge pull request #246 from pengutronix/readme-fixes
README: fix some outdated info
2024-04-04 06:31:34 +00:00
Ahmad Fatoum
572e01ea7c README: add missing fiptool
We have been supporting fiptool for a while, but failed to document that
it's possible to override the path to it. Remedy that.

Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
2024-04-03 18:31:25 +02:00
Ahmad Fatoum
d6a771b8b7 README: change libconfuse URL
The old URL now redirects to the libconfuse Repo of the libconfuse
Github Organization. Use the new link directly.

Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
2024-04-03 17:30:40 +02:00
Michael Olbrich
6b0e7f764d
Merge pull request #244 from yegorich/ignore-libtool
.gitignore: ignore libtool
2024-03-26 11:43:11 +00:00
Yegor Yefremov
3627ab30a4 .gitignore: ignore libtool
libtool is an auto-generated file. Hence, ignore it.

Signed-off-by: Yegor Yefremov <yegorslists@googlemail.com>
2024-03-26 10:40:55 +01:00
Michael Olbrich
915ced74f9
Merge pull request #241 from ukleinek/rauc-offset
image-rauc: allow to specify an offset to skip input bytes
2024-03-22 19:30:37 +00:00
Uwe Kleine-König
8276468673 image-rauc: allow to specify an offset to skip input bytes
This is useful for barebox images on (at least) i.MX8 to be written to
eMMC. There the first 32K of the image must be skipped.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
2024-03-22 19:26:49 +01:00