FEL mass storage or writing images directly to eMMC
1 1

51 posts in this topic

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!

Share this post


Link to post
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

Share this post


Link to post
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.

Share this post


Link to post
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.

Share this post


Link to post
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?

Share this post


Link to post
Share on other sites
12 minutes ago, hanni76 said:

in my system I don't have uInitrd.

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.

Share this post


Link to post
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

Share this post


Link to post
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
/ # 
 

 

Share this post


Link to post
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

Share this post


Link to post
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.

Share this post


Link to post
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 ?

Share this post


Link to post
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
/ # 
 

 

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

1 1

  • Support the project

    We need your help to stay focused on the project.

    Choose the amount and currency you would like to donate in below.