In this post we will see the procedure to create a bootable SD card using Disk Utilities GUI or simply Disks.
In a SD card booting, first step is to create a bootable SD card. SD card needs to be partitioned based on the requirement and each partition will be formatted with particular file system.
In most of cases, a bootable SD card contains two major partitions
- Primary or Boot partition
- Secondary or Root File system
- Backup (Optional)
Normally, primary partition is formatted to FAT file format ( If boot Rom supported ) and contains fist stage bootloader, second stage bootloader, boot args, Kernel, device tree, etc..
Secondary partition is formatted EXT4, EXT3, EXT2 etc .. and contains a root filesystem , simply rootfs.
SD card enumeration in Linux:
SD card enumeration varies based on the hardware medium used to connect to host computer.
External USB card reader :
If you are using a external card reader, SD card enumerates as a ‘sdX’ device. X shall be ‘a’, ‘b’, ‘c’, ‘d’ and so on. To know the exact device file name, you can use below mentioned command.
- Insert card reader with memory card
- Check the dmesg log now
$ dmesg | tail
You will see similar log message as shown below
[37438.031052] usb 1-1: USB disconnect, device number 3 [37440.172608] usb 1-1: new high-speed USB device number 4 using ehci-pci [37440.461861] usb 1-1: New USB device found, idVendor=1908, idProduct=0226 [37440.461875] usb 1-1: New USB device strings: Mfr=0, Product=0, SerialNumber=0 [37440.468083] usb-storage 1-1:1.0: USB Mass Storage device detected [37440.470519] scsi host35: usb-storage 1-1:1.0 [37441.473634] scsi 35:0:0:0: Direct-Access Generic Mass-Storage 1.11 PQ: 0 ANSI: 2 [37441.474411] sd 35:0:0:0: Attached scsi generic sg2 type 0 [37442.223122] sd 35:0:0:0: [sdb] 31116288 512-byte logical blocks: (15.9 GB/14.8 GiB) [37442.231127] sd 35:0:0:0: [sdb] Write Protect is off [37442.231139] sd 35:0:0:0: [sdb] Mode Sense: 03 00 00 00 [37442.238237] sd 35:0:0:0: [sdb] No Caching mode page found [37442.238425] sd 35:0:0:0: [sdb] Assuming drive cache: write through [37442.280981] sdb: sdb1 [37442.314386] sd 35:0:0:0: [sdb] Attached SCSI removable disk [37443.120217] FAT-fs (sdb1): Volume was not properly unmounted. Some data may be corrupt. Please run fsck.
From the above log [ sdb: sdb1 ], my SD card detected as ‘sdb’ and it has one partition ‘sdb1’.
SD/MMC card slot :
Identifying the SD card device node is kind of easy compared to External card reader device node. The name of the device node is some thing like mmcblkXpY.
Where X is the SD/MMC card device number and Y is the device’s partition number.
After inserting the SD card you can run below commands to identify the device node.
$ dmesg | tail or $ ls /dev/mmc*
Steps to create a Bootable SD card in Ubuntu:
Step 1: Click on “Search your compute .. ” or simply press “Windows” button
Step 2: Type Disks and click on it.
In the GUI, under the “Devices” identify your SD card and click on it.
Step 2: Unmount the SD card by clicking “Unmount the filesystem”
Step 3 : click on “Delete partition” a “minus” symbol
Step 4: You will be presented with a popup. Click on Delete.
This step deletes entire memory card data, so take backup if necessary. Also make sure that you have not selected a wrong computer partition or memory device.
Step 5: You should see a [+] symbol.
Step 6 : Now, click on [+] symbol to create a new partition in the SD card. You will be presented with “Create Partition” popup.
Step 7 : In this step we will be creating primary partition.
Enter Partition Size : 256 MB ( More than enough for a primary partition)
Erase : Don’t overwrite existing data (Other option if you have enough time)
Type : Select FAT ( Maybe, you can check device data sheet for supported filesystem )
Name: BOOT (is reasonable)
Click on “Create”.
Step 8: After step-5, GUI will be shown as below.
BOOT Partition 1 256 MB FAT and Free Space
Step 9 : In this step we will create a root filesystem partition.
Now select “Free Space” and click on [+]. You will get a “create Partition” popup.
Partition Size : 2048 MB (Change based on requirement)
Erase: Don’t overwrite existing data
Type : EXT4 (Depends on Kernel configuration)
Name : RootFS
and click on Create.
Step 10: Select primary partition and click on “more actions ” and select “Edit Partition”
Step 11 : Final step, now select Bootable and Click on “Change”
Now, bootable SD card is ready. Copy the required components to the respective folders and boot.