1
1
mirror of https://github.com/NixOS/mobile-nixos.git synced 2024-12-15 19:23:01 +03:00
Commit Graph

53 Commits

Author SHA1 Message Date
Samuel Dionne-Riel
ddfd04c26e lib/eval-config.nix: Directly use the upstream one
Though with *our* modules.

With https://github.com/NixOS/nixpkgs/pull/82960 this fixes the
regression from https://github.com/NixOS/nixpkgs/pull/82751.
2020-03-19 16:29:44 -04:00
Samuel Dionne-Riel
e9b6c145fa imageBuilder.makeMBR: Fixes bug with gap
The size wasn't fixed after aligning the result, this dividing the sizes
by as the alignment.
2019-11-21 22:26:10 -05:00
Samuel Dionne-Riel
683ce12eb7 Removes custom porcelain...
Let's rely on nix-build mainly.
2019-09-21 22:45:08 -04:00
Samuel Dionne-Riel
a04255b4eb image-builder: FIXME disables ext4 fsck...
I *think* there is a new check that wasn't previously (in 19.03) part of
e2fsck. This is now causing the check to fail.

FIXME : figure out a way to disable the check, or make the image comply.
2019-09-21 13:58:03 -04:00
Samuel Dionne-Riel
9264c6afc7 image-builder: WIP adds makeGPT
TODO : review makeMBR
TODO : share common code into makeFromSfdisk
TODO : add tests
2019-09-21 13:57:12 -04:00
Samuel Dionne-Riel
4e0b281d99 misc. removes unneeded comments 2019-09-21 13:56:51 -04:00
Samuel Dionne-Riel
565d938228 image-builder: Adds a test involving a real bootable image
This creates a disk image that acts *just about* like how the NixOS
sd_image acts. Though it is much less useful as there is no system, not
even an initrd.
2019-09-05 00:39:42 -04:00
Samuel Dionne-Riel
039a166937 image-builder: Adds support for adding gaps.
This is a "tangible" item you add to a `partitions` list. The partition
scheme will know what to do with a gap item.
2019-09-05 00:39:42 -04:00
Samuel Dionne-Riel
ed10664fc9 image-builder: makeFAT32: Let mkfs.fat set the FAT type
It turns out the warnings it spits out when forcing FAT32 with too few
clusters is not for nothing. At the very least the Raspberry Pi 3B does
not like the forced FAT 32. Though, it was validated that a large enough
FAT32 partition is fine with the Raspberry Pi 3B.
2019-09-04 23:07:19 -04:00
Samuel Dionne-Riel
6f52ba48d9 image-builder: Adds in-depth tests for ext4 images 2019-09-04 20:21:14 -04:00
Samuel Dionne-Riel
49d61da7f6 image-build: Fixes test broken by previosu commit
The size of the filesystem has changed because the way it is computed
has changed.
2019-09-04 20:18:21 -04:00
Samuel Dionne-Riel
f777cbdadb image-builder: makeExt4: implements minimal resizing
The algorithms inside `make_ext4fs` can be followed, but it ends up
being a bit complex. I did not figure out all variables, but the amount
of them made me reluctant to implement it as a complte formula.

Instead, I looked at the actual usable space using `df` and mapped it in
a spreadsheet. With the knowledge from actively looking at the source
code, and other data, it is known that the lookup table will work, while
not be ideal.

The fudge factor starting at 256MiB is about stable, but there is a
slight downward deviation at 512MiB, which is why 512MiB was used. The
downward deviation was not observed in other values.

Here's the table as computed.

```
MIB	Fudge
5	0.84609375
8	0.5419921875
16	0.288818359375
32	0.1622314453125
64	0.09893798828125
128	0.067291259765625
256	0.0518646240234375
512	0.05208587646484375
1024	0.048187255859375
2048	0.04060554504394531
4096	0.03718090057373047
```

The difference from .52% to .37% is negligible for 0.5 vs. 4 GiB is
annoying me. The lookup table could be changed to include all known
values instead, I guess.
2019-09-04 20:11:12 -04:00
Samuel Dionne-Riel
f9a719d00f image-builder: makeFAT32: Adjusts sizes
The factor was derived from first making a few test images, finding
there was a common thread, and then looking at what parts of FAT32 were
generated, and how they were generated. That was fun. (Yes, really.)
2019-09-04 00:49:13 -04:00
Samuel Dionne-Riel
b4600a4d23 image-builder: makeFilesystem: prepares API for adjusting sizes 2019-09-04 00:48:58 -04:00
Samuel Dionne-Riel
0f790274da image-builder: makeMBR: work with tiny partitions 2019-09-04 00:47:10 -04:00
Samuel Dionne-Riel
a5cdf69a6a image-builder: Adds alignment tests 2019-09-04 00:47:10 -04:00
Samuel Dionne-Riel
e44bd5ca1a image-builder: makeMBR: Align partitions 2019-09-03 16:52:56 -04:00
Samuel Dionne-Riel
223f6edb1b image-builder: clean-up in makeMBR 2019-09-02 17:48:03 -04:00
Samuel Dionne-Riel
bb095d2f14 image-builder: makeExt4: implements blockSize
The value chosen is the current default from make_ext4fs.

This makes the current tests still valid.
2019-09-02 17:48:03 -04:00
Samuel Dionne-Riel
e008cb416c image-builder: makeFAT32: use block size
In addition, present the sector size as an option.

The sector size is required to set a block size in bytes, so giving the
option to the end-user is probably for the best.

The values here were chosen to keep the builder compatible with the
existing tests.

In addition, the values are quite optimized for smaller filesystem
images, e.g. building a FIRMWARE partition for the Raspberry Pi.
2019-09-02 17:48:03 -04:00
Samuel Dionne-Riel
c0001af576 image-builder: makeFilesystem: reviews minimum size with blockSize
First of all, `du -s` will always combine the sizes into the multiple of
its given --block-size, so 4×1 byte files will show up as 1 block size
(assuming a block size > 4). The expected size would have been at least
one block size per file, so for 512, 512×4 thus 2048.

With this change, we sum the sizes ourselves.

This adds a new requirement to the filesystems, that they pass the block
size to the generic builder, though this is good, as it will increases
reproducibility. In addition, filesystems can present the option to
users, allowing the user to set their block sizes as expected.
2019-09-02 16:29:07 -04:00
Samuel Dionne-Riel
32c93bb9a7 image-builder: Freeze time with faketime
Otherwise, even on simple images, zero-crossing to the next second caused
impurities in the build.
2019-08-31 18:06:12 -04:00
Samuel Dionne-Riel
7991a96bf4 image-builder: makeMBR: make reproducible 2019-08-31 15:49:05 -04:00
Samuel Dionne-Riel
33c2ecdeae image-builder: Refactors the test mode...
Using an override is more likely to pass the smell test than a magic
environment variable.
2019-08-30 22:43:30 -04:00
Samuel Dionne-Riel
554ead277a image-builder: Adds makeExt4 2019-08-29 18:17:13 -04:00
Samuel Dionne-Riel
a37d109515 image-builder: Fixes output hash for default_with_files
I... don't know what happened?
2019-08-29 18:17:13 -04:00
Samuel Dionne-Riel
bccbd0aea1 image-builder: Use the mobile-nixos overlay in tests
Necessary to get the not-upstreamed-yet software in.
2019-08-29 18:17:13 -04:00
Samuel Dionne-Riel
746df92fb6 image-builder: tests: de-hardcodes partition IDs 2019-08-29 18:13:05 -04:00
Samuel Dionne-Riel
ba36d675f7 image-builder: Prefer symlinks to copies...
Makes the store path cleaner AND allows to call `nix log` on the
symlink to get more details.
2019-08-29 18:07:09 -04:00
Samuel Dionne-Riel
763a912d3c image-builder: minimumSize is a filesystem specific option 2019-08-28 21:54:12 -04:00
Samuel Dionne-Riel
346efd3b15 image-builder: Test reproducibility of FAT32 file copy 2019-08-28 21:48:46 -04:00
Samuel Dionne-Riel
9b38d6bbf6 image-builder: makeFAT32: make FAT32 image more reproducible
The current code in <nixpkgs> is reproducible since the date/time comes
from the store. With my particular tests, the date/time is the current
one since I'm using `>` to create test files.
2019-08-28 21:47:40 -04:00
Samuel Dionne-Riel
391f710a46 image-builder: makeFAT32 actually FAT32 2019-08-28 21:46:35 -04:00
Samuel Dionne-Riel
af17598d8f makeFAT32: Implements copyPhase 2019-08-28 21:31:45 -04:00
Samuel Dionne-Riel
da8f7db4ec makeFilesystem: Implements copyPhase internals 2019-08-28 21:31:33 -04:00
Samuel Dionne-Riel
9750eb940d image-builder: Adds test for size/populate being left out 2019-08-28 21:06:36 -04:00
Samuel Dionne-Riel
eb8ca1f685 image-builder: handle size and begin work on populate commands 2019-08-28 20:50:28 -04:00
Samuel Dionne-Riel
183c64b638 image-builder: Fix bug in expected failures 2019-08-28 20:49:12 -04:00
Samuel Dionne-Riel
e9a0060987 image-builder: Adds "default" filesystems test 2019-08-28 15:43:28 -04:00
Samuel Dionne-Riel
75bee46289 image-builder: Test output is markdown friendly
Additionally, tests order is stable.

Though, output is not stable! As store paths can change.
2019-08-28 15:42:32 -04:00
Samuel Dionne-Riel
18df06ee24 image-builder: nils can now be expected 2019-08-28 15:41:24 -04:00
Samuel Dionne-Riel
372b66da1a image-builder: Test harness can test specific files 2019-08-28 15:14:38 -04:00
Samuel Dionne-Riel
a2fccaccdb WIP makePartitions: dumb way to always re-run tests...
Can we make this cleaner? --check might not rebuild deep enough.
2019-08-28 15:02:32 -04:00
Samuel Dionne-Riel
1469d71f88 image-builder: Adds a tests harness 2019-08-28 15:02:29 -04:00
Samuel Dionne-Riel
1dc392d317 WIP: adds image-builder tooling 2019-08-27 15:41:09 -04:00
Samuel Dionne-Riel
0c39da0fff WIP: makeMBR now handles boot flag 2019-08-27 14:25:38 -04:00
Samuel Dionne-Riel
549f0b55eb WIP adds makeFAT32 2019-08-27 14:14:57 -04:00
Samuel Dionne-Riel
24068f0a22 WIP adds makePartition 2019-08-27 14:14:47 -04:00
Samuel Dionne-Riel
9f773535e6 WIP: Adds makeMBR 2019-08-27 14:14:03 -04:00
Samuel Dionne-Riel
cf47617e62 Reviews how overlay works and is used. 2018-06-26 20:49:15 -04:00