Boot MMC card with or without SD card

Can i boot from MCC without SD card inserted?

Partition Map for MMC device 0  --   Partition Type: DOS

Part    Start Sector    Num Sectors     UUID            Type
  1     204800          524288          000ed6cd-01     0c
  2     729088          12288000        000ed6cd-02     83
mmc0 is available
Interface:  MMC
  Device 0: Vendor: Man 000000 Snr 00000000 Rev: 0.0 Prod: 
            Type: Removable Hard Disk
            Capacity: not available
Filesystem: FAT16 "NO NAME    "
Boot from SD
reading bananapi/bpi-r2/linux/uEnv.txt
771 bytes read in 5 ms (150.4 KiB/s)
Loaded environment from uEnv.txt
Banana Pi bpi-r2 chip: mt7623n Service: linux
reading bananapi/bpi-r2/linux/uImage
6170489 bytes read in 380 ms (15.5 MiB/s)
reading bananapi/berryboot.img
** Unable to read file bananapi/berryboot.img **
bootm flag=0, states=70f
## Booting kernel from Legacy Image at 84000000 ...
   Image Name:   Linux Kernel 4.14.26-main
   Image Type:   ARM Linux Kernel Image (uncompressed)
   Data Size:    6170425 Bytes = 5.9 MiB
   Load Address: 80008000
   Entry Point:  80008000
   Verifying Checksum ... OK
   Loading Kernel Image ... OK

Starting kernel ...

[    1.685916] mmc1: new high speed MMC card at address 0001
[    1.691799] mmcblk1: mmc1:0001 8WPD3R 7.28 GiB 
[    1.696491] mmcblk1boot0: mmc1:0001 8WPD3R partition 1 4.00 MiB
[    1.702593] mmcblk1boot1: mmc1:0001 8WPD3R partition 2 4.00 MiB
[    1.708656] mmcblk1rpmb: mmc1:0001 8WPD3R partition 3 512 KiB
[    1.715356]  mmcblk1: p1 p2
...
[    3.262838] EXT4-fs (mmcblk1p2): INFO: recovery required on readonly filesystem
[    3.270107] EXT4-fs (mmcblk1p2): write access will be enabled during recovery
[    3.285369] EXT4-fs (mmcblk1p2): recovery complete
[    3.290936] EXT4-fs (mmcblk1p2): mounted filesystem with ordered data mode. Opts: (null)
[    3.299014] VFS: Mounted root (ext4 filesystem) readonly on device 179:2.
[    3.306345] devtmpfs: error mounting -2
[    3.313510] Freeing unused kernel memory: 1024K
[    3.322240] Starting init: /etc/init exists but couldn't execute it (error -13)
/bin/sh: 0: can't access tty; job control turned off
# 

without SD card inseted

Partition Map for MMC device 1  --   Partition Type: DOS

Part    Start Sector    Num Sectors     UUID            Type
  1     204800          524288          000ed6cd-01     0c
  2     729088          12288000        000ed6cd-02     83
mmc1 is available
Interface:  MMC
  Device 1: Vendor: Man 000003 Snr 223bf601 Rev: 2.2 Prod: SC32G?
            Type: Removable Hard Disk
            Capacity: 30436.5 MB = 29.7 GB (62333952 x 512)
Filesystem: FAT16 "BPI-BOOT   "
Boot from SD
reading bananapi/bpi-r2/linux/uEnv.txt
771 bytes read in 7 ms (107.4 KiB/s)
Loaded environment from uEnv.txt
Banana Pi bpi-r2 chip: mt7623n Service: linux
reading bananapi/bpi-r2/linux/uImage
6170833 bytes read in 790 ms (7.4 MiB/s)
reading bananapi/berryboot.img
** Unable to read file bananapi/berryboot.img **
bootm flag=0, states=70f
## Booting kernel from Legacy Image at 84000000 ...
   Image Name:   Linux Kernel 4.14.23-main
   Image Type:   ARM Linux Kernel Image (uncompressed)
   Data Size:    6170769 Bytes = 5.9 MiB
   Load Address: 80008000
   Entry Point:  80008000
   Verifying Checksum ... OK
   Loading Kernel Image ... OK

Starting kernel ...

[    1.685812] mmc1: new high speed MMC card at address 0001
[    1.691719] mmcblk1: mmc1:0001 8WPD3R 7.28 GiB 
[    1.696426] mmcblk1boot0: mmc1:0001 8WPD3R partition 1 4.00 MiB
[    1.702512] mmcblk1boot1: mmc1:0001 8WPD3R partition 2 4.00 MiB
[    1.708571] mmcblk1rpmb: mmc1:0001 8WPD3R partition 3 512 KiB
[    1.715307]  mmcblk1: p1 p2
...
[    3.280809] EXT4-fs (mmcblk1p2): mounted filesystem with ordered data mode. Opts: (null)
[    3.288896] VFS: Mounted root (ext4 filesystem) readonly on device 179:10.
[    3.296257] devtmpfs: error mounting -2
[    3.303421] Freeing unused kernel memory: 1024K
[    3.312174] Starting init: /etc/init exists but couldn't execute it (error -13)
/bin/sh: 0: can't access tty; job control turned off
# 


where <SD>/boot/bananapi/bpi-r2/linux/uEnv.txt with root=/dev/mmcblk0p2

where <MMC>/boot/bananapi/bpi-r2/linux/uEnv.txt with root=/dev/mmcblk1p2

You mean booting emmc without sd-card? Yes…simply follow steps here: http://www.fw-web.de/dokuwiki/doku.php?id=en:bpi-r2:storage#install_os_on_emmc

I have booted debian stretch from emmc…

mmcblk1 is your emmc…you have to modify root in uenv.txt on your boot-partition from emmc

What os have you on mmcblk1p2? Maybe you have to change mountpoints there too

As i see,kernel gets loaded, mount of root+boot works but failed on devtmpfs…is a /dev-folder there?

This is my issue, i follow your wiki and when i doo from the emmc kernel does not seem to find the root device.

where <SD>/boot/bananapi/bpi-r2/linux/uEnv.txt with root=/dev/mmcblk0p2

where <MMC>/boot/bananapi/bpi-r2/linux/uEnv.txt with root=/dev/mmcblk1p2

Not sure how to debug and find the correct device.

Have you anything on your root-device?

mount /dev/mmcblk1p2 /mnt/emmc/root
ls /mnt/emmc/root
# lsblk 
NAME         MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT
sda            8:0    0 447.1G  0 disk 
└─sda1         8:1    0 447.1G  0 part /mnt/sda
sdb            8:16   0 447.1G  0 disk 
└─sdb1         8:17   0 447.1G  0 part /mnt/sdb
mmcblk0      179:0    0  29.7G  0 disk 
├─mmcblk0p1  179:1    0   256M  0 part /boot
└─mmcblk0p2  179:2    0   5.9G  0 part /
mmcblk1      179:8    0   7.3G  0 disk 
├─mmcblk1p1  179:9    0   256M  0 part /mnt/emmc/boot
└─mmcblk1p2  179:10   0   5.9G  0 part /mnt/emmc/root
mmcblk1boot0 179:16   0     4M  1 disk 
mmcblk1boot1 179:24   0     4M  1 disk 
mmcblk1rpmb  179:32   0   512K  0 disk 
root@bpi-r2:~# ll /mnt/emmc/boot
total 8
drwxr-xr-x 3 root root 4096 Jan  7 00:32 bananapi
-rwxr-xr-x 1 root root    0 Mar  2 12:34 mmc
-rwxr-xr-x 1 root root  366 Jan  7 00:32 _uEnv.txt
root@bpi-r2:~# ll /mnt/emmc/boot/
bananapi/  mmc        _uEnv.txt  
root@bpi-r2:~# ll /mnt/emmc/boot/bananapi/bpi-r2/linux/
total 31528
-rwxr-xr-x 1 root root     771 Mar  2 12:31 uEnv.txt
-rwxr-xr-x 1 root root     771 Jan  7 00:32 uEnv.txt~
-rwxr-xr-x 1 root root 6170489 Mar 12 09:14 uImage
-rwxr-xr-x 1 root root 5698801 Jan  7 00:32 uImage_4.14.10-00042
-rwxr-xr-x 1 root root 5936217 Jan  7 00:32 uImage_4.14.12-main-00045
-rwxr-xr-x 1 root root 6170489 Mar 12 09:14 uImage_4.14.26-main-02704-g192e093549dc
-rwxr-xr-x 1 root root 8290082 Jan  7 00:32 uImage_4.4.70
root@bpi-r2:~# cat /mnt/emmc/boot/_uEnv.txt | grep root
root=/dev/mmcblk0p2
# cat /mnt/emmc/boot/bananapi/bpi-r2/linux/uEnv.txt | grep root                                                                                                                             
#root=/dev/ram
root=/dev/mmcblk1p2 rootfstype=ext4 rootwait
abootargs=setenv bootargs board=${board} console=${console} root=${root} service=${service} ${bootopts}

