Difference between revisions of "Prepare a bootable MicroSD Card"
From IGEP - ISEE Wiki
Line 59: | Line 59: | ||
<span class="mw-headline">The following steps details how to prepare a booteable MicroSD Card</span> | <span class="mw-headline">The following steps details how to prepare a booteable MicroSD Card</span> | ||
− | == | + | ==<span class="mw-headline">Prepare a SD to boot</span>== |
<div style="text-align: left;">{{Message/Information Message|message=The following steps has been tested using an Ubuntu 16.04}}</div> | <div style="text-align: left;">{{Message/Information Message|message=The following steps has been tested using an Ubuntu 16.04}}</div> | ||
<div style="text-align: left;">First of all it is important to detect which device is our microSD Card. In order to do that we can follow this instructions in a Linux terminal:</div> | <div style="text-align: left;">First of all it is important to detect which device is our microSD Card. In order to do that we can follow this instructions in a Linux terminal:</div> | ||
Line 81: | Line 81: | ||
==='''<span class="mw-headline">General case process:</span>'''=== | ==='''<span class="mw-headline">General case process:</span>'''=== | ||
===='''<span class="mw-headline">Finding your device</span>'''==== | ===='''<span class="mw-headline">Finding your device</span>'''==== | ||
− | <span class="mw-headline">[[File:1.png| | + | <span class="mw-headline">[[File:1.png|733x318px]]</span> |
Line 89: | Line 89: | ||
− | <span class="mw-headline">[[File:2.png| | + | <span class="mw-headline">[[File:2.png|733x345px]]</span> |
+ | |||
+ | |||
===='''<span class="mw-headline">Erasing all data</span>'''==== | ===='''<span class="mw-headline">Erasing all data</span>'''==== | ||
Line 96: | Line 98: | ||
After that you can '''Apply'''. | After that you can '''Apply'''. | ||
− | <span class="mw-headline">[[File:SD4.png]]</span> | + | |
+ | <span class="mw-headline">[[File:SD4.png|717x494px]]</span> | ||
+ | |||
+ | |||
===='''<span class="mw-headline">Creating the boot partition</span>'''==== | ===='''<span class="mw-headline">Creating the boot partition</span>'''==== | ||
Line 102: | Line 107: | ||
We will configure the partition as: | We will configure the partition as: | ||
− | |||
− | |||
* Primary Partition | * Primary Partition | ||
Line 112: | Line 115: | ||
− | [[File:SD5.png| | + | [[File:SD5.png|721x324px]] |
* It is recommended to '''apply changes''' now or you might get an error later. | * It is recommended to '''apply changes''' now or you might get an error later. | ||
Line 120: | Line 123: | ||
<span class="mw-headline">The Next step it's create the root file system partition.<br />First you should select the unallocated partition area and then you should go to the partition menu and select the "New" option then the application show a window like this:</span> | <span class="mw-headline">The Next step it's create the root file system partition.<br />First you should select the unallocated partition area and then you should go to the partition menu and select the "New" option then the application show a window like this:</span> | ||
− | [[File:SD6.png| | + | |
+ | [[File:SD6.png|710x334px]] | ||
+ | |||
+ | |||
===='''<span class="mw-headline"><span id="result_box" class="short_text" tabindex="-1" lang="en"><span class="">Characterizing</span></span> the Rootfs</span>'''==== | ===='''<span class="mw-headline"><span id="result_box" class="short_text" tabindex="-1" lang="en"><span class="">Characterizing</span></span> the Rootfs</span>'''==== | ||
Line 131: | Line 137: | ||
* Other spaces such as the defaults ones | * Other spaces such as the defaults ones | ||
+ | At end we will click on "Add" button. | ||
+ | |||
+ | |||
+ | [[File:SD7.png|715x319px]] | ||
− | |||
− | |||
===='''<span class="mw-headline">Applying changes</span>'''==== | ===='''<span class="mw-headline">Applying changes</span>'''==== | ||
<span class="mw-headline">Click on apply button in the main menu after that gparted show a window like this for confirm all operations </span> | <span class="mw-headline">Click on apply button in the main menu after that gparted show a window like this for confirm all operations </span> | ||
− | [[File:SD8.png| | + | [[File:SD8.png|715x321px]] |
+ | |||
+ | |||
* <span class="mw-headline">We should click on apply button to confirm<br /></span> | * <span class="mw-headline">We should click on apply button to confirm<br /></span> | ||
− | [[File:SD9.png| | + | |
+ | [[File:SD9.png|722x323px]] | ||
+ | |||
+ | |||
===='''Loading'''==== | ===='''Loading'''==== | ||
When the process finish we can see all changes applied | When the process finish we can see all changes applied | ||
− | [[File:SD10.png| | + | |
+ | [[File:SD10.png|724x326px]] | ||
+ | |||
+ | |||
===='''<span class="mw-headline">Selecting boot flag</span>'''==== | ===='''<span class="mw-headline">Selecting boot flag</span>'''==== | ||
<span class="mw-headline">Now we must select the boot flag for the first partition for it we use the right mouse button over the boot partition and select "Manage Flags" option</span>'''<span class="mw-headline"><br /></span>''' | <span class="mw-headline">Now we must select the boot flag for the first partition for it we use the right mouse button over the boot partition and select "Manage Flags" option</span>'''<span class="mw-headline"><br /></span>''' | ||
− | [[File:SD12.png| | + | |
+ | [[File:SD12.png|719x337px]] | ||
Line 164: | Line 181: | ||
==='''<span class="mw-headline">NXP case process:</span>'''=== | ==='''<span class="mw-headline">NXP case process:</span>'''=== | ||
− | |||
===='''<span class="mw-headline">Finding your device</span>'''==== | ===='''<span class="mw-headline">Finding your device</span>'''==== | ||
− | <span class="mw-headline">[[File:1.png| | + | <span class="mw-headline">[[File:1.png|721x313px]]</span> |
Line 174: | Line 190: | ||
− | <span class="mw-headline">[[File:2.png| | + | <span class="mw-headline">[[File:2.png|731x344px]]</span> |
+ | |||
+ | |||
===='''<span class="mw-headline">Erasing all data</span>'''==== | ===='''<span class="mw-headline">Erasing all data</span>'''==== | ||
Line 181: | Line 199: | ||
After that you can '''Apply'''. | After that you can '''Apply'''. | ||
− | <span class="mw-headline">[[File:SD4.png]]</span> | + | |
+ | <span class="mw-headline">[[File:SD4.png|724x499px]]</span> | ||
+ | |||
+ | |||
===='''<span class="mw-headline">Creating the boot partition</span>'''==== | ===='''<span class="mw-headline">Creating the boot partition</span>'''==== | ||
Line 199: | Line 220: | ||
It is recommended to apply changes now or you might get an error later. | It is recommended to apply changes now or you might get an error later. | ||
− | '''<span class="mw-headline">[[File:SD_IMX_1.png| | + | |
+ | '''<span class="mw-headline">[[File:SD_IMX_1.png|728x338px]]</span>''' | ||
+ | |||
− | |||
===='''<span class="mw-headline">Creating the new partition</span>'''==== | ===='''<span class="mw-headline">Creating the new partition</span>'''==== | ||
+ | <span class="mw-headline">The Next step it's create the root file system partition.<br />First you should select the unallocated partition area and then you should go to the partition menu and select the "New" option then the application show a window like this:</span> | ||
− | + | [[File:SD_IMX_2.png|708x333px]] | |
− | |||
− | |||
− | |||
− | |||
===='''<span class="mw-headline"><span id="result_box" class="short_text" tabindex="-1" lang="en"><span class="">Characterizing</span></span> the Rootfs</span>'''==== | ===='''<span class="mw-headline"><span id="result_box" class="short_text" tabindex="-1" lang="en"><span class="">Characterizing</span></span> the Rootfs</span>'''==== | ||
Line 218: | Line 237: | ||
* Primary Partition | * Primary Partition | ||
− | * Format: EXT4 | + | * File system/Format: EXT4 |
* Size: All the Rest | * Size: All the Rest | ||
* Label: Rootfs'''<br />''' | * Label: Rootfs'''<br />''' | ||
* Other spaces such as the defaults ones | * Other spaces such as the defaults ones | ||
− | |||
At end we will click on "Add" button. | At end we will click on "Add" button. | ||
− | |||
− | + | [[File:SD_IMX_3.png|706x333px]] | |
− | |||
− | |||
− | + | ===='''<span class="mw-headline">Applying changes</span>'''==== | |
+ | <span class="mw-headline">Click on apply button in the main menu after that gparted show a window like this for confirm all operations </span> | ||
− | |||
− | + | [[File:SD_IMX_4.png|712x333px]] | |
− | |||
− | |||
− | + | * <span class="mw-headline">We should click on apply button to confirm</span> | |
− | |||
− | [[File: | + | <span class="mw-headline">[[File:SD_IMX_5.png|718x338px]]</span> |
− | === | + | ===='''Loading'''==== |
− | + | When the process finish we can see all changes applied | |
− | |||
− | |||
− | + | [[File:SD_IMX_7.png|728x342px]] | |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | + | ===='''<span class="mw-headline">Selecting boot flag</span>'''==== | |
+ | <span class="mw-headline">Now we must select the boot flag for the first partition for it we use the right mouse button over the boot partition and select "Manage Flags" option</span> | ||
− | |||
− | + | [[File:SD_IMX_8.png|727x340px]] | |
− | |||
+ | ==='''SFDISK'''=== | ||
− | + | ===='''IMX6'''==== | |
− | < | + | sudo sfdisk /dev/<your_device> <<EOF<br/>label: dos<br/>16065,128520,0x0C,*<br/>144585,,,-<br/>EOF<br><br><strong>Example</strong><br/><br/>sudo sfdisk /dev/sdc <<EOF<br/>label: dos<br/>16065,128520,0x0C,*<br/>144585,,,-<br/>EOF |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | + | '''Explanation''' | |
− | + | sudo mkfs.vfat -F32 /dev/<your_device> -n boot<br data-attributes="%20/"><br data-attributes="%20/"><strong>Example</strong><br data-attributes="%20/"><br data-attributes="%20/">sudo mkfs.vfat -F32 /dev/sdc1 -n boot | |
− | |||
− | |||
− | |||
− | sudo | ||
− | |||
+ | [[File:SFDISK_IMX2.png]] | ||
− | |||
− | |||
− | + | '''Explanation''' | |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | < | + | sudo mkfs.ext4 /dev/<your_device> -L rootfs<br data-attributes="%20/"><br data-attributes="%20/"><strong>Example</strong><br data-attributes="%20/"><br data-attributes="%20/">sudo mkfs.ext4 /dev/sdc2 -L rootfs |
+ | [[File:SFDISK_IMX3.png]] | ||
− | + | ==== ==== | |
− | + | '''Here the result''' | |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | + | [[File:SFDISK_NORMAL4.png]] | |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | + | ===='''NORMAL'''==== | |
− | + | '''Explanation''' | |
− | |||
− | ===''' | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | < | + | sudo sfdisk /dev/<your_device> <<EOF<br/>label: dos<br/>63,144522,0x0C,*<br/>160650,,,-<br/>EOF<br/><br data-attributes="%20/"><strong>Example</strong><br/><br data-attributes="%20/">sudo sfdisk /dev/sdc <<EOF<br/>label: dos<br/>63,144522,0x0C,*<br/>160650,,,-<br/>EOF |
− | </ | ||
− | </ | ||
− | </ | ||
− | </ | ||
− | |||
− | + | [[File:SFDISK_NORMAL1.png]] | |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | + | '''Explanation''' | |
− | < | + | sudo mkfs.vfat -F32 /dev/<your_device> -n boot<br data-attributes="%20/"><br data-attributes="%20/"><strong>Example</strong> <br/><br data-attributes="%20/">sudo mkfs.vfat -F32 /dev/sdc1 -n boot |
− | </ | + | [[File:SFDISK_IMX2.png]] |
− | </ | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | + | '''Explanation''' | |
− | |||
− | |||
− | |||
− | |||
− | < | + | sudo mkfs.ext4 /dev/<your_device> -L rootfs<br><br><strong>Example</strong><br><br data-attributes="%20/">sudo mkfs.ext4 /dev/sdc2 -L rootfs |
+ | '''<br />[[File:SFDISK_NORMAL3.png]]<br />''' | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | + | '''The result''' | |
+ | '''[[File:SFDISK_NORMAL5.png|638x70px]]''' | ||
− | + | '''<br /><br /><span style="color: #ff0000;">sudo dd if=./u-boot.imx of=/dev/sdc bs=512 seek=2; sync ?????</span><br />''' | |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | </ | ||
− | |||
− | |||
− | |||
− | |||
− | |||
Revision as of 13:12, 11 May 2018
Contents
Introduction
This page explain how to create a microSD card to boot IGEP boards with software distributions ( yocto, Ubuntu, Debian ...).
- Now we can see an image of which are the steps to boot any module.
With a general processor all start with MLO file and U-Boot.img. Also it is the same procedure for Freescale- NXP. If you want to see how to create these files follow this link.
Next step is that once the processor is initialized,call the linux kernel making the execution of your operative system available.
Finally your OS runs and you can initialize the board correctly
General Processors
Inside General processors we can find Texas Instruments
- The microsd card must be content at latest 2 partitions.
- The first one must be primary partition with the boot flag mark and formated using FAT(16 or 32) file system.
- All names used in this partition must be msdos names (applies to OLD OMAP35xx processor).
- The processor must load a first program called MLO, this program must reside in the first partition, this program it's also called x-loader or uboot-spl.
The processor when boot ONLY load and execute the MLO program and ignore all the rest it's the X-loader(MLO) the program responsible to load the next programs such kernel or uboot if you use this last one approach.
Freescale has a different structure |
Freescale-NXP Processors
- The microsd card must be content at latest 1 partitions.
- The primary partition can be formatted with any filesystem that u-boot can mount.
- The Processor will load the u-boot.imx it include the SPL and u-boot.
After load this u-boot.imx, u-boot will be ready for boot the kernel.
Therefore, we are going to setup a microSD card with these requirements and install a custom software distribution into it.
Prerequisites
- PC with Linux (We use for this how to Ubuntu 16.04 LTS)
- MicroSD Card (4 Gbytes - class 4) or bigger ...
- Tools such, fdisk, mkfs.ext3, mkfs.vfat, gparted ...
- Cross Toolchain included in Ubuntu 16.04 LTS gcc version 4.9.3 (Ubuntu/Linaro 4.9.3-13ubuntu2).
ToolChain
In order to start developing with an IGEP PROCESSOR BOARD we can use a microSD Card to flash our system and boot from it. Most of the cases is the easiest way to boot a board.
The following steps details how to prepare a booteable MicroSD Card
Prepare a SD to boot
How to partition the MicroSD card
sudo apt-get install gparted
Other tools as sfdisk and mkfs are useful too.
It is important to difference between a MicroSD Card for a NXP processor and the other cases. The process of partition is similar but, in the case of NXP chips, there exists some differences.
General case process:
Finding your device
Create the MSDOS Partition Table
The next step it's create the msdos table partition for it you should click in the "Device" menu and then in the "Create Partition Table" option.
Erasing all data
Check the default option it's create a msdos partition table.
After that you can Apply.
Creating the boot partition
The Next step it's create the partitions for it you should go to the partition menu and select the "New" option then the application show a window like this:
We will configure the partition as:
- Primary Partition
- File system/ Format: FAT32
- Size: 100 MegaBytes
- Label: Boot
- Align to: cylinder
- It is recommended to apply changes now or you might get an error later.
Creating the new partition
The Next step it's create the root file system partition.
First you should select the unallocated partition area and then you should go to the partition menu and select the "New" option then the application show a window like this:
Characterizing the Rootfs
We will configure the rootfs partition as:
- Primary Partition
- Format: EXT4
- Size: All the Rest
- Label: Rootfs
- Other spaces such as the defaults ones
At end we will click on "Add" button.
Applying changes
Click on apply button in the main menu after that gparted show a window like this for confirm all operations
- We should click on apply button to confirm
Loading
When the process finish we can see all changes applied
Selecting boot flag
Now we must select the boot flag for the first partition for it we use the right mouse button over the boot partition and select "Manage Flags" option
Now we have the microsd prepared for copy the boot files
NXP case process:
Finding your device
Create the MSDOS Partition Table
The next step it's create the msdos table partition for it you should click in the "Device" menu and then in the "Create Partition Table" option.
Erasing all data
Check the default option it's create a msdos partition table.
After that you can Apply.
Creating the boot partition
This Step it's only for iMX6 processor based IGEP boards.
The Next step it's create the partitions for it you should go to the partition menu and select the "New" option.
We will configure the partition as:
- Primary Partition
- Format: FAT32
- Free Space Preceding: 8 MiB
- Size: 100 MegaBytes
- Label: Boot
- Align to: cylinder
It is recommended to apply changes now or you might get an error later.
Creating the new partition
The Next step it's create the root file system partition.
First you should select the unallocated partition area and then you should go to the partition menu and select the "New" option then the application show a window like this:
Characterizing the Rootfs
We will configure the rootfs partition as:
- Primary Partition
- File system/Format: EXT4
- Size: All the Rest
- Label: Rootfs
- Other spaces such as the defaults ones
At end we will click on "Add" button.
Applying changes
Click on apply button in the main menu after that gparted show a window like this for confirm all operations
- We should click on apply button to confirm
Loading
When the process finish we can see all changes applied
Selecting boot flag
Now we must select the boot flag for the first partition for it we use the right mouse button over the boot partition and select "Manage Flags" option
SFDISK
IMX6
sudo sfdisk /dev/<your_device> <<EOF
label: dos
16065,128520,0x0C,*
144585,,,-
EOF
Example
sudo sfdisk /dev/sdc <<EOF
label: dos
16065,128520,0x0C,*
144585,,,-
EOF
Explanation
sudo mkfs.vfat -F32 /dev/<your_device> -n boot
Example
sudo mkfs.vfat -F32 /dev/sdc1 -n boot
Explanation
sudo mkfs.ext4 /dev/<your_device> -L rootfs
Example
sudo mkfs.ext4 /dev/sdc2 -L rootfs
Here the result
NORMAL
Explanation
sudo sfdisk /dev/<your_device> <<EOF
label: dos
63,144522,0x0C,*
160650,,,-
EOF
Example
sudo sfdisk /dev/sdc <<EOF
label: dos
63,144522,0x0C,*
160650,,,-
EOF
Explanation
sudo mkfs.vfat -F32 /dev/<your_device> -n boot
Example
sudo mkfs.vfat -F32 /dev/sdc1 -n boot
Explanation
sudo mkfs.ext4 /dev/<your_device> -L rootfs
Example
sudo mkfs.ext4 /dev/sdc2 -L rootfs
The result
sudo dd if=./u-boot.imx of=/dev/sdc bs=512 seek=2; sync ?????
How to boot each part
Now we will see where to put each part and how to.
U-Boot
General processors
After build or download the MLO and u-boot you should follow the next steps:
- Copy MLO and u-boot.img to primary boot partition
$ cp MLO u-boot.img /media/user/boot
You can follow this link if you want build the MLO and u-boot
Freescale processors
- Copy u-boot.imx using dd before primary partition in raw mode as
sudo dd if=/home/user/u-boot-imx/u-boot.imx of=/dev/sde bs=512 seek=2
Where /dev/sde is your microsd card
You can follow this link you want build the u-boot.imx
Root file System
In this tutorial we will use the linaro headless (soft floating) image as rootfs but you can use your favorite rootfs also.
Here there are many articles about how to get many other [index.php/Category:Software_distributions software distributions]. |
Here you've the linaro nano 11.09 (soft floating) available for download from the ISEE server.
Notes: You must build your programs with the hard floating if your rootfs is build with it.
Notes: IGEPv5 must use Hard floating Rootfs
Create the Rootfs mount point
Go to /media directory and create one sub-folder called "binary"
cd /media sudo mkdir binary
Mount the RootFS partition
Mount the rootfs partition using the 'binary' directory
$ media > sudo mount /dev/mmcblkp2 /media/binary
Untar the rootfs package
Copy "linaro-m-headless-tar-20101108-2.tar.gz" file inside the /media directory and untar the file
$ media > sudo tar xvfz linaro-m-headless-tar-20101108-2.tar.gz
Now you should see inside your rootfs partition a similar structure like this.
Install the kernel modules
Now you should install your kernel modules inside your root file system.
$ media > cd /home/jdoe/linux-omap-2.6 $ /home/jdoe/linux-omap-2.6> sudo make ARCH=arm CROSS_COMPILE=arm-linux-gnueabi- modules_install INSTALL_MOD_PATH=/media/binary
Alternatively if you downloaded the binary package uncompress it inside the directory /media/binary
Install the kernel Image
Just copy the zImage inside your boot partition, remember before that you must mount your mmc boot partition.
$ /home/jdoe/linux-omap-2.6> sudo cp arch/arm/boot/zImage /media/boot/ if you're using dtb kernel as 3.8.y you must copy the dtb too. $ /home/jdoe/linuz-omap-2.6> sudo cp arch/arm/boot/dtbs/omap5-igep0050.dtb /media/boot
After that you can unmount the boot & rootfs partitions.
Now we're ready for test our new microsd card
Kernel & Modules
You can follow this other howto about [index.php/The_Linux_kernel how compile and install the Linux Kernel].
Test your new MicroSD
You can test your new microSD card with a Serial client such as PuTTy. [index.php/Using_serial_debug_port_to_communicate Here] is an explanation about how to configure it.
(Note that speed should be configured to 115200 bauds).
If you already have configured it or you are using another Serial client and you have connected the Serial cable to the IGEPv2 board, then you are ready to test your microSD.
Insert the microSD in your IGEPv2 board and power up the board.