sgufa Posted January 11, 2017 Posted January 11, 2017 can you point me to how to add the script to initrd?
zador.blood.stained Posted January 11, 2017 Author Posted January 11, 2017 On 1/11/2017 at 2:38 PM, sgufa said: can you point me to how to add the script to initrd? As noted in the script itself, it should be put to /etc/initramfs-tools/scripts/init-premount/mass_storage To recompile the initrd you need to execute (as root / with sudo) update-initramfs -u -k all
sgufa Posted January 12, 2017 Posted January 12, 2017 @zador I suppose i have to change also start.sh with correct memory addresses, right?
zador.blood.stained Posted January 12, 2017 Author Posted January 12, 2017 On 1/12/2017 at 8:37 AM, sgufa said: @zador I suppose i have to change also start.sh with correct memory addresses, right? No, memory addresses should be correct. 1
sgufa Posted January 13, 2017 Posted January 13, 2017 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!
sgufa Posted March 2, 2017 Posted March 2, 2017 Hello zador, what should i change in boot.scr in order to boot mainline instead of legacy kernel?
zador.blood.stained Posted March 2, 2017 Author Posted March 2, 2017 On 3/2/2017 at 10:43 AM, sgufa said: what should i change in boot.scr in order to boot mainline instead of legacy kernel? Expand 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
tkaiser Posted October 24, 2017 Posted October 24, 2017 One of the Banana Pi employees took @zador.blood.stained's work, added a Windows GUI and extended SoC support from H3 only to A64, A83T and even H5: http://forum.banana-pi.org/t/the-3rd-party-emmc-flash-tool-for-bpi/4080 1
hanni76 Posted February 8, 2018 Posted February 8, 2018 On 1/11/2017 at 1: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). Expand 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.
zador.blood.stained Posted February 10, 2018 Author Posted February 10, 2018 On 2/8/2018 at 10:07 AM, hanni76 said: Is this possible to skip using initrd ? Expand 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 2/8/2018 at 10:07 AM, hanni76 said: how to create binaries with mainline kernel? Expand 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.
hanni76 Posted February 13, 2018 Posted February 13, 2018 On 2/10/2018 at 2: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. Expand in my system I don't have uInitrd. can i proceed without it ? how should I execute mass storage script in this scenario?
zador.blood.stained Posted February 13, 2018 Author Posted February 13, 2018 On 2/13/2018 at 11:55 AM, hanni76 said: in my system I don't have uInitrd. Expand 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.
hanni76 Posted February 13, 2018 Posted February 13, 2018 On 2/13/2018 at 12:09 PM, 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. Expand ok, understood thank you
hanni76 Posted February 14, 2018 Posted February 14, 2018 On 2/13/2018 at 12:09 PM, 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. Expand 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 / #
zador.blood.stained Posted February 14, 2018 Author Posted February 14, 2018 On 2/14/2018 at 11:12 AM, hanni76 said: And second issue is that " /sys/bus/platform/devices/sunxi_usb_udc/otg_role" does not exist. Expand Not required on mainline On 2/14/2018 at 11:12 AM, 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. Expand Is it visible as /dev/mmcblk1 in the "normal mode"? Also you can check /dev contents and dmesg log from the busybox shell
hanni76 Posted February 14, 2018 Posted February 14, 2018 On 2/14/2018 at 11:19 AM, 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 Expand yes, it is visible... I can access it and list partitions.
hanni76 Posted February 14, 2018 Posted February 14, 2018 On 2/14/2018 at 11:19 AM, 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 Expand should MMC driver be compiled as a module maybe ?
zador.blood.stained Posted February 14, 2018 Author Posted February 14, 2018 On 2/14/2018 at 11:24 AM, hanni76 said: should MMC driver be compiled as a module maybe ? Expand 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)
hanni76 Posted February 14, 2018 Posted February 14, 2018 On 2/14/2018 at 11:31 AM, 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) Expand 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 / #
letsdudiss Posted June 6, 2018 Posted June 6, 2018 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
martinayotte Posted June 6, 2018 Posted June 6, 2018 On 6/6/2018 at 1:13 PM, letsdudiss said: Armbian boots without a problem Expand 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 ...
zador.blood.stained Posted June 6, 2018 Author Posted June 6, 2018 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.
letsdudiss Posted June 6, 2018 Posted June 6, 2018 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.
martinayotte Posted June 7, 2018 Posted June 7, 2018 On 6/6/2018 at 3:47 PM, letsdudiss said: Copy from eMMC back to sdcard Expand No ! It needs to be done by hand ...
markbirss Posted August 25, 2018 Posted August 25, 2018 On 10/24/2017 at 11:51 AM, tkaiser said: One of the Banana Pi employees took @zador.blood.stained's work, added a Windows GUI and extended SoC support from H3 only to A64, A83T and even H5: http://forum.banana-pi.org/t/the-3rd-party-emmc-flash-tool-for-bpi/4080 Expand What would one need todo to add support for A33 SoC ? @zador.blood.stained
markbirss Posted August 27, 2018 Posted August 27, 2018 On 6/6/2018 at 2: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. Expand @zador.blood.stained is this a miniroot ? what is required to rebuild the kernel and initrd ?
zador.blood.stained Posted August 27, 2018 Author Posted August 27, 2018 On 8/27/2018 at 11:00 AM, markbirss said: is this a miniroot ? Expand No, this is a standard initrd from Debian or Ubuntu with a custom script. On 8/27/2018 at 11:00 AM, markbirss said: what is required to rebuild the kernel and initrd ? Expand 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 12:42 PM, markbirss said: What would one need todo to add support for A33 SoC ? Expand I would suggest looking into u-boot mass storage gadget support instead, this config suggests that is should be possible.
markbirss Posted August 27, 2018 Posted August 27, 2018 On 8/27/2018 at 11:12 AM, 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. Expand Thank you kindly, for your feedback, will try once I have my A33 Soc device
Recommended Posts