====== 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 ([[linux:acm_custom_repo|acm repo]]) * acm-admins-sudo ([[linux:acm_custom_repo|acm repo]]) * base-devel * vim * yaourt * New regenerated SSH host keys are generated on first boot. * Authenticating through ACM AD. ====== Creating the image ====== - Generate all changes on the working Raspberry Pi. - 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) - 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.) - On a computer with SD card reader: - Mount the SD card from the raspberry pi. - ''tar -zcf -C . --sparsed'' - (e.g.: ''tar -zcf image3192016.tar.gz -C /run/media/acmguest/6b454c87-8b79-40b4-9361-e63ce0264ef2/ . --sparse'') - Currently, the image for rPi2 sits at about 2.3G uncompressed, 548MB after gzipping. ====== Restoring the image ====== - On a computer with an SD card reader: - Mount the SD card that you will be using for the raspberry pi. - Start fdisk to partition the SD card: ''fdisk /dev/sdX'' - At the fdisk prompt, delete old partitions and create a new one: - Type o. This will clear out any partitions on the drive. - Type p to list partitions. There should be no partitions left. - 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. - Type t, then c to set the first partition to type W95 FAT32 (LBA). - 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. - Write the partition table and exit by typing w. - Create and mount the FAT filesystem: - mkfs.vfat /dev/sdX1 mkdir boot mount /dev/sdX1 boot - Create and mount the ext4 filesystem: - mkfs.ext4 /dev/sdX2 mkdir root mount /dev/sdX2 root - Write the image to the main partition: ''bsdtar -xpf image3192016.tar.gz -C root'' - Commit all pending writes to physical media: ''sync'' - Move boot files to the first partition: ''mv root/boot/* boot'' - Unmount the two partitions: ''umount boot root'' - Insert the SD card into the Raspberry Pi, connect ethernet, and apply 5V power. - You should be good to login!