Skip to content

Instantly share code, notes, and snippets.

@thefloweringash
Created August 21, 2019 12:14
Show Gist options
  • Save thefloweringash/b96ea17f28882cbe558aa8d6e0df11c4 to your computer and use it in GitHub Desktop.
Save thefloweringash/b96ea17f28882cbe558aa8d6e0df11c4 to your computer and use it in GitHub Desktop.
armv7 on aarch64
Making armv7l in the cloud
Boot dezgeg’s image with qemu on something fancy:
truncate -s 200g sd-image-armv7l-linux.img
qemu-system-aarch64 -m 120g -smp 32 -enable-kvm -M virt -cpu host,aarch64=off -kernel kernel -initrd initrd -drive if=none,file=sd-image-armv7l-linux.img,format=raw,id=hd0,index=0 -device virtio-blk-device,drive=hd0 -netdev user,id=mynet,hostfwd=tcp::5555-:22 -device virtio-net-device,netdev=mynet -nographic -no-reboot -machine gic-version=3 -append 'systemConfig=/nix/store/s8zghld9hj07vh4w2dvgi9v3q8p6h7ka-nixos-system-nixos-19.03.git.ca2ba44cab4 init=/nix/store/s8zghld9hj07vh4w2dvgi9v3q8p6h7ka-nixos-system-nixos-19.03.git.ca2ba44cab4/init loglevel=7 console=ttyS0,115200n8 console=ttymxc0,115200n8 console=ttyAMA0,115200n8 console=ttyO0,115200n8 console=ttySAC2,115200n8 console=tty0'
Use kpartx to bring up the kernel/initrd and read the extlinux options
build a container tarball?
nix-build --arg supportedSystems '["armv7l-linux"]' -I nixpkgs=channel:nixos-unstable '<nixpkgs/nixos/release.nix>' -A containerTarball.armv7l-linux -o container-tarball --max-jobs 8 --cores 0
build a new image?
nix-build nixos -I nixos-config=nixos/modules/installer/cd-dvd/sd-image-armv7l-multiplatform.nix -A config.system.build.sdImage --max-jobs 8 --cores 0 --option binary-caches https://s3-ap-northeast-1.amazonaws.com/nix-armv7.cons.org.nz --option require-sigs false
build versions
19.09pre185259.362be9608c3
27f9a4253dcc8dc315bf8828ff5f0deea509af07
schlep it out of the host, the vm doesn’t have enough memory to do it
NIX_STORE=local?root=/mnt/nix/store nix copy --all --to s3://nix-armv7.cons.org.nz?region=ap-northeast-1
A packet.net x86 NixOS-19.03 says:
system: "x86_64-linux", multi-user?: yes, version: nix-env (Nix) 2.2, nixpkgs: /nix/var/nix/profiles/per-user/root/channels/nixos
oh, and it doesn’t fit:

diff --git a/nixos/lib/make-ext4-fs.nix b/nixos/lib/make-ext4-fs.nix
index 932adcd9796..e88b5b0bbfc 100644
--- a/nixos/lib/make-ext4-fs.nix
+++ b/nixos/lib/make-ext4-fs.nix
@@ -40,6 +40,7 @@ pkgs.stdenv.mkDerivation {
numInodes=$(find $storePaths ./files | wc -l)
numDataBlocks=$(du -s -c -B 4096 --apparent-size $storePaths ./files | tail -1 | awk '{ print int($1 * 1.03) }')
bytes=$((2 * 4096 * $numInodes + 4096 * $numDataBlocks))
+ bytes=2147483647
echo "Creating an EXT4 image of $bytes bytes (numInodes=$numInodes, numDataBlocks=$numDataBlocks)"
truncate -s $bytes $out
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment