5

I got Raspbian on a SD card. It is working. Then I installed a few program, modified some visual settings, and added some config files.

What I would like to do now is release this image to other people and have it really easy to deploy. What are a few of the steps needed to go from working SD card to getting a .img file?

Also, if possible, is there a way to "embed" a UID, like a MAC address, in the image so that the end user does not have to configure it? This might be a more tricky question but if you had a pointer on the first step it would be helpful.

Scoop
  • 2,679
  • 7
  • 27
  • 25

2 Answers2

5

Judging from your question I assume you use one of the installers to get the Raspbian image on your SD card.

You can also use dd for this. dd works in both ways, so that means you can use it to create an image yourself as well.

Try the following on a system with dd to make an image of your SD card:

dd if=/dev/sdX of=/path/to/image.img bs=1M

In the above example, /dev/sdX must point to the SD card. If you don't know what this is, you can find out by using:

sudo fdisk -l

which will show you all connected media and their partitions. More information on fdisk can be found here. Another option is to look at the last bit of dmesg, just after plugging your SD card(reader) in:

dmesg | tail

All the above commands are very common on unix systems. If you don't use one, you can try a linux livecd. There are hundreds if not thousands of those available.

Derecho
  • 367
  • 2
  • 5
  • Any idea how the img can be modified before it is copied? So, what I would like to do is modify a file in the image to contain the MAC address and UID for a given RaspPi. – Scoop Oct 04 '12 at 18:26
2

Creating image

All you need to do is dd, as explained in How do I backup my Raspberry Pi?.

However, this will capture all personal files, configuration etc.

Off-topic

I'd be interested in adding these features to piimg, perhaps raise an issue on GitHub?

Alex Chamberlain
  • 15,530
  • 14
  • 67
  • 113
  • This looks great. It is a little overkill for what I need at the moment. It would be really great if I could add certain parameters to the image using the utility. Like for example a MAC address so that it can be really easy for a person to config the SD card, plug it into their RaspPi, then go. – Scoop Oct 04 '12 at 18:24
  • The MAC address is (should?) be part of the Ethernet chip, and isn't (as far as I'm aware) configurable. Do you mean IP address? – Alex Chamberlain Oct 04 '12 at 18:36
  • I gave the MAC address as a bad example. Ideally, I want to get a unique ID onto the device so that the user doesn't have to enter it. Thanks for the help. – Scoop Oct 04 '12 at 18:41
  • You could use the serial number of the Raspberry Pi? – Alex Chamberlain Oct 04 '12 at 18:44
  • that is a great idea! Like this? – Scoop Oct 04 '12 at 18:49
  • Yeah, how do you need it? Python? Bash? – Alex Chamberlain Oct 04 '12 at 18:51
  • bash, because I want to put this in a startup file. – Scoop Oct 04 '12 at 18:51
  • Actually, I'm thinking about it a little more. I want to link an instance of the software to the main server. I think it is going to be easier to do this all in software. Becuase otherwise, I need to have the person enter in the serial of their device. It is easier if I can give them a preconfiged SD card and have them plug it in. – Scoop Oct 04 '12 at 18:57
  • 1
    @AlexisK See http://raspberrypi.stackexchange.com/q/2086/86 – Alex Chamberlain Oct 04 '12 at 19:02
  • It seems like you know a ton about this so I thought this might be a good place to ask. Is there a way to add a .config file to the root directory of the .iso that other programs can read out of? So the use case would be to have the user put in two value, then have a python script create a custom .iso file with the values in it. What would be a good way to do this? – Scoop Oct 08 '12 at 05:24
  • I assume you mean img files, which are subtly different to iso files (I think). What do you want to configure? Would this script run on Linux? – Alex Chamberlain Oct 08 '12 at 06:16
  • Yes, it would be on linux. I would want on the .img file is a persons name to greet them. My understanding that .iso and .img files were the same. But that was just based on reading. I don't have first ahnd experience with it. – Scoop Oct 08 '12 at 07:12
  • You want to edit /etc/motd.tail. See http://wiki.debian.org/motd and http://raspberrypi.stackexchange.com/q/855/86. – Alex Chamberlain Oct 08 '12 at 10:24