ls /mnt/emmc/root not boot :grinning:

btw. /mnt/emmc/boot/bananapi/bpi-r2/linux/uEnv.txt will be used…your config on boot seems right

I have also uploaded my basic debian-stretch for emmc to gdrive. Make sure you have changed mounts in /etc/fstab when copy rootfs from sdcard

# ll /mnt/emmc/root
total 88
drwxr-xr-x  2 root root  4096 Jan  5 19:12 bin
drwxr-xr-x  4 root root  4096 Mar 12 20:41 boot
drwxr-xr-x 70 1000 1000  4096 Mar  2 12:32 etc
drwxr-xr-x  2 root root  4096 Nov 19 16:25 home
drwxr-xr-x 14 1000 1000  4096 Jan  6 05:12 lib
drwx------  2 root root 16384 Jan  5 15:09 lost+found
drwxr-xr-x  2 root root  4096 Jan  4 15:51 media
-rw-r--r--  1 root root     0 Mar  2 12:34 mmc
drwxr-xr-x  7 root root  4096 Mar  2 12:34 mnt
drwx------  2 root root  4096 Jan  7 10:31 opt
dr-x------  2 root root  4096 Jan  7 10:31 proc
drwx------  2 root root  4096 Jan  7 10:31 root
drwx------  2 root root  4096 Jan  7 10:31 run
drwx------  2 root root  4096 Jan  7 10:31 sbin
drwx------  2 root root  4096 Jan  7 10:31 srv
dr-x------  2 root root  4096 Jan  7 10:31 sys
drwx------  2 root root  4096 Jan  7 10:31 system
drwx------  2 root root  4096 Jan  7 10:31 tmp
drwx------  2 root root  4096 Jan  7 10:31 usr
drwx------  2 root root  4096 Jan  7 10:31 var

Can you post your /mnt/emmc/root/etc/fstab? change owner of /mnt/emmc/root/lib to root

# ll /mnt/emmc/root/
total 88
drwxr-xr-x  2 root root  4096 Jan  5 19:12 bin
drwxr-xr-x  4 root root  4096 Mar 12 20:41 boot
drwxr-xr-x 70 root root  4096 Mar  2 12:32 etc
drwxr-xr-x  2 root root  4096 Nov 19 16:25 home
drwxr-xr-x 14 root root  4096 Jan  6 05:12 lib
drwx------  2 root root 16384 Jan  5 15:09 lost+found
drwxr-xr-x  2 root root  4096 Jan  4 15:51 media
-rw-r--r--  1 root root     0 Mar  2 12:34 mmc
drwxr-xr-x  7 root root  4096 Mar  2 12:34 mnt
drwx------  2 root root  4096 Jan  7 10:31 opt
dr-x------  2 root root  4096 Jan  7 10:31 proc
drwx------  2 root root  4096 Jan  7 10:31 root
drwx------  2 root root  4096 Jan  7 10:31 run
drwx------  2 root root  4096 Jan  7 10:31 sbin
drwx------  2 root root  4096 Jan  7 10:31 srv
dr-x------  2 root root  4096 Jan  7 10:31 sys
drwx------  2 root root  4096 Jan  7 10:31 system
drwx------  2 root root  4096 Jan  7 10:31 tmp
drwx------  2 root root  4096 Jan  7 10:31 usr
drwx------  2 root root  4096 Jan  7 10:31 var
# cat /mnt/emmc/root/etc/fstab
# <file system>     <dir>       <type>  <options>       <dump>  <pass>
# MMC Card
/dev/mmcblk1p1      /boot       vfat    errors=remount-ro   0       1
/dev/mmcblk1p2      /           ext4    defaults,errors=remount-ro        0       1

# EMMC
#/dev/mmcblk1p1      /mnt/emmc/boot  vfat    errors=remount-ro                0       1
#/dev/mmcblk1p2      /mnt/emmc/root  ext4    defaults,noatime,errors=remount-ro       0       1

# SATA disk
/dev/sda1	/mnt/sda/	ext4	defaults	0	0
/dev/sdb1	/mnt/sdb/	ext4	defaults	0	0

Still not boots? Have you done recursive chown (-R) of lib?

is /mnt/emmc/root/dev empty? make sure it is…

Still the same issue, not sure how to debug.

Partition Map for MMC device 0  --   Partition Type: DOS

Part    Start Sector    Num Sectors     UUID            Type
  1     204800          524288          000ed6cd-01     0c
  2     729088          12288000        000ed6cd-02     83
mmc0 is available
reading bananapi/bpi-r2/linux/uEnv.txt
771 bytes read in 5 ms (150.4 KiB/s)
Loaded environment from uEnv.txt
Banana Pi bpi-r2 chip: mt7623n Service: linux
reading bananapi/bpi-r2/linux/uImage
6170489 bytes read in 379 ms (15.5 MiB/s)
reading bananapi/berryboot.img
** Unable to read file bananapi/berryboot.img **
bootm flag=0, states=70f
## Booting kernel from Legacy Image at 84000000 ...
   Image Name:   Linux Kernel 4.14.26-main
   Image Type:   ARM Linux Kernel Image (uncompressed)
   Data Size:    6170425 Bytes = 5.9 MiB
   Load Address: 80008000
   Entry Point:  80008000
   Verifying Checksum ... OK
   Loading Kernel Image ... OK

Starting kernel ...

[    1.725767] mmc1: new high speed MMC card at address 0001
[    1.731653] mmcblk1: mmc1:0001 8WPD3R 7.28 GiB 
[    1.736347] mmcblk1boot0: mmc1:0001 8WPD3R partition 1 4.00 MiB
[    1.742429] mmcblk1boot1: mmc1:0001 8WPD3R partition 2 4.00 MiB
[    1.748511] mmcblk1rpmb: mmc1:0001 8WPD3R partition 3 512 KiB
[    1.755305]  mmcblk1: p1 p2
...
[    3.280747] EXT4-fs (mmcblk1p2): mounted filesystem with ordered data mode. Opts: (null)
[    3.288835] VFS: Mounted root (ext4 filesystem) readonly on device 179:2.
[    3.296187] devtmpfs: error mounting -2
[    3.303356] Freeing unused kernel memory: 1024K
[    3.312093] Starting init: /etc/init exists but couldn't execute it (error -13)
/bin/sh: 0: can't access tty; job control turned off
# 

now i see that rootfs seems to be mounted readonly (179:2 is mmcblk0p2 in you list above, but line in log before shows right part…)…strange. can you try my emmc-stretch-image?

https://drive.google.com/open?id=1oP7jy1KrrIOifvImo2nQ59wx3_9hHkgk

simply i did the steps in my wiki

  • changed emmc-partition-config (0x48)
  • flash preloader to boot0
  • create partition-layout on mmcblk1 (via export from sd like the file i appended to my wiki)
  • create filesystem on booth partitions (p1=vfat,p2=ext4)
  • copy content of sd-boot-partition
  • changed uenv.txt (root=mmcblk1p2)
  • unpacked my bootstrapped debian to root
  • changed fstab to point to mmcblk1 instead of mmcblk0
  • unpacked kernel to boot/root
1 Like

from some reason it does work with your image. what is the root passwd? I will start from scratch as i mus have miss something.

Same as in other images “bananapi”

from where do you have copied your previous rootfs?

I installed the system from the SDCard with debbootstrap, i guess the /proc got messup.

Some dirs must be empty,else mount will fail…

Imho /dev, /proc, /sys

re-install my own system all good now, thanks!

# rsync -aAXv --exclude={"/dev/*","/proc/*","/sys/*","/tmp/*","/run/*","/mnt/*","/media/*","/lost+found","/boot/*"} / /mnt/emmc/root/

Ok, another way should be using tar with --one-file-system to pack existing system without mounted filesystems