Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reduce flash initrd sizes #280

Closed
wants to merge 1 commit into from

Conversation

jmbaur
Copy link
Contributor

@jmbaur jmbaur commented Feb 21, 2025

Description of changes

By reusing shared libraries across all dependencies of the initrd used in flashing the platform firmware, we can reduce the size of the initrd ~20MiB.

Testing

Tested initrd flashing on an orin-agx-devkit and xavier-agx-devkit with success.

Sizes compared with the following:

# nix run -L -f <this-file>

let
  jetpack-nixos-master = builtins.getFlake "github:anduril/jetpack-nixos";
  jetpack-nixos-flash-initrd-min = builtins.getFlake "github:jmbaur/jetpack-nixos/flash-initrd-reduce-size";
  nixpkgs = builtins.getFlake "github:nixos/nixpkgs/nixos-unstable";

  nixosSystem =
    jetpack-nixos:
    nixpkgs.lib.nixosSystem {
      modules = [
        jetpack-nixos.nixosModules.default
        {
          nixpkgs.buildPlatform = builtins.currentSystem;
          boot.loader.grub.enable = false;
          hardware.nvidia-jetpack = {
            enable = true;
            som = "orin-agx";
            carrierBoard = "devkit";
          };
        }
      ];
    };
in
(import nixpkgs { system = builtins.currentSystem; }).callPackage (
  { writeShellScriptBin }:
  writeShellScriptBin "compare" ''
    echo master: $(du -h ${(nixosSystem jetpack-nixos-master)._module.args.pkgs.nvidia-jetpack.flashInitrd}/initrd)
    echo here: $(du -h ${(nixosSystem jetpack-nixos-flash-initrd-min)._module.args.pkgs.nvidia-jetpack.flashInitrd}/initrd)
  ''
) { }

By reusing shared libraries across all dependencies of the initrd used
in flashing the platform firmware, we can reduce the size of the initrd
~20MiB.
@danielfullmer
Copy link
Collaborator

danielfullmer commented Feb 22, 2025

Closing in favor of #281. Thanks for noticing though!

@jmbaur jmbaur deleted the flash-initrd-reduce-size branch February 22, 2025 04:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants