Commit Graph

37 Commits

Author SHA1 Message Date
Clayton Craft
6aec4d564c archive: remove pgzip, use gzip from go std lib (MR 25)
This replaces the parallel gzip with the boring gzip from Go's standard
lib. The main motivations for doing this are:

1) Reduce runtime memory requirements

2) shed some external dependencies

There's obviously a trade-off with compression speed/time (as seen
below), but I feel like it's a worthwhile trade-off.

Note that there's likely very little impact to boot performance wrt
extracting these archives, the compression levels are similar.

Measured on a Shift 6mq, which is a very fast phone...

** compress/gzip:

User time (seconds): 1.81
System time (seconds): 0.38
Percent of CPU this job got: 104%
Elapsed (wall clock) time (h:mm:ss or m:ss): 0:02.09
Maximum resident set size (kbytes): 62024

-rw-r--r-- 1 clayton clayton 6.1M Sep 20 17:20 initramfs
-rw-r--r-- 1 clayton clayton 2.5M Sep 20 17:20 initramfs-extra

** pgzip:

User time (seconds): 1.19
System time (seconds): 0.48
Percent of CPU this job got: 159%
Elapsed (wall clock) time (h:mm:ss or m:ss): 0:01.05
Maximum resident set size (kbytes): 109952

-rw-r--r-- 1 clayton clayton 6.8M Sep 20 17:20 initramfs
-rw-r--r-- 1 clayton clayton 2.8M Sep 20 17:20 initramfs-extra

inspired by: https://gitlab.com/postmarketOS/pmaports/-/issues/1704
2023-02-24 09:21:22 -08:00
Clayton Craft
4074eada55 modules: remove TODOs
The builtin one was moved to a new issue:
https://gitlab.com/postmarketOS/postmarketos-mkinitfs/-/issues/18

The "more extensions" one was not moved to a new issue, it should be
obvious if we do need to support more extensions.
2023-02-21 12:41:18 -08:00
Clayton Craft
a7c4fe83ce archive: remove TODO about adding debug mode
moved to an issue: https://gitlab.com/postmarketOS/postmarketos-mkinitfs/-/issues/17
2023-02-21 12:41:18 -08:00
Clayton Craft
06f86aadc9 misc.Exists: bubble up any unexpected errors
Fixes https://gitlab.com/postmarketOS/postmarketos-mkinitfs/-/issues/6
2023-02-21 12:41:18 -08:00
Clayton Craft
d87a33a751 bootdeploy: remove dependency on misc.Exists
Checking for the app is unnecessary, since the cmd.Run later will fail
if it doesn't exist. This allows dropping the dependency on misc.Exists.

There's also no reason to print that the command failed, just return the
error.
2023-02-21 12:41:18 -08:00
Clayton Craft
0179a0ca5c misc: remove functions now in osutils, update references in project 2023-02-21 12:41:17 -08:00
Clayton Craft
33c61b3c94 internal/osutil: new package
This is a collection of things from internal/misc that should have been
separated from misc.
2023-02-21 12:41:17 -08:00
Clayton Craft
9bb326be91 bootdeploy: describe copyUbootFiles 2023-02-21 00:47:05 -08:00
Clayton Craft
0545d68b1d bootdeploy: return errors from writing copy 2023-02-21 00:47:05 -08:00
Clayton Craft
a8bb10ce9c bootdeploy: copy implementation from cmd/mkinitfs 2023-02-21 00:47:04 -08:00
Clayton Craft
5e65ace958 internal/bootdeploy: add new package
As a stub, but will be implemented soon...
2023-02-21 00:47:04 -08:00
Clayton Craft
b0e28b4215 filelist/hookdirs: add new FileLister implementation for creating dirs 2023-02-21 00:47:03 -08:00
Clayton Craft
c1d96f699c filelist/hookscripts: don't fail if directory not found 2023-02-21 00:47:02 -08:00
Clayton Craft
25c3c03e24 filelist/osksdl: fix crash when osk-sdl isn't found
Should have returned an empty FileList in this case
2023-02-21 00:47:02 -08:00
Clayton Craft
07c8c711c7 filelist/hookfiles: don't error out if dir is not found
Just print a message that it wasn't found, instead of sending an error
that may stop the entire app.
2023-02-21 00:47:02 -08:00
Clayton Craft
e772fe0c87 filelist/hookfiles: support specifying src:dest in .files 2023-02-21 00:47:02 -08:00
Clayton Craft
6f05222018 filelist/modules: add support for directories in .modules files
This is kinda janky, passing both a list of modules and a directory path
is just because we support modules in deviceinfo and in directory file
lists... Maybe one day we can move away from having modules in the
deviceinfo...
2023-02-21 00:45:58 -08:00
Clayton Craft
bd09de9232 archive: accept a FileLister in the AddItems method 2023-02-21 00:45:58 -08:00
Clayton Craft
22692e48d2 filelist/initramfs: add new type for slurping up file listers 2023-02-21 00:45:58 -08:00
Clayton Craft
6c2f7b972b filelist/*: implement FileLister in existing types 2023-02-21 00:45:57 -08:00
Clayton Craft
e5002f5750 filelist/FileList: add Import method 2023-02-21 00:45:16 -08:00
Clayton Craft
662f559286 filelist: Add FileList type
This adds a new type, FileList, to manage another new type (File). File
contains the mapping of source --> dest for a file or directory.
2023-02-21 00:45:16 -08:00
Clayton Craft
a4be663e13 filelist/*.List(): print to stdout when starting to generate FileList 2023-02-21 00:45:16 -08:00
Clayton Craft
6fdc8937b5 internal/archive: make archiveItem.add private 2023-02-21 00:45:16 -08:00
Clayton Craft
fb52066d8f filelist/modules: remove postmarketos- from config dir name 2023-02-21 00:45:15 -08:00
Clayton Craft
b7f520cba4 filelist/modules: drop "required modules"
Breaking change. These should be provided in /*/modules/* lists
2023-02-21 00:45:15 -08:00
Clayton Craft
b25c9bd390 filelist/hookfiles: add new implementation 2023-02-21 00:45:13 -08:00
Clayton Craft
af3c47c784 filelist/hookscripts: add new implementation 2023-02-21 00:45:13 -08:00
Clayton Craft
1531d7e790 filelist/modules: add new implementation 2023-02-21 00:45:13 -08:00
Clayton Craft
e00e5faf6e filelist/osksdl: just use fmt.Errorf to create an error 2023-02-21 00:45:12 -08:00
Clayton Craft
5e07b63084 filelist/osksdl: add new implementation 2023-02-21 00:45:12 -08:00
Clayton Craft
95582ee034 misc: add GetFiles and supporting functions 2023-02-18 11:22:26 -08:00
Clayton Craft
e0977b4ac1 misc: add Exists() 2023-02-18 11:22:25 -08:00
Clayton Craft
4176a8a661 misc: add GetKernelVersion()
Allows re-using across different packages
2023-02-18 11:22:25 -08:00
Clayton Craft
73fd85f68c filelist: add FileLister interface 2023-02-18 11:22:25 -08:00
Clayton Craft
7e80107bbe misc: add TimeFunc()
This allows it to be re-used easily when things are broken up into
more packages later.
2023-02-17 14:21:14 -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