Jump to content

Boot from eMMC with blank SD in slot (BPI-M3)


eternalWalker

Recommended Posts

I use "Semi_Armbian_5.07_M3", how can I mount blank SD? 

When I boot from eMMC with blank SD inside - System will not start (First boot A83T is from SD) , When I plug when the systen is already running - is not recognized.

Do we need  'redirector' on SD-Bootsector? (like PC+ Floppy Disk) ?

 

After inserting the SD:

 

 

 

 

 

root@BananaPiM3:~# fdisk -l

Disk /dev/mmcblk0: 7,3 GiB, 7818182656 bytes, 15269888 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x000ac9e8

Device         Boot  Start      End  Sectors  Size Id Type
/dev/mmcblk0p1 *    204800   729087   524288  256M  c W95 FAT32 (LBA)
/dev/mmcblk0p2      729088 15269887 14540800    7G 83 Linux

Disk /dev/mmcblk0boot1: 4 MiB, 4194304 bytes, 8192 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk /dev/mmcblk0boot0: 4 MiB, 4194304 bytes, 8192 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
root@BananaPiM3:~# cat /proc/partitions
major minor  #blocks  name

 179        0    7634944 mmcblk0
 179        1     262144 mmcblk0p1
 179        2    7270400 mmcblk0p2
 179       32       4096 mmcblk0boot1
 179       16       4096 mmcblk0boot0
root@BananaPiM3:~# blkid -c /dev/null
/dev/mmcblk0: PTUUID="000ac9e8" PTTYPE="dos"
/dev/mmcblk0p1: SEC_TYPE="msdos" LABEL="BPI-BOOT" UUID="4621-6220" TYPE="vfat" PARTUUID="000ac9e8-01"
/dev/mmcblk0p2: LABEL="BPI-ROOT" UUID="c551b64c-2f93-4c4c-b35b-5b1680f8a207" TYPE="ext4" PARTUUID="000ac9e8-02"

 

 

 

 

 

 

Great

eW

 

#tkaiser

have you this  (Semi_Armbian_5.07_M3) like minimal?  Without X? Thx. (ich putze nich gerne :P  )

Link to comment
Share on other sites

I use "Semi_Armbian_5.07_M3", how can I mount blank SD? 

 

Do a web search for /devices/platform/sunxi-mmc.1/mmc_host how to get an SD card recognized after boot (I explained the whole stuff a few weeks here in another forum thread but forum search doesn't work). If you have an SD card inserted at boot the SoC will prefer that so you need still bootloader on the SD card even if rootfs is on the eMMC. It should work just the usual way by using nand-sata-install.sh to write all the stuff from SD card to eMMC but then not wiping out the whole SD card but simply using the former rootfs ext4 partition for data and leaving the first sectors of the card intact.

Link to comment
Share on other sites

I got it! :thumbup:

After boot from eMMC i plug SD and ... voila!   Effect as in "Android"











 

root@BananaPiM3:~ # dmesg | tail
[  155.365740] mmc1: new high speed SDHC card at address 59b4
[  155.372439] mmcblk1: mmc1:59b4 USD00 29.5 GiB
[  155.378893]  mmcblk1: p1 p2
[  155.382764] *******************sd init ok*******************  

 

root@BananaPiM3:~ # cat /proc/partitions
major minor  #blocks  name

 179        0    7634944 mmcblk0
 179        1     262144 mmcblk0p1
 179        2    7270400 mmcblk0p2
 179       32       4096 mmcblk0boot1
 179       16       4096 mmcblk0boot0
 179       48   30981120 mmcblk1
 179       49      51200 mmcblk1p1
 179       50   30827520 mmcblk1p2

 

 

 

 

 

 

 // Clone BPI-M3-bsp //

Edit the file sys_config.fex
/BPI-M3-bsp/sunxi-pack/chips/sun8iw6p1/configs/BPI_M3_1080P/sys_config.fex
 

I use HDMI-1080P, for other Resolution or Video Output must chage the path /BPI_M3_1080P/

 

Edit sys_config.fex:  aud look for [mmc0_para]

 

 

 

.
.
.
.
. ...

;--------------------------------------------------------------------------------
;   SDMMC PINS MAPPING                                                          |
; ------------------------------------------------------------------------------|
;   Config Guide                                                                |
;   sdc_used: 1-enable card, 0-disable card                                     |
;   sdc_detmode: card detect mode                                               |
;                1-detect card by gpio polling                                  |
;                2-detect card by gpio irq(must use IO with irq function)       |
;                3-no detect, always in for boot card                           |
;                4-manually insert and remove by /proc/driver/sunxi-mmc.x/insert|
;   sdc_buswidth: card bus width, 1-1bit, 4-4bit, 8-8bit                        |
;   sdc_use_wp: 1-with write protect IO, 0-no write protect IO                  |
;   sdc_isio: for sdio card                                                     |
;   sdc_regulator: power control.if card supports UHS-I/DDR and HS200 timing for|
;                  SD3.0 or eMMC4.5, regulator must be configured. the value is |
;                  the ldo name of AXP221, eg: sdc_regulator = "axp22_eldo2"    |
;   other: GPIO Mapping configuration                                           |
; ------------------------------------------------------------------------------|
;   Note:                                                                       |
;   1 if detmode=2, sdc_det's config=6                                          |
;     else if detmode=1, sdc_det's config=0                                     |
;     else sdc_det IO is not necessary                                          |
;   2 if the customer wants to support UHS-I and HS200 features, he must provide|
;     an independent power supply for the card. This is only used in platforms  |
;     that supports SD3.0 cards and eMMC4.4+ flashes                            |
;--------------------------------------------------------------------------------
[mmc0_para]
sdc_used          = 1
sdc_detmode       = 3
sdc_buswidth      = 4
sdc_clk           = port:PF02<2><1><2><default>
sdc_cmd           = port:PF03<2><1><2><default>
sdc_d0            = port:PF01<2><1><2><default>
sdc_d1            = port:PF00<2><1><2><default>
sdc_d2            = port:PF05<2><1><2><default>
sdc_d3            = port:PF04<2><1><2><Default>
sdc_det           = port:PF06<0><1><2><default>
sdc_use_wp        = 0
sdc_wp            =
sdc_isio          = 0
sdc_regulator     = "none"
sdc_power_supply  = "vcc-card"
And the most important!
 

Change sdc_detmode from 3 to 1

 

 

After compile (BPI-M3-bsp)  boot from SD Card, flash eMMC with the  5 files ,

 

export card=/dev/mmcblk1

 

dd if=boot0_sdcard.fex of=${card} bs=1k seek=8
dd if=u-boot.fex of=${card} bs=1k seek=19096
dd if=sunxi_mbr.fex of=${card} bs=1k seek=20480
dd if=boot-resource.fex of=${card} bs=1k seek=36864
dd if=env.fex of=${card} bs=1k seek=69632
dd if=boot.fex of=${card} bs=1k seek=86016

 

Shutdown -h now, SD card out, boot fom eMMC, plug the SD inside and.....   Problem solved! :thumbup: 

 

Great

eW

 

 
Link to comment
Share on other sites

After compile (BPI-M3-bsp)  boot from SD Card, flash eMMC with the  5 files ,

 

export card=/dev/mmcblk1

 

dd if=boot0_sdcard.fex of=${card} bs=1k seek=8

dd if=u-boot.fex of=${card} bs=1k seek=19096

dd if=sunxi_mbr.fex of=${card} bs=1k seek=20480

dd if=boot-resource.fex of=${card} bs=1k seek=36864

dd if=env.fex of=${card} bs=1k seek=69632

dd if=boot.fex of=${card} bs=1k seek=86016

 

Nope, this shouldn't be necessary since even @sinovoip figured out how to read files in u-boot after one year. There is a small FAT partition where their u-boot script looks for uEnvt.txt in the following location there: bananapi/bpi-m3/linux/uEnv.txt. And you can also put script.bin there (bananapi/bpi-m3/linux/script.bin) so after such minor modifications it should be enough to use bin2fex/fex2bin to alter the contents there.

 

As a side note: I tried to outline what's necessary to use an inserted SD card at boot not for the rootfs (but instead use the faster eMMC for that and put any data on the ext4 partition of the SD card):

 

http://irclog.whitequark.org/linux-sunxi/2016-05-24#16549392;

 

The whole 'trick' is keeping the first MB of the SD card (containing bootloader, kernel and an initrd) and to edit uEnv.txt there to point to eMMC to be used for the rootfs. After this you can delete the contents of the ext4 partition on the SD card (but not destroy or alter partitions!) and to use it for any purpose you like (needs an entry in /etc/fstab on eMMC then and for device identifiers looking at /proc/partitions is a good idea).

Link to comment
Share on other sites

 
Nope ?
I have no such intention , that EVERY "SD Card " to prepare before placing it in the BpiM3 . I'm not active developer ( in the 90s I programmed in 'C' and assembler ) . As a normal user was looking for such a solution : I put the "SD Card " in the slot , and I want to see you through the operating system .
Links to chat on IRC are not for me to solve this problem - and for every normal USER (no developer) too. ;)
 
And by the way , in which of these five files , after compiling the sys_config.fex?
 
 
Link to comment
Share on other sites

And we can still boot from a inserted SD card, if there is somethings wrong with the eMMC?

 

Two options with Allwinner SoCs since boot priority on all known devices is 'SD card first, then eMMC'

  • the SD card gets ignored if there is no SPL signature found. In this case to be able to boot from SD card you would have to exchange SD card
  • the SD card contains a valid SPL signature (and at least u-boot). In this case the settings on SD card have to switch to eMMC for normal boots but you could setup things in a way that an alternative OS could be booted from SD card too

The 2nd approach with our current implementation (relying on device nodes and not UUIDs) is somewhat tricky/broken so better wait for fixes (relying on UUIDs and also needing some tweaks for u-boot installation postinstall script)

References:

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