Skip to content

Instantly share code, notes, and snippets.

@cleverca22
Last active April 9, 2022 05:37
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 cleverca22/e218d16c5438bb8e6e7f4b48f0546e23 to your computer and use it in GitHub Desktop.
Save cleverca22/e218d16c5438bb8e6e7f4b48f0546e23 to your computer and use it in GitHub Desktop.
[root@amd-nixos:~]# fdisk /dev/sdf
Command (m for help): o
Created a new DOS disklabel with disk identifier 0xc749ab2d.
Command (m for help): n
Partition type
p primary (0 primary, 0 extended, 4 free)
e extended (container for logical partitions)
Select (default p): p
Partition number (1-4, default 1):
First sector (2048-3887103, default 2048):
Last sector, +/-sectors or +/-size{K,M,G,T,P} (2048-3887103, default 3887103): +32m
Created a new partition 1 of type 'Linux' and of size 32 MiB.
Partition #1 contains a vfat signature.
Do you want to remove the signature? [Y]es/[N]o: y
The signature will be removed by a write command.
Command (m for help): n
Partition type
p primary (1 primary, 0 extended, 3 free)
e extended (container for logical partitions)
Select (default p): p
Partition number (2-4, default 2):
First sector (67584-3887103, default 67584):
Last sector, +/-sectors or +/-size{K,M,G,T,P} (67584-3887103, default 3887103):
Created a new partition 2 of type 'Linux' and of size 1.8 GiB.
Command (m for help): t
Partition number (1,2, default 2): 1
Hex code or alias (type L to list all): c
Changed type of partition 'Linux' to 'W95 FAT32 (LBA)'.
Command (m for help): p
Disk /dev/sdf: 1.85 GiB, 1990197248 bytes, 3887104 sectors
Disk model: Storage Device
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0xc749ab2d
Device Boot Start End Sectors Size Id Type
/dev/sdf1 2048 67583 65536 32M c W95 FAT32 (LBA)
/dev/sdf2 67584 3887103 3819520 1.8G 83 Linux
Filesystem/RAID signature on partition 1 will be wiped.
Command (m for help): w
The partition table has been altered.
Calling ioctl() to re-read partition table.
Syncing disks.
[root@amd-nixos:~]# mkfs.vfat /dev/sdf1
mkfs.fat 4.1 (2017-01-24)
[root@amd-nixos:~]# mkfs.ext4 /dev/sdf2
mke2fs 1.46.4 (18-Aug-2021)
Creating filesystem with 477440 4k blocks and 119520 inodes
Filesystem UUID: 64a43c4c-e381-4fe7-867d-853daa8d4539
Superblock backups stored on blocks:
32768, 98304, 163840, 229376, 294912
Allocating group tables: done
Writing inode tables: done
Creating journal (8192 blocks): done
Writing superblocks and filesystem accounting information: done
[root@amd-nixos:~]# mount -v /dev/sdf2 /mnt/
mount: /dev/sdf2 mounted on /mnt.
[root@amd-nixos:~]# mkdir /mnt/boot/firmware -pv
mkdir: created directory '/mnt/boot'
mkdir: created directory '/mnt/boot/firmware'
[root@amd-nixos:~]# mount -v /dev/sdf1 /mnt/boot/firmware/
mount: /dev/sdf1 mounted on /mnt/boot/firmware.
[root@amd-nixos:~]# df -h | head -n1 ; df -h | tail -n2
Filesystem Size Used Avail Use% Mounted on
/dev/sdf2 1.8G 32K 1.7G 1% /mnt
/dev/sdf1 32M 0 32M 0% /mnt/boot/firmware
[root@amd-nixos:~]# debootstrap/bin/debootstrap --arch=armhf bullseye /mnt/
I: Keyring file not available at /usr/share/keyrings/debian-archive-keyring.gpg; switching to https mirror https://deb.debian.org/debian
I: Retrieving InRelease
I: Retrieving Packages
I: Validating Packages
I: Resolving dependencies of required packages...
....
I: Configuring tasksel-data...
I: Configuring tasksel...
I: Configuring libc-bin...
I: Configuring ca-certificates...
I: Base system installed successfully.
[root@amd-nixos:~]# cd /mnt
[root@amd-nixos:/mnt]# wget https://hydra.angeldsis.com/build/113294/download/1/librepi-firmware.deb
[root@amd-nixos:/mnt]# chroot . bin/bash
root@amd-nixos:/# export PATH=/bin:/sbin
root@amd-nixos:/# dpkg -i ./librepi-firmware.deb
Selecting previously unselected package librepi-firmware.
(Reading database ... 9506 files and directories currently installed.)
Preparing to unpack ./librepi-firmware.deb ...
Unpacking librepi-firmware (0.1) ...
Setting up librepi-firmware (0.1) ...
root@amd-nixos:/# exit
[root@amd-nixos:/mnt]# cd
[root@amd-nixos:~]# umount /mnt/boot/firmware/ /mnt
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment