This is (or should be) pretty simple but I had trouble finding concise instructions for doing it. What I found fell into one of two categories: 1) instructions for backing up an image, or 2) really complex instructions for generating an image from scratch.
At first glance the backup instructions (like these) seemed perfect. You run the equivalent of Linux's dd command and end up with an image file that can be flashed to an SD card on Windows, Linux, or Mac. Perfect, right? Maybe not. Here's a scenario I ran into: I downloaded an image that would fit on a 4GB SD card, I flashed it on an 8GB card because that's what I had lying around, made my modifications, and created a backup image. The problem was the image is an image of an 8GB card, so it will no longer fit on a 4GB SD card even though the amount of actual data on the card should allow it to live on a 4GB card.
So here is a process that gives us the ease of the backup process, but with the power to resize things back to the original image size:
- Download the latest official image for Raspberry Pi or BeagleBone Black.
- Extract the image, flash it, and boot it.
- Make whatever changes you want to the image (install software, change configurations, etc.). Keep all other settings to the defaults, like the hostname, users, and passwords.
- Shutdown the target, extract the SD card, and backup the image using one of the methods here.
- This will backup the entire SD card, and will likely create an image that will be much too large. You can shave off the extra unallocated space (basically restore it back to the same size as the stock image download from Step 1), using the steps in the "Shaving the Image" section of this document.
- Zip up the finished img file.
No comments:
Post a Comment