| 30 Jul 2022 |
@linus:schreibt.jetzt | Especially deployments where size matters (small cloud servers and embedded stuff). | 11:44:15 |
@elvishjerricco:matrix.org | Ok so to summarize | 11:45:09 |
@elvishjerricco:matrix.org |
- We probably want to disable shutdown ramfs in things like containers
- We probably don't want to strip at all for shutdown ramfs
- We should probably use
targetPrefix to get the right strip from binutils for building initrd
| 11:45:48 |
@elvishjerricco:matrix.org | There's also the option of just removing stripping | 11:46:22 |
@elvishjerricco:matrix.org | Because IIRC it barely saved any space in initrd | 11:46:29 |
K900 | How much space is it really? | 11:46:35 |
@elvishjerricco:matrix.org | I don't remember what it was... Probably need to test it | 11:46:49 |
K900 | Can someone test? I'm reimaging an old laptop right now but I can get back to it in a few hours probably | 11:46:56 |
@elvishjerricco:matrix.org | or maybe there'sa comment in the pr | 11:47:00 |
@elvishjerricco:matrix.org | https://github.com/NixOS/nixpkgs/pull/171134#issuecomment-1114232324 | 11:48:28 |
K900 | So not a lot | 11:48:43 |
@elvishjerricco:matrix.org | 1M, and that's without compressing initrd | 11:48:55 |
@elvishjerricco:matrix.org | I want to test it with compression just in case | 11:49:12 |
@elvishjerricco:matrix.org | 1M for the minimal compressed initrd is more on the significant side | 11:49:25 |
@linus:schreibt.jetzt | idk, I think 4% is fairly small but not negligible | 11:49:36 |
@janne.hess:helsinki-systems.de | In reply to @elvishjerricco:matrix.org I want to test it with compression just in case I did it this way because symbols should have a better compression ratio imo and that would affect test results | 11:50:08 |
@linus:schreibt.jetzt | IMHO we should continue stripping in the drv but drop it for shutdown | 11:50:10 |
@linus:schreibt.jetzt | In reply to @janne.hess:helsinki-systems.de I did it this way because symbols should have a better compression ratio imo and that would affect test results so the effect of stripping is even smaller normally ;) | 11:50:37 |
@elvishjerricco:matrix.org | In reply to @linus:schreibt.jetzt IMHO we should continue stripping in the drv but drop it for shutdown That still requires builders to have binutils, which isn't necessarily the case without stripping :/ Maybe make it a config option? | 11:50:41 |
@elvishjerricco:matrix.org | dammit, more inexplicable weirdness. I'm trying to build a minimal config with systemd initrd, but changing the code in make-initrd-ng is not causing a rebuild. wtf | 11:55:33 |
@elvishjerricco:matrix.org | oh derp, i was pointing at my system nixpkgs | 11:56:07 |
@elvishjerricco:matrix.org | Ok, so with compression, stripping makes the file's apparent size 675K smaller | 11:59:00 |
@elvishjerricco:matrix.org | From ~12M to ~11M | 11:59:23 |
@linus:schreibt.jetzt | In reply to @elvishjerricco:matrix.org That still requires builders to have binutils, which isn't necessarily the case without stripping :/ Maybe make it a config option? config option works for me, I'd say default to enabling stripping because I suspect people are more likely to have binutils anyway (it gets pulled in by nix-shell -p too, for example) | 12:01:16 |
@linus:schreibt.jetzt | oh yeah, and uncompressed size is still relevant for RAM usage | 12:01:55 |
@elvishjerricco:matrix.org | Yea, and we probably just should not even offer the configuration option for shutdownramfs, since I can't imagine it mattering for that purpose | 12:01:56 |
@linus:schreibt.jetzt | wooooo finally finished building all that crap | 12:11:22 |
@linus:schreibt.jetzt | In reply to @linus:schreibt.jetzt
oh that's a lot more extensive than what I'm currently building:
diff --git a/pkgs/build-support/kernel/make-initrd-ng/src/main.rs b/pkgs/build-support/kernel/make-initrd-ng/src/main.rs
index 294c570a374..681fc5468fd 100644
--- a/pkgs/build-support/kernel/make-initrd-ng/src/main.rs
+++ b/pkgs/build-support/kernel/make-initrd-ng/src/main.rs
@@ -57,12 +57,11 @@ fn copy_file<P: AsRef<Path> + AsRef<OsStr>, S: AsRef<Path> + AsRef<OsStr>>(
) -> Result<(), Error> {
fs::copy(&source, &target)?;
- if !Command::new("ldd").arg(&source).output()?.status.success() {
- // Not dynamically linked - no need to recurse
- return Ok(());
- }
-
- let rpath_string = patch_elf("--print-rpath", &source)?;
+ let rpath_string = match patch_elf("--print-rpath", &source) {
+ // Not dynamically linked probably
+ Err(_) => { return Ok(()); },
+ Ok(s) => s,
+ };
let needed_string = patch_elf("--print-needed", &source)?;
// Shared libraries don't have an interpreter
if let Ok(interpreter_string) = patch_elf("--print-interpreter", &source) {
so this little patch is enough to make it boot | 12:11:43 |
@linus:schreibt.jetzt | but I'll give your goblin thing a try now K900, because it's definitely more elegant | 12:11:59 |
K900 | Strip might still be broken | 12:29:54 |