Jump to content

FEL mass storage or writing images directly to eMMC


Recommended Posts

boot is ok. but i found 2 problems:

 

1 - /sys/bus/platform/devices/sunxi_usb_udc/otg_role does not exist.

2 - g_mass_storage does not mount any drive (i've tried both emmc and sd-card). 

 

If i load g_mass_storage inside armbian it works as expected. i've tried to run it manually inside busybox but nothing happens.

Any suggestion?

 

EDIT: I've found that g_mass_storage module did not exist in initramfs. Added in /etc/initramfs-tools/modules. All works great!

Link to comment
Share on other sites

4 hours ago, sgufa said:

what should i change in boot.scr in order to boot mainline instead of legacy kernel?

You need to remove "setenv machid 1029", "sentenv bootm_boot_mode sec" and append "${fdt_addr_r}" to the bootz line

To change boot.scr you need to either extract its contents back to boot.cmd or write it from scratch as it is checksum-protected and can't be edited directly

Link to comment
Share on other sites

On 1/11/2017 at 4:33 PM, zador.blood.stained said:

Simply copied from a working image after adding mass_storage script to the initrd and recompiling it. Ideally this needs to be redone based on the mainline kernel (and it will be universal for A10, A20 and H3 devices).

Hi, can you please put more precise instructions on how to create binaries with mainline kernel? Is this possible to skip using initrd ?

Thanks a lot.

Link to comment
Share on other sites

On 08.02.2018 at 1:07 PM, hanni76 said:

Is this possible to skip using initrd ?

Everything is possible if you dig deep enough into the kernel patching. Or using u-boot OTG + fastboot if the target platform supports this - this way you wouldn't need to load anything except for the u-boot.

 

On 08.02.2018 at 1:07 PM, hanni76 said:

how to create binaries with mainline kernel?

There won't be much differences from the legacy binaries, you would need to provide a DT blob instead of script.bin and make sure that OTG is running in the device mode (either by patching the DT or by relying on the OTG ID pin).

There are no step by step instructions for creating those binaries, for a PoC it is enough to extract u-boot, zImage, uInitrd and .dtb file from a working image and add the mass storage script to initrd.

Link to comment
Share on other sites

On 2/10/2018 at 5:27 PM, zador.blood.stained said:

Everything is possible if you dig deep enough into the kernel patching. Or using u-boot OTG + fastboot if the target platform supports this - this way you wouldn't need to load anything except for the u-boot.

 

There won't be much differences from the legacy binaries, you would need to provide a DT blob instead of script.bin and make sure that OTG is running in the device mode (either by patching the DT or by relying on the OTG ID pin).

There are no step by step instructions for creating those binaries, for a PoC it is enough to extract u-boot, zImage, uInitrd and .dtb file from a working image and add the mass storage script to initrd.

in my system I don't have uInitrd.  can i proceed without it ? how should I execute mass storage script in this scenario?

Link to comment
Share on other sites

5 minutes ago, zador.blood.stained said:

Then you need to make one (update-initramfs + mkimage), even if it won't be used by the normal system boot. You'll need to have a ramdisk with busybox if you want to execute any script.

ok, understood

thank you

Link to comment
Share on other sites

22 hours ago, zador.blood.stained said:

Then you need to make one (update-initramfs + mkimage), even if it won't be used by the normal system boot. You'll need to have a ramdisk with busybox if you want to execute any script.

 

hi zador

I tried to boot  and got some issues and below is my dmesg. First of all , it seems like eMMC is not visible as /dev/mmcblk1 with initramfs.

When I boot normal mode it is present in the system. 

And second issue is that " /sys/bus/platform/devices/sunxi_usb_udc/otg_role" does not exist.

Any ideas how to proceed ?

 

U-Boot SPL 2018.03-rc1-dirty (Feb 14 2018 - 12:46:29 +0300)
DRAM: 1024 MiB
Trying to boot from FEL


U-Boot 2018.03-rc1-dirty (Feb 14 2018 - 12:46:29 +0300) Allwinner Technology

CPU:   Allwinner H3 (SUN8I 1680)
Model: Xunlong Orange Pi PC Plus
DRAM:  1 GiB
MMC:   SUNXI SD/MMC: 0, SUNXI SD/MMC: 1
Loading Environment from FAT... Unable to use mmc 1:1... Failed (-5)
Loading Environment from MMC... *** Warning - bad CRC, using default environment

OK
In:    serial
Out:   vidconsole
Err:   vidconsole
Net:   phy interface0
eth0: ethernet@1c30000
starting USB...
USB0:   USB EHCI 1.00
USB1:   USB OHCI 1.0
USB2:   USB EHCI 1.00
USB3:   USB OHCI 1.0
USB4:   USB EHCI 1.00
USB5:   USB OHCI 1.0
scanning bus 0 for devices... 1 USB Device(s) found
scanning bus 2 for devices... 1 USB Device(s) found
scanning bus 4 for devices... 1 USB Device(s) found
       scanning usb for storage devices... 0 Storage Device(s) found
Hit any key to stop autoboot:  0 
(FEL boot)
## Executing script at 43100000
## Loading init Ramdisk from Legacy Image at 43300000 ...
   Image Name:   uInitrd
   Image Type:   ARM Linux RAMDisk Image (uncompressed)
   Data Size:    2783418 Bytes = 2.7 MiB
   Load Address: 00000000
   Entry Point:  00000000
   Verifying Checksum ... OK
## Flattened Device Tree blob at 43000000
   Booting using the fdt blob at 0x43000000
   Loading Ramdisk to 49d58000, end 49fff8ba ... OK
   Loading Device Tree to 49d4e000, end 49d572ba ... OK

Starting kernel ...

Loading, please wait...
starting version 232
Begin: Loading essential drivers ... done.
Begin: Running /scripts/init-premount ... 
Starting g_mass_storage script
Exporting MMC 0 (SD) (/dev/mmcblk0)
/scripts/init-premount/mass_storage: line 41: can't create /sys/bus/platform/devices/sunxi_usb_udc/otg_role: nonexistent directory
/scripts/init-premount/mass_storage: line 46: can't create /sys/bus/platform/devices/sunxi_usb_udc/otg_role: nonexistent directory
Done


BusyBox v1.22.1 (Debian 1:1.22.0-19+b3) built-in shell (ash)
Enter 'help' for a list of built-in commands.

sh: can't access tty; job control turned off
/ # 
 

 

Link to comment
Share on other sites

3 minutes ago, hanni76 said:

And second issue is that " /sys/bus/platform/devices/sunxi_usb_udc/otg_role" does not exist.

Not required on mainline

 

5 minutes ago, hanni76 said:

it seems like eMMC is not visible as /dev/mmcblk1 with initramfs.

When I boot normal mode it is present in the system. 

Is it visible as /dev/mmcblk1 in the "normal mode"? Also you can check /dev contents and dmesg log from the busybox shell

Link to comment
Share on other sites

Just now, zador.blood.stained said:

Not required on mainline

 

Is it visible as /dev/mmcblk1 in the "normal mode"? Also you can check /dev contents and dmesg log from the busybox shell

yes, it is visible... I can access it and list partitions.

Link to comment
Share on other sites

4 minutes ago, zador.blood.stained said:

Not required on mainline

 

Is it visible as /dev/mmcblk1 in the "normal mode"? Also you can check /dev contents and dmesg log from the busybox shell

should MMC driver be compiled as a module maybe ?

Link to comment
Share on other sites

3 hours ago, zador.blood.stained said:

It's the same driver that is used for SD, but eMMC may appear, for example, as /dev/mmcblk2 (which is not accounted in the default script)

Yes, it is mmcblk2

It looks better now (see below). Next question: how can I access this disk from the ubuntu host machine ?

 

Starting kernel ...

Loading, please wait...
starting version 232
Begin: Loading essential drivers ... done.
Begin: Running /scripts/init-premount ... 
Starting g_mass_storage script
Exporting MMC 2 (eMMC) (/dev/mmcblk2)
Done


BusyBox v1.22.1 (Debian 1:1.22.0-19+b3) built-in shell (ash)
Enter 'help' for a list of built-in commands.

sh: can't access tty; job control turned off
/ # 
 

 

Link to comment
Share on other sites

Hi,

 

I have a Chinese board that has H3 on it. Earlier versions of this board works with this tool.

 

However, there has been a change in the eMMC chip and the tool failed to mount the eMMC. It goes into kernel panic as it could not find mmcblk0 or 1. I replaced the zImage of the tool with a zImage from a fresh Armbian build, the board doesnt go into kernel panic anymore, in fact, it can now see the mmc chip (cat /proc/partitions shows 8GB on mmcblk0). The console shows that its exporting MMC 0 but then on Windows, it says the USB device malfunction :/

 

Console log below:

U-Boot 2016.09-armbian-fel-mass-storage-dirty (Sep 28 2016 - 12:21:11 +0300) Allwinner Technology

CPU:   Allwinner H3 (SUN8I 1680)
Model: Xunlong Orange Pi One
DRAM:  1 GiB
Using default environment

In:    serial
Out:   serial
Err:   serial
Net:   No ethernet found.
Hit any key to stop autoboot:  0
(FEL boot)
## Executing script at 43100000
## Loading init Ramdisk from Legacy Image at 43300000 ...
   Image Name:   uInitrd
   Image Type:   ARM Linux RAMDisk Image (gzip compressed)
   Data Size:    2229486 Bytes = 2.1 MiB
   Load Address: 00000000
   Entry Point:  00000000
   Verifying Checksum ... OK
Using machid 0x1029 from environment

Starting kernel ...

[sun8i_fixup]: From boot, get meminfo:
        Start:  0x40000000
        Size:   1024MB
ion_carveout reserve: 160m@0 256m@0 130m@1 200m@1
ion_reserve_select: ion chipid  [0x2004620!
ion_reserve_common: ion reserve: [0x50000000, 0x60000000]!
Loading, please wait...
Begin: Loading essential drivers ... done.
Begin: Running /scripts/init-premount ...
Starting g_mass_storage script
https://github.com/zador-blood-stained/fel-mass-storage
Exporting MMC 0 (SD) (/dev/mmcblk0)
Done
# cat /proc/partitions
major minor  #blocks  name

 179        0    7634944 mmcblk0
 179        1    5173248 mmcblk0p1
 179        2      16384 mmcblk0p2
 179        3          1 mmcblk0p3
 179        5      16384 mmcblk0p5
 179        6      16384 mmcblk0p6
 179        7     786432 mmcblk0p7
 179        8      16384 mmcblk0p8
 179        9      32768 mmcblk0p9
 179       10     786432 mmcblk0p10
 179       11      16384 mmcblk0p11
 179       12      16384 mmcblk0p12
 179       13      16384 mmcblk0p13
 179       14      32768 mmcblk0p14
 179       15      16384 mmcblk0p15
 259        0     655360 mmcblk0p16
 179       32       4096 mmcblk0boot1
 179       16       4096 mmcblk0boot0
#

 

The supplier has given me source code for u-boot, kernel mmc driver and kernel nand driver. I have verified these source code works as I updated an Android SDK with these code and the Android image can be now flashed with PheonixSuit (previously it would fail)

 

Where should I start to make this tool work again?

 

Funnily enough, if I use the "sdcard method" to write Armbian image into mmc, Armbian boots without a problem. I wouldve thought the Armbian image would need to be updated to work with new mmc chip. Not sure if I am understanding things correctly here. This is really out of my depth.

 

Thanks for help

Link to comment
Share on other sites

20 minutes ago, letsdudiss said:

Armbian boots without a problem

If booting from SDCard works fine, what the command "ls -l /dev/mmcblk*" is showing ? Are both SDCard (/dev/mmcblk0) and eMMC (/dev/mmcblk1) present ?

If Yes, the "nand-sata-install" script could probably do the job of install a copy of the SDCard into the eMMC ...

 

Link to comment
Share on other sites

Hey Martin,

 

I'll check if it can see both mmcblk.

If that's what "nand-sata-install", is there a script to do the reverse? Copy from eMMC back to sdcard. This is so that I can clone boards

 

Hey Zador, 

 

By "this kernel" you mean the current Armbian legacy kernel?

 

I guess the kernel would be zImage. How do I build another uInitrd? I know another bloke asked this question in previous posts but it's still not clear to me how I could build uInitrd.

 

EDIT: I read the posts again. There is the "update initramfs" thingo. I'll guess I'll try it.

Link to comment
Share on other sites

On 6/6/2018 at 4:24 PM, zador.blood.stained said:

There were some patches to this kernel to support newer eMMC revisions (or rather to not crash if an incompatible revision is found), so the kernel and uInitrd for fel-mass-storage has to be rebuilt if anyone wants to fix this.

 

@zador.blood.stained is this a miniroot ? what is required to rebuild the kernel and initrd ?

Link to comment
Share on other sites

5 minutes ago, markbirss said:

is this a miniroot ?

No, this is a standard initrd from Debian or Ubuntu with a custom script.

 

6 minutes ago, markbirss said:

what is required to rebuild the kernel and initrd ?

Any kernel that supports OTG and mass storage gadget should work, but the script I linked was adjusted specifically for the sun8i legacy kernel, so it will need some rework for different kernels.

In case of binaries provided for H3 in my repository I removed a lot of non-essential options from the kernel config (to minimize the binary size) and adjusted u-boot and script.bin to work on most boards regardless of CPU voltage regulation type.

 

On 8/25/2018 at 3:42 PM, markbirss said:

What would one need todo to add support for A33 SoC ?

I would suggest looking into u-boot mass storage gadget support instead, this config suggests that is should be possible.

Link to comment
Share on other sites

8 minutes ago, zador.blood.stained said:

No, this is a standard initrd from Debian or Ubuntu with a custom script.

 

Any kernel that supports OTG and mass storage gadget should work, but the script I linked was adjusted specifically for the sun8i legacy kernel, so it will need some rework for different kernels.

In case of binaries provided for H3 in my repository I removed a lot of non-essential options from the kernel config (to minimize the binary size) and adjusted u-boot and script.bin to work on most boards regardless of CPU voltage regulation type.

 

I would suggest looking into u-boot mass storage gadget support instead, this config suggests that is should be possible.

 

Thank you kindly, for your feedback, will try once I have my A33 Soc device

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
×
×
  • Create New...

Important Information

Terms of Use - Privacy Policy - Guidelines