U-Boot UMS on APF & OPOS: Difference between revisions
From ArmadeusWiki
mNo edit summary |
SebastienSz (talk | contribs) (→Links: add link the the OPOS8MM eMMC data partition page) |
||
(20 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
This page gather instructions for using U-Boot's USB Mass Storage gadget mode (or UMS) usage on [[APF6]] and [[OPOS6UL]](NANO). This mode allows you to flash rootfs images bigger than the available module RAM, ex: > 200MBytes on the [[OPOS6UL]](NANO). Indeed ''run update_rootfs'' script uses RAM to store images while uploading from TFTP, which can be short for big rootfs. UMS also allows you to backup your rootfs on your Host. | |||
* First connect a second [[ | * First, keep your USB debug cable and connect a second USB cable on [[APF6_Dev]] or [[OPOS6ULDev]]'s OTG port. | ||
* Under U-Boot type: | * Under U-Boot type: | ||
<pre class="apf"> | <pre class="apf"> | ||
Line 8: | Line 8: | ||
| | | | ||
</pre> | </pre> | ||
* On your | * On your Host computer you should see the [[eMMC]] partition like a standard USB key. | ||
<pre class="host"> | <pre class="host"> | ||
$ dmesg | $ dmesg | tail | ||
[...] | [...] | ||
[26828.348088] sd 13:0:0:0: [sdc] Mode Sense: 0f 00 00 00 | [26828.348088] sd 13:0:0:0: [sdc] Mode Sense: 0f 00 00 00 | ||
Line 18: | Line 18: | ||
</pre> | </pre> | ||
Here the device is ''/dev/sdc'' and all partitions have been automounted by the | Here the device is ''/dev/sdc'' and all partitions have been automounted by the Host: | ||
<pre class="host"> | <pre class="host"> | ||
Line 28: | Line 28: | ||
[26830.268450] EXT4-fs (sdc1): mounted filesystem without journal. Opts: (null) | [26830.268450] EXT4-fs (sdc1): mounted filesystem without journal. Opts: (null) | ||
</pre> | </pre> | ||
{{Warning| Before doing the following procedure, be sure that your device name is correct. You can erase all your | {{Warning| Before doing the following procedure, be sure that your device name is correct. '''You can erase all your Host datas if you do it wrong !!!'''}} | ||
* The rootfs is under the sdc2 and is named " | * The rootfs is under the sdc2 and is named "ROOTFS". On your debian/ubuntu Host it might be auto-mounted under ''/media/usb1'', if no other USB key is present on system and if you activated auto-mounting. | ||
<pre class="host"> | <pre class="host"> | ||
$ ls /media/usb1/ | $ ls /media/usb1/ | ||
Line 35: | Line 35: | ||
</pre> | </pre> | ||
* To flash rootfs | * To flash entire rootfs, first erase all files on this partition: | ||
<pre class="host"> | <pre class="host"> | ||
$ sudo umount /media/usb1 | $ sudo umount /media/usb1 (if partition is auto-mounted) | ||
$ sudo mkfs.ext4 /dev/sdc2 | $ sudo mkfs.ext4 -L ROOTFS -O ^64bit,^metadata_csum,uninit_bg /dev/sdc2 | ||
</pre> | </pre> | ||
==Update your rootfs== | |||
* Then, you have 2 methods to update your rootfs: | |||
{| class="wikitable" | |||
|- | |||
! tar method !! dd method | |||
|- | |||
| | |||
* Then mount it under an arbitrary directory: | * Then mount it under an arbitrary directory: | ||
<pre class="host"> | <pre class="host"> | ||
Line 48: | Line 56: | ||
* Untar the archive generated by your bsp (in ''buildroot/output/images/'') | * Untar the archive generated by your bsp (in ''buildroot/output/images/'') | ||
<pre class="host"> | <pre class="host"> | ||
$ | $ make shell_env | ||
$ sudo tar -xvf / | $ . armadeus_env.sh | ||
$ sudo tar -xvf $ARMADEUS_ROOTFS_TAR -C /tmp/rootfs | |||
</pre> | </pre> | ||
* then umount the filesystem: | * then umount the filesystem: | ||
Line 56: | Line 65: | ||
$ sync | $ sync | ||
</pre> | </pre> | ||
|| | |||
* One alternative way to untaring is to use ''dd'': | |||
<pre class="host"> | |||
$ sudo dd if=/tftpboot/xxx-rootfs.ext4 of=/dev/sdc2 | |||
</pre> | |||
(replace xxx with the name of your module) | |||
|} | |||
* Once | * Once finished, you can kill the U-Boot's USB gadget process with a Ctrl-C: | ||
<pre class="apf"> | <pre class="apf"> | ||
BIOS> ums 0 mmc 0 | BIOS> ums 0 mmc 0 | ||
Line 64: | Line 80: | ||
BIOS> | BIOS> | ||
</pre> | </pre> | ||
==Backup your rootfs== | |||
<pre class="host"> | |||
$ sudo dd if=/dev/sdc2 of=/home/xxx/rootfs_xxx.ext4 (takes time ;-) ) | |||
</pre> | |||
* check if it succeed: | |||
<pre class="host"> | |||
$ sudo mount -o loop /home/xxx/rootfs_xxx.ext4 /media/mmc/ | |||
$ ls /media/mmc/boot/ | |||
</pre> | |||
==Troubleshots== | |||
* UMS was reported not working on Windows 7/8 hosts with Virtual Box Ubuntu 15.04 emulated machines... | |||
==Links== | |||
* [[EMMC_OPOS6UL#User_Data_partition_layout|OPOS6UL eMMC Data partition]] | |||
* [[EMMC_OPOS8MM#User_Data_partition_layout|OPOS8MM eMMC Data partition]] | |||
[[Category:U-Boot]] |
Latest revision as of 15:23, 21 May 2021
This page gather instructions for using U-Boot's USB Mass Storage gadget mode (or UMS) usage on APF6 and OPOS6UL(NANO). This mode allows you to flash rootfs images bigger than the available module RAM, ex: > 200MBytes on the OPOS6UL(NANO). Indeed run update_rootfs script uses RAM to store images while uploading from TFTP, which can be short for big rootfs. UMS also allows you to backup your rootfs on your Host.
- First, keep your USB debug cable and connect a second USB cable on APF6_Dev or OPOS6ULDev's OTG port.
- Under U-Boot type:
BIOS> ums 0 mmc 0 UMS: disk start sector: 0x0, count: 0x760000 |
- On your Host computer you should see the eMMC partition like a standard USB key.
$ dmesg | tail [...] [26828.348088] sd 13:0:0:0: [sdc] Mode Sense: 0f 00 00 00 [26828.348395] sd 13:0:0:0: [sdc] Write cache: enabled, read cache: enabled, doesn't support DPO or FUA [26828.354177] sdc: sdc1 sdc2 [26828.356782] sd 13:0:0:0: [sdc] Attached SCSI disk
Here the device is /dev/sdc and all partitions have been automounted by the Host:
[26830.002168] EXT4-fs (sdc1): mounting ext2 file system using the ext4 subsystem [26830.054358] EXT4-fs (sdc2): mounting ext2 file system using the ext4 subsystem [26830.078638] EXT4-fs (sdc2): warning: mounting unchecked fs, running e2fsck is recommended [26830.114382] EXT4-fs (sdc2): mounted filesystem without journal. Opts: (null) [26830.135564] EXT4-fs (sdc1): warning: mounting unchecked fs, running e2fsck is recommended [26830.268450] EXT4-fs (sdc1): mounted filesystem without journal. Opts: (null)
![]() |
Warning: Before doing the following procedure, be sure that your device name is correct. You can erase all your Host datas if you do it wrong !!! |
- The rootfs is under the sdc2 and is named "ROOTFS". On your debian/ubuntu Host it might be auto-mounted under /media/usb1, if no other USB key is present on system and if you activated auto-mounting.
$ ls /media/usb1/ bin boot dev etc home init lib lib32 linuxrc lost+found media mnt opt proc root run sbin sys tmp usr var
- To flash entire rootfs, first erase all files on this partition:
$ sudo umount /media/usb1 (if partition is auto-mounted) $ sudo mkfs.ext4 -L ROOTFS -O ^64bit,^metadata_csum,uninit_bg /dev/sdc2
Update your rootfs
- Then, you have 2 methods to update your rootfs:
tar method | dd method |
---|---|
$ sudo mkdir /tmp/rootfs $ sudo mount /dev/sdc2 /tmp/rootfs
$ make shell_env $ . armadeus_env.sh $ sudo tar -xvf $ARMADEUS_ROOTFS_TAR -C /tmp/rootfs
$ sudo umount /tmp/rootfs/ $ sync |
$ sudo dd if=/tftpboot/xxx-rootfs.ext4 of=/dev/sdc2 (replace xxx with the name of your module) |
- Once finished, you can kill the U-Boot's USB gadget process with a Ctrl-C:
BIOS> ums 0 mmc 0 UMS: disk start sector: 0x0, count: 0x760000 CTRL+C - Operation aborted BIOS>
Backup your rootfs
$ sudo dd if=/dev/sdc2 of=/home/xxx/rootfs_xxx.ext4 (takes time ;-) )
- check if it succeed:
$ sudo mount -o loop /home/xxx/rootfs_xxx.ext4 /media/mmc/ $ ls /media/mmc/boot/
Troubleshots
- UMS was reported not working on Windows 7/8 hosts with Virtual Box Ubuntu 15.04 emulated machines...