Skip to content

Instantly share code, notes, and snippets.

@grahamc
Created May 15, 2018 00:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save grahamc/8a88f20ebf6fd940c465b0586d5adca7 to your computer and use it in GitHub Desktop.
Save grahamc/8a88f20ebf6fd940c465b0586d5adca7 to your computer and use it in GitHub Desktop.
[nix-shell:~/aarch]# gunzip < /var/www/result/c1-large-arm/initrd > initrd.decomp
[nix-shell:~/aarch]# file initrd.decomp
initrd.decomp: ASCII cpio archive (SVR4 with no CRC)
[nix-shell:~/aarch]# binwalk initrd.decomp | grep squashfs
20184808 0x133FEE8 ASCII cpio archive (SVR4 with no CRC), file name: "nix-store.squashfs", file name length: "0x00000013", file size: "0x00000038"
20185116 0x134001C ASCII cpio archive (SVR4 with no CRC), file name: "nix/store/avli4nwxn5x0fdyyw6ask0qzgr7kpi6r-squashfs.img", file name length: "0x00000038", file size: "0x16ACC000"
[nix-shell:~/aarch]# dd if=./initrd.decomp bs=20184808 skip=1 > second-cpio
18+1 records in
18+1 records out
380421400 bytes (380 MB, 363 MiB) copied, 0.11741 s, 3.2 GB/s
[nix-shell:~/aarch]# file second-cpio
second-cpio: ASCII cpio archive (SVR4 with no CRC)
[nix-shell:~/aarch]# mkdir extract-second
[nix-shell:~/aarch]# cd extract-second/
[nix-shell:~/aarch/extract-second]# dd if=./initrd.decomp bs=20184808 skip=1 > second-cpio^C
[nix-shell:~/aarch/extract-second]# cpio -id < ../second-cpio
743010 blocks
[nix-shell:~/aarch/extract-second]# ls
nix nix-store.squashfs proc sys
[nix-shell:~/aarch/extract-second]# ls -la nix-store.squashfs
lrwxrwxrwx 1 root root 56 May 15 00:15 nix-store.squashfs -> /nix/store/avli4nwxn5x0fdyyw6ask0qzgr7kpi6r-squashfs.img
[nix-shell:~/aarch/extract-second]# file ./nix/store/avli4nwxn5x0fdyyw6ask0qzgr7kpi6r-squashfs.img
./nix/store/avli4nwxn5x0fdyyw6ask0qzgr7kpi6r-squashfs.img: Squashfs filesystem, little endian, version 4.0, 380419179 bytes, 81956 inodes, blocksize: 1048576 bytes, created: Mon May 14 13:05:26 2018
[nix-shell:~/aarch/extract-second]# mkdir extract-squash
[nix-shell:~/aarch/extract-second]# cd extract-squash/
[nix-shell:~/aarch/extract-second/extract-squash]# unsquashfs ../nix/store/avli4nwxn5x0fdyyw6ask0qzgr7kpi6r-squashfs.img
Parallel unsquashfs: Using 8 processors
65595 inodes (66101 blocks) to write
[==========================================================================================-] 66101/66101 100%
created 52496 files
created 16363 directories
created 13097 symlinks
created 0 devices
created 0 fifos
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment