Commit Graph

38 Commits

Author SHA1 Message Date
Clayton Craft
6df75d5682 deviceinfo: clean up unused MesaDriver (MR 45)
This deviceinfo var is no longer used in mkinitfs (see previous
commits).
2024-01-26 11:05:17 -08:00
Pablo Correa Gómez
2b467eb77f Do not support loading modules from "deviceinfo_modules_initfs" (MR 38)
This variable will dissappear from the deviceinfo at some point:
https://gitlab.com/postmarketOS/pmaports/-/merge_requests/4169
so after it does, it would not make much sense to keep its use around
2023-11-24 18:01:24 -08:00
Pablo Correa Gómez
2f4937c52d deviceinfo: add tests for ReadDeviceinfo (MR 37) 2023-06-18 10:18:15 -07:00
Pablo Correa Gómez
c87b926a53 Move logic to check if deviceinfo file exists to pkgs/deviceinfo (MR 37)
This is mostly a preparatory commit to later be able to read the
deviceinfo from multiple places. It has a bit better encapsulation,
and makes the functions methods, so that they can update deviceinfo
file in-place.
2023-06-18 10:18:14 -07:00
Clayton Craft
78f8fa32fb deviceinfo: add initfs_extra_compression
For configuring the archive compression parameters for the
initramfs-extra archive.
2023-03-10 22:22:50 -08:00
Clayton Craft
ad560591e1 deviceinfo: parse only required variables
This greatly reduces the chance accidentally adding dependencies to the
other (currently unused) variables later on. Getting away from depending
on deviceinfo has a lot of benefits, but mainly it helps offload
device-specific boot configuration to boot-deploy. Handling those
complexities in a shell script is often nicer.

Also, reducing the need to handle variables that contain lists means
that this app doesn't have to worry about how to merge/handle multiple
versions of those. That might be useful later if mkinitfs has to read
deviceinfo config from multiple deviceinfo files.

For example, trying to figure out how to merge these two things is...
ehhh...
        a_modules_initfs="abc bar banana bazz"
        b_modules_initfs="foo bar bazz bar2 guava"
2023-02-21 00:47:03 -08:00
Clayton Craft
690d008643 internal/{archive,misc}: move from pkgs
These should be internal-only to this project
2023-02-09 13:34:06 -08:00
Clayton Craft
e71cab485d misc: drop StringSet type (MR 22)
no longer used
2022-09-16 09:40:10 -07:00
Clayton Craft
568fe7f717 archive: refactor to use archive "items" instead of StringSet (MR 22)
This adds a couple of new types, an archiveItem and what is effectively
a set of archiveItems. Items in the set are kept sorted.

fixes #10
2022-09-16 09:40:06 -07:00
Clayton Craft
d78c6d5a62 archive: wrap errors from Write() (MR 22) 2022-09-16 09:40:02 -07:00
Clayton Craft
a6165b3a8c pkgs/misc: add RemoveDuplicates function (MR 22) 2022-09-16 09:39:07 -07:00
Clayton Craft
0eacd26615 pkgs/misc: add Merge function (MR 22)
For keys/values from one dict into another
2022-09-16 09:39:00 -07:00
Clayton Craft
e926bb301c archive: add AddItems method (MR 22) 2022-09-16 09:38:54 -07:00
Clayton Craft
961c455d59 archive: rename addFile's "file" param to "source" (MR 22)
"file" is too ambiguous
2022-09-16 09:38:46 -07:00
Clayton Craft
4f601087e1 archive: add archiveItem struct (MR 22)
This will replace the stringset map
2022-09-16 09:38:36 -07:00
Clayton Craft
8b18e444a3 archive: rename AddFile to addFile, and add AddItem method (MR 22)
AddItem can be used for adding either a file or directory. AddFile was
made a private/internal method in this change
2022-09-16 09:38:24 -07:00
Clayton Craft
cdf41938b0 deviceinfo: Don't use deprecated strings.Title (MR 20)
This is a janky way to capitalize the first letter of the word.
strings.Title was kind of overkill anyways I guess, since the reason for
its deprecation wasn't even anything we'd hit in our usage of it (unable
to detect some unicode punctuation for word boundaries... which a
deviceinfo field wouldn't have anyways...)

fixes #12
2022-05-30 23:26:57 -07:00
Dzmitry Sankouski
c07eafd087 main: copy u-boot files to working directory (MR 16)
U-boot files may be used to generate boot images during boot-deploy stage,
for example u-boot's FIT images, android boot images. If there's no u-boot
directory for device, skip copying.

deviceinfo: add UbootBoardname

Alpine u-boot package places board files in separate directories,
/usr/share/u-boot/$boardname. This param specifies device u-boot subdirectory.
2022-01-14 13:04:57 -08:00
Clayton Craft
febc162491 deviceinfo: add tests for new parser (MR 4)
An earlier revision of this patch had test for invalid lines, but I
decided to remove it because deviceinfo is sourced by so many things in
pmOS that it should be /very/ obvious that there are invalid lines or
other garbage in the file.

I also tried to make the parser fairly forgiving if it does encounter
things that don't meet the deviceinfo "spec", so that mkinitfs will try
as hard as it can to make an initfs.
2021-09-09 20:20:41 -07:00
Clayton Craft
d9f29af446 deviceinfo: implement a new simple parser (MR 4)
This replaces an external toml library with a simple parser for
unmarshalling a deviceinfo.
2021-09-09 20:20:41 -07:00
Clayton Craft
7bf5ce967f archive: remove unused checksum function 2021-09-03 22:47:03 -07:00
Clayton Craft
4293c887f8 Deviceinfo: replace toml lib, improve struct member names
See: #6
2021-09-03 22:47:02 -07:00
Clayton Craft
dc586f61fc archive/AddFile: add missing error check
See: #6
2021-09-03 22:42:31 -07:00
Clayton Craft
4538e7d46b Fix copyright text in Go source files
Apparently the space after is important or Go will consider the
copyright comments as package documentation.

See: #6
2021-09-03 22:42:30 -07:00
Clayton Craft
13a3ba36bd archive/checksum: do not try to close fd if open() failed
See #6
2021-09-03 22:42:23 -07:00
Clayton Craft
9c7e647f9e archive: remove testing of gzip archive
It has been determined that this test isn't really necessary. busybox
gzip is probably not going to break (and would be discovered elsewhere
too if it does...)

fixes #4
2021-09-03 16:32:12 -07:00
Clayton Craft
77b2455b91 archive: replace extract test with call to gzip -t
A custom extract test includes reading AND writing the extracted archive
contents to /tmp (which is probably a slow disk), so this uses busybox's
gzip -t ("test file integrity") and seems to take about half the time
(~10s vs ~6s measured loosely on pinephone)
2021-08-17 15:31:40 -07:00
Clayton Craft
217360b400 DeviceInfo: don't kill app when deviceinfo is not found
Sometimes this is fine, e.g. when mkinitfs is run before the device
package is installed in a chroot. So it shouldn't kill the app.
2021-08-16 22:20:14 -07:00
Clayton Craft
66b86cc363 archive:write: simplify verification steps
The free space check, checksumming, and moving to the final location
will be outsourced to "boot-deploy", so the verification done here is
just to extract the archive to make sure it is valid.
2021-08-16 17:54:58 -07:00
Clayton Craft
58a7575848 pkgs/misc: fix linting 2021-08-10 19:13:53 -07:00
Clayton Craft
93333dbb25 pkgs/archive: fix linting 2021-08-10 19:13:32 -07:00
Clayton Craft
a381516e53 rename project to postmarketos-mkinitfs
To help prevent any confusion about which distro this 'mkinitfs' is
intended for
2021-08-10 14:03:34 -07:00
Clayton Craft
f0bf13c9f2 pkg/archive/Write: implement writing of archive with verification
This adds several steps to the "write" action, by writing it to a temp
location, extracting it, checksumming it, copying to destination,
verifying checksum, and using Rename to atomically replace any existing
file in the destination.
2021-08-10 13:23:56 -07:00
Clayton Craft
1716445e9d pkg/archive: drop renameio dependency
renameio basically just does: Sync(), Close(), Rename(). This will be
done here instead of using an external dependency
2021-08-10 13:22:22 -07:00
Clayton Craft
2633f0bde9 pkg/archive: add function to extract archive
This will be used to test archive integrity by extracting it
2021-08-10 13:21:42 -07:00
Clayton Craft
766da6a0dc pkg/archive: add function for checksumming a file
This uses sha256 which, after benchmarking, doesn't seem to be any
faster or slower than sha1. md5 was surprisingly slower (on aarch64),
maybe because there are some CPU accelerated things in sha* ?
2021-08-10 13:19:26 -07:00
Clayton Craft
896d4fa0d0 pkg/misc: add function to return free space for given path 2021-08-10 13:02:44 -07:00
Clayton Craft
64195a5f83 initial commit 2021-08-09 15:23:39 -07:00