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
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 24 additions & 7 deletions overlay-with-config.nix
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,7 @@ final: prev: (
allowMissing = false;
};
jetpack-init = prev.writeScript "init" ''
#!${prev.pkgsStatic.busybox}/bin/sh
export PATH=${prev.pkgsStatic.busybox}/bin
#!/bin/sh
mkdir -p /proc /dev /sys
mount -t proc proc -o nosuid,nodev,noexec /proc
mount -t devtmpfs none -o nosuid /dev
Expand All @@ -83,20 +82,38 @@ final: prev: (
# known path so that the final initrd can be constructed from
# outside the context of this nixos config (which has an
# aarch64-linux package-set).
if ${lib.getExe finalJetpack.flashFromDevice} ${finalJetpack.signedFirmware}; then
if flash-from-device /signed-firmware; then
echo "Flashing platform firmware successful. Rebooting now."
sync
reboot -f
else
echo "Flashing platform firmware unsuccessful. Entering console"
exec ${prev.pkgsStatic.busybox}/bin/sh
exec /bin/sh
fi
'';
in
prev.makeInitrd {
final.makeInitrdNG {
contents = [
{ object = jetpack-init; symlink = "/init"; }
{ object = "${modulesClosure}/lib"; symlink = "/lib"; }
{ source = jetpack-init; target = "/init"; }
{ source = "${modulesClosure}/lib"; target = "/lib"; }
{ source = finalJetpack.signedFirmware; target = "/signed-firmware"; }
{
source = "${prev.buildEnv {
name = "initrd-flash-env";
paths = [
final.busybox final.mtdutils finalJetpack.tegra-eeprom-tool
(final.runCommand "flash-from-device" { } ''
mkdir -p $out/bin
echo '#!/bin/sh' >> $out/bin/$name
cat ${./pkgs/ota-utils/ota_helpers.func} >> $out/bin/flash-from-device
cat ${./pkgs/flash-from-device/flash-from-device.sh} >> $out/bin/flash-from-device
chmod +x $out/bin/flash-from-device
'')
];
pathsToLink= [ "/bin" ];
}}/bin";
target = "/bin";
}
];
};

Expand Down
4 changes: 1 addition & 3 deletions overlay.nix
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ in
python-jetson = prev.python3.pkgs.callPackage ./pkgs/python-jetson { };

tegra-eeprom-tool = prev.callPackage ./pkgs/tegra-eeprom-tool { };
tegra-eeprom-tool-static = prev.pkgsStatic.callPackage ./pkgs/tegra-eeprom-tool { };
tegra-eeprom-tool-static = final.lib.warn "alias tegra-eeprom-tool-static is deprecated, use pkgsStatic.nvidia-jetpack.tegra-eeprom-tool" prev.pkgsStatic.callPackage ./pkgs/tegra-eeprom-tool { };

cudaPackages = prev.callPackages ./pkgs/cuda-packages {
inherit (self) debs cudaVersion
Expand Down Expand Up @@ -118,8 +118,6 @@ in
targetSom = "orin-agx";
};

flashFromDevice = self.callPackage ./pkgs/flash-from-device { };

otaUtils = self.callPackage ./pkgs/ota-utils { };

l4tCsv = self.callPackage ./pkgs/containers/l4t-csv.nix { };
Expand Down
33 changes: 0 additions & 33 deletions pkgs/flash-from-device/default.nix

This file was deleted.

2 changes: 0 additions & 2 deletions pkgs/flash-from-device/flash-from-device.sh
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@

set -euo pipefail

source @ota_helpers_func@

signed_images=$1

matching_boardspec=
Expand Down