User Tools

Site Tools


Raspberry Pi Imaging

Base contents of the image:

  • ArchLinux ARM
  • The following have been installed/configured:
    • nss-pam-ldapd
    • krb5
    • pam-krb5 (aur)
    • acm-pam (acm repo)
    • acm-admins-sudo (acm repo)
    • base-devel
    • vim
    • yaourt
  • New regenerated SSH host keys are generated on first boot.
  • Authenticating through ACM AD.

Creating the image

  1. Generate all changes on the working Raspberry Pi.
  2. If you are making a generic raspberry pi base image, you need to make sure the ssh_host keys are regenerated on any new raspberry pi this image will be used on. (i.e. They should be unique)
    1. On ArchLinux-ARM, you are free to just delete /etc/ssh/ssh_host_*. They will be regenerated by a service on next boot. (You should capture the image, before the next startup.)
  3. On a computer with SD card reader:
    1. Mount the SD card from the raspberry pi.
    2. tar -zcf <image_save.tar.gz> -C <path to mounted sd card> . –sparsed
      1. (e.g.: tar -zcf image3192016.tar.gz -C /run/media/acmguest/6b454c87-8b79-40b4-9361-e63ce0264ef2/ . –sparse)
      2. Currently, the image for rPi2 sits at about 2.3G uncompressed, 548MB after gzipping.

Restoring the image

  1. On a computer with an SD card reader:
    1. Mount the SD card that you will be using for the raspberry pi.
    2. Start fdisk to partition the SD card: fdisk /dev/sdX
    3. At the fdisk prompt, delete old partitions and create a new one:
      1. Type o. This will clear out any partitions on the drive.
      2. Type p to list partitions. There should be no partitions left.
      3. Type n, then p for primary, 1 for the first partition on the drive, press ENTER to accept the default first sector, then type +100M for the last sector.
      4. Type t, then c to set the first partition to type W95 FAT32 (LBA).
      5. Type n, then p for primary, 2 for the second partition on the drive, and then press ENTER twice to accept the default first and last sector.
      6. Write the partition table and exit by typing w.
    4. Create and mount the FAT filesystem:
      1. mkfs.vfat /dev/sdX1
        mkdir boot
        mount /dev/sdX1 boot
    5. Create and mount the ext4 filesystem:
      1. mkfs.ext4 /dev/sdX2
        mkdir root
        mount /dev/sdX2 root
    6. Write the image to the main partition: bsdtar -xpf image3192016.tar.gz -C root
    7. Commit all pending writes to physical media: sync
    8. Move boot files to the first partition: mv root/boot/* boot
    9. Unmount the two partitions: umount boot root
  2. Insert the SD card into the Raspberry Pi, connect ethernet, and apply 5V power.
  3. You should be good to login!
linux/rpi_imaging.txt · Last modified: 2021/05/02 21:36 (external edit)