Difference between revisions of "Prepare a bootable MicroSD Card"
From IGEP - ISEE Wiki
Line 14: | Line 14: | ||
+ | |||
+ | ===<span id="Texas_Instruments_Processors" class="mw-headline">General Processors</span>=== | ||
<span class="mw-headline">Inside General processors we can find Texas Instruments</span> | <span class="mw-headline">Inside General processors we can find Texas Instruments</span> | ||
− | |||
* The microsd card must be content at latest 2 partitions. | * 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. | * The first one must be primary partition with the boot flag mark and formated using FAT(16 or 32) file system. | ||
Line 23: | Line 24: | ||
''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.'' | ''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.'' | ||
+ | |||
+ | |||
+ | |||
+ | {{Message/Information Message|title=TITLE|message= <span style="color: #000000;">Freescale has a different structure</span>}} | ||
Line 34: | Line 39: | ||
Therefore, we are going to '''setup a microSD card with these requirements''' and '''install a custom software distribution''' into it. | Therefore, we are going to '''setup a microSD card with these requirements''' and '''install a custom software distribution''' into it. | ||
− | |||
− | |||
− | |||
− | |||
− | |||
Line 51: | Line 51: | ||
===<span id="ToolChain" class="mw-headline">ToolChain</span>=== | ===<span id="ToolChain" class="mw-headline">ToolChain</span>=== | ||
− | * Read: | + | * Read: [[Ubuntu 16.04 LTS Toolchain]] |
+ | |||
+ | |||
+ | =='''<span class="mw-headline">Prepare a SD to boot</span>'''== | ||
+ | <div style="text-align: left;">{{Message/Information Message|title=TITLE|message= <span style="color: #000000;">We are using this version of Ubuntu .........</span>}}</div> | ||
+ | <div style="text-align: left;">We can use two differents methods in order to boot it. One is the '''GPARTED''' and the other is the '''sfdisk'''. Gparted is more visual than sfdisk but sfdisk is faster to do so.</div> | ||
− | ==<span id="Preparing_the_microSD_card" class="mw-headline">Preparing the microSD card</span>== | + | ===<span id="Preparing_the_microSD_card" class="mw-headline">Preparing the microSD card</span>=== |
Open a terminal window and clear your dmesg using: | Open a terminal window and clear your dmesg using: | ||
Line 72: | Line 77: | ||
<pre>$ sudo dd if=/dev/zero of=/dev/mmcblk0 bs=1024 count=1024 | <pre>$ sudo dd if=/dev/zero of=/dev/mmcblk0 bs=1024 count=1024 | ||
[sudo] password for jdoe:</pre> | [sudo] password for jdoe:</pre> | ||
− | |||
− | |||
− | |||
− | ==<span id="Install_GParted" class="mw-headline">Downloading GParted</span>== | + | ===<span id="Install_GParted" class="mw-headline">Downloading GParted</span>=== |
− | In order to prepare a micro SD with your already generated u-boot you need to flash the u-boot.imx using the command dd. | + | <span style="color: #ff0000;">In order to prepare a micro SD with your already generated u-boot you need to flash the u-boot.imx using the command dd. (?)<br /></span> |
− | It is important to prepare your micro SD card first creating a partition that leave some free space for the u-boot.imx. It can be used GPARTED as it is shown in the image. | + | It is important to prepare your micro SD card first creating a partition that leave some free space for the u-boot.imx. It can be used GPARTED as it is shown in the image. |
Line 89: | Line 91: | ||
<pre>sudo apt-get install gparted</pre> | <pre>sudo apt-get install gparted</pre> | ||
− | <span style="color: #000000;"> | + | <span style="color: #000000;">When the install procedure ends you can call the program from your system tools menu or directly using a terminal console.</span> |
+ | <span style="color: #000000;"> </span> | ||
+ | <div class="code panel pdl conf-macro output-block" data-hasbody="true" data-macro-name="code"></div> | ||
+ | ==<span id="GParted_and_Creation_of_Partitions" class="mw-headline">'''Make the partition of the SD'''<br /></span>== | ||
+ | Now we are going to see some steps with the two methods. First creating the partition and then how procedure with each processor. | ||
− | |||
− | |||
− | |||
− | |||
+ | ===='''Defining Partitions'''==== | ||
+ | Here we will see how make the partitions in the different methods | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | + | =====<span style="color: #000000;">GPARTED</span>===== | |
− | + | 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. | |
− | |||
+ | <div class="center"><div class="thumb tnone"><div class="thumbinner" style="text-align: left;"><div class="thumbcaption"><div class="magnify"></div> | ||
</div> | </div> | ||
− | < | + | <span style="color: #ff0000;">2 FOTOS</span></div> |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
</div> | </div> | ||
</div> | </div> | ||
+ | Check the default option it's create a msdos partition table. | ||
+ | After that you can '''Apply'''. | ||
− | |||
− | |||
− | |||
− | + | =====<span style="color: #000000;">SFDISK</span>===== | |
− | ===<span | + | <div class="code panel pdl conf-macro output-block" data-hasbody="true" data-macro-name="code"><div id="highlighter_789287"> |
− | + | sudo sfdisk /dev/ <<EOF<br>label: dos<br>16065,128520,0x0C,*<br>144585,,,-<br>EOF</div> | |
− | |||
− | <div class=" | ||
</div> | </div> | ||
− | < | + | ====<span id="Create_the_BOOT_Partition_-_IGEP_Texas_Instruments_Processor_based" class="mw-headline">'''Create the BOOT Partition -''' '''General IGEP Processor based'''</span>==== |
− | </ | + | <span class="mw-headline">''' '''</span> |
− | < | ||
− | |||
− | |||
− | |||
− | + | =====<span style="color: #000000;"><span class="mw-headline">GPARTED</span></span>===== | |
− | |||
− | ===<span | ||
<u>This Step it's only for OMAP35xx, DM37xx, AM335x, OMAP5432 processor based IGEP boards.</u> | <u>This Step it's only for OMAP35xx, DM37xx, AM335x, OMAP5432 processor based IGEP boards.</u> | ||
Line 173: | Line 148: | ||
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 id="Create_the_BOOT_Partition_-_IGEP_NXP-Freescale_Processor_based" class="mw-headline">Create the BOOT Partition - | + | |
+ | |||
+ | =====<span style="color: #000000;">SFDISK</span>===== | ||
+ | bla bla bla bla | ||
+ | |||
+ | |||
+ | |||
+ | ===='''<span id="Create_the_BOOT_Partition_-_IGEP_NXP-Freescale_Processor_based" class="mw-headline">Create the BOOT Partition - IGEP NXP-Freescale Processor based</span>'''==== | ||
+ | <span class="mw-headline">''' '''</span> | ||
+ | |||
+ | =====<span style="color: #000000;"><span class="mw-headline">GPARTED</span></span>===== | ||
<u>This Step it's only for iMX6 processor based IGEP boards.</u> | <u>This Step it's only for iMX6 processor based IGEP boards.</u> | ||
Line 192: | Line 177: | ||
* '''Align to: cylinder''' | * '''Align to: cylinder''' | ||
− | + | It is recommended to '''apply changes''' now or you might get an error later. | |
+ | |||
− | ===<span id="Create_the_ROOTFS_Partition" class="mw-headline">Create the ROOTFS Partition</span>=== | + | |
+ | =====<span style="color: #000000;">SFDISK</span>===== | ||
+ | <pre>$ sudo mkfs.vfat -F 32 /dev/ -n boot</pre> | ||
+ | $ sudo mkfs.ext3 /dev/ -L rootfs | ||
+ | |||
+ | |||
+ | ===='''<span id="Create_the_ROOTFS_Partition" class="mw-headline">Create the ROOTFS Partition</span>'''==== | ||
+ | <span class="mw-headline"> <br /></span> | ||
+ | |||
+ | =====<span style="color: #000000;"><span class="mw-headline">GPARTED</span></span>===== | ||
The Next step it's create the root file system partition. | The Next step it's create the root file system partition. | ||
Line 227: | Line 222: | ||
After all apply all changes | After all apply all changes | ||
− | ===<span id="Select_.22Boot_flag.22_for_the_boot_partition" class="mw-headline">Select "Boot flag" for the boot partition</span>=== | + | |
+ | |||
+ | =====SFDISK===== | ||
+ | Then you only have to use dd command in order to copy the u-boot.imx to the SD card. | ||
+ | |||
+ | <u>'''Please, be sure you have write correctly the following command because in if not, it can corrupt your computer.'''</u> | ||
+ | |||
+ | <div class="code panel pdl conf-macro output-block" data-hasbody="true" data-macro-name="code"><div class="codeHeader panelHeader pdl"></div> | ||
+ | <div class="codeHeader panelHeader pdl">'''u-boot.imx copy'''</div> | ||
+ | <div id="highlighter_550267"> | ||
+ | $ sudo dd if=//u-boot.imx of=/dev/ bs=512 seek=2<br>$ sync</div> | ||
+ | </div> | ||
+ | For example | ||
+ | |||
+ | <div class="code panel pdl conf-macro output-block" data-hasbody="true" data-macro-name="code"><div class="codeHeader panelHeader pdl">'''u-boot.imx copy'''</div> | ||
+ | <div id="highlighter_209438"> | ||
+ | $ sudo dd if=/home/user/Project/u-boot/u-boot.imx of=/dev/sdd bs=512 seek=2<br>$ sync</div> | ||
+ | </div> | ||
+ | |||
+ | |||
+ | ===='''<span id="Select_.22Boot_flag.22_for_the_boot_partition" class="mw-headline">Select "Boot flag" for the boot partition</span>'''==== | ||
+ | <span class="mw-headline"> </span> | ||
+ | |||
+ | =====<span style="color: #000000;"><span class="mw-headline">GPARTED</span></span>===== | ||
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 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 | ||
Line 236: | Line 254: | ||
</div> | </div> | ||
Now we have the microsd prepared for copy the boot files | Now we have the microsd prepared for copy the boot files | ||
+ | |||
+ | |||
Line 243: | Line 263: | ||
==U-Boot== | ==U-Boot== | ||
− | ''' | + | '''General processors<br />''' |
After build or download the MLO and u-boot you should follow the next steps: | After build or download the MLO and u-boot you should follow the next steps: | ||
Line 254: | Line 274: | ||
− | ''' | + | '''Freescale processors<br />''' |
* Copy u-boot.imx using dd before primary partition in raw mode as | * Copy u-boot.imx using dd before primary partition in raw mode as | ||
Line 271: | Line 291: | ||
− | {| | + | |
+ | {| cellspacing="1" cellpadding="1" border="0" width="auto" align="center" | ||
|- | |- | ||
|| | || | ||
| style="text-align: center;"| | | style="text-align: center;"| | ||
|- | |- | ||
− | | scope="row"| | + | | scope="row"| |
||Here there are many articles about how to get '''many other [index.php/Category:Software_distributions software distributions]'''. | ||Here there are many articles about how to get '''many other [index.php/Category:Software_distributions software distributions]'''. | ||
|} | |} | ||
Line 284: | Line 305: | ||
Notes: IGEPv5 must use Hard floating Rootfs | Notes: IGEPv5 must use Hard floating Rootfs | ||
+ | |||
Line 304: | Line 326: | ||
<br /> Now you should see inside your rootfs partition a similar structure like this. | <br /> Now you should see inside your rootfs partition a similar structure like this. | ||
− | <div class="center"><div class="thumb tnone"><div class="thumbinner" style="width: 302px;"> | + | <div class="center"><div class="thumb tnone"><div class="thumbinner" style="width: 302px;"><div class="thumbcaption"><div class="magnify"></div> |
</div> | </div> | ||
</div> | </div> |
Revision as of 12:50, 10 May 2018
Contents
- 1 Introduction
- 2 Prepare a SD to boot
- 3 Make the partition of the SD
- 4 How to boot each part
- 5 Test your new MicroSD
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
Prepare a SD to boot
Preparing the microSD card
Open a terminal window and clear your dmesg using:
sudo dmesg -c
Now insert a new microsd card in your PC and then check your dmesg:
dmesg
You should see something like this:
mmc0: new high speed SDHC card at address 0001 mmcblk0: mmc0:0001 00000 3.79 GiB mmcblk0: unknown partition table
Ensure all in your microsd card it's erased:
$ sudo dd if=/dev/zero of=/dev/mmcblk0 bs=1024 count=1024 [sudo] password for jdoe:
Downloading GParted
In order to prepare a micro SD with your already generated u-boot you need to flash the u-boot.imx using the command dd. (?)
It is important to prepare your micro SD card first creating a partition that leave some free space for the u-boot.imx. It can be used GPARTED as it is shown in the image.
In this image we can see the devices plugged in our computer. And it can be installed with this command.
sudo apt-get install gparted
When the install procedure ends you can call the program from your system tools menu or directly using a terminal console.
Make the partition of the SD
Now we are going to see some steps with the two methods. First creating the partition and then how procedure with each processor.
Defining Partitions
Here we will see how make the partitions in the different methods
GPARTED
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.
Check the default option it's create a msdos partition table.
After that you can Apply.
SFDISK
label: dos
16065,128520,0x0C,*
144585,,,-
EOF
Create the BOOT Partition - General IGEP Processor based
GPARTED
This Step it's only for OMAP35xx, DM37xx, AM335x, OMAP5432 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 then the application show a window like this:
We will configure the partition as:
- Primary Partition
- Format: FAT32
- Size: 100 MegaBytes
- Free Space Preceding: 0 MiB
- Label: Boot
- Align to: cylinder
It is recommended to apply changes now or you might get an error later.
SFDISK
bla bla bla bla
Create the BOOT Partition - IGEP NXP-Freescale Processor based
GPARTED
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 then the application show a window like this:
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.
SFDISK
$ sudo mkfs.vfat -F 32 /dev/ -n boot
$ sudo mkfs.ext3 /dev/ -L rootfs
Create the ROOTFS Partition
GPARTED
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:
We will configure the rootfs partition as:
- Primary Partition
- Format: EXT4
- Size: All the Rest
- Label: Rootfs
At end we will click on "Add" button.
or
After all apply all changes
SFDISK
Then you only have to use dd command in order to copy the u-boot.imx to the SD card.
Please, be sure you have write correctly the following command because in if not, it can corrupt your computer.
$ sync
For example
$ sync
Select "Boot flag" for the boot partition
GPARTED
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
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.