Flashing Images to SDCard - cu-ecen-aeld/buildroot-assignments-base GitHub Wiki
For this step you will need an sdcard reader, either a USB version or one on your computer.
Linux Instructions
DD Utility:
If you have a USB card reader or are using a physical linux machine with sdcard slot, you can write your image directly to the card using dd like this:
sudo dd if=buildroot/output/images/sdcard.img of=/dev/sdX conv=fdatasync bs=1M
where /dev/sdX is replaced with the [a-z] value of the device listed in your system log when you insert your sdcard. Be very careful with this command, if you choose the wrong device you could corrupt your root filesystem partition.
- Be sure to use the the /dev/sd[a-z] without the partition reference like /dev/sd[a-z]1. The 1 references the first partition. Boot won't work if you dd to the partition since you need to write the boot sector on the first block of the card.
The
conv=fdatasync
argument ensures the command will wait for all data to be written to the SDCard. You could also use thesync
command from the command prompt after the dd completes.
BMAP Utility:
- Motivation:
To program an SD card with
foo.wic.bz2
format BMAP tool is helpful.foo -> core-image-base-raspberrypi3
BMAP tool takes less arguments and easy to interpret. - Command format: Be sure to select, proper sd[x] (x is the relevant partition) partition before running following command. Usually, sd[a] would be your windows partition when running the command from a virtual box.
sudo bmaptool copy path/to/image.wic.bz2 /dev/sd[b-z]
- Command usage example: In the root of your build repo execute the following command:
sudo bmaptool copy build/tmp/deploy/images/raspberrypi3/core-image-base-raspberrypi3.wic.bz2 /dev/sdb
Windows Instructions
You can use Rufus on Windows to transfer the sdcard.img file to your sdcard.
Troubleshooting
If you see an error from rufus when attempting to write to your sdcard, you may need to remove any partitions on the sdcard using diskpart from the command line.
- Find the device in disk management, start diskpart.exe in an adminstrator command prompt, then use commands:
select disk X
clean
exit
where X is the disk number of the disk as shown in disk management. Here's an example of how disk management should look when a 30 GB flash drive Disk1 has partition information removed:
- Next select the sdcard.img file you build with buildroot and click "Start" to start the partition step
- Click OK at the warning steps about delting the partition after double checking that you've selected the correct device.