bananapi-zero-ubuntu-base-minimal icon indicating copy to clipboard operation
bananapi-zero-ubuntu-base-minimal copied to clipboard

Emmc

Open mariusares opened this issue 5 years ago • 84 comments

Hi First of all thank you for your great work. It's like a nice surprise ...

I have installed the bare ubuntu with kernel 14.7 from : https://mega.nz/#!obIAVQiA!G0CCABkLunCcG8hEqMf7NfjTBK1jgMytt2f0VdtOl08 I can't see the emmc on fdisk ... Do you recommend a different kernel version? Is any chance to have a bare debian 10 os with a stable kernel too? I mean on debian/Raspbian you have 2 kernels. Version 3 what runs ok and smoothie but is no AP network mode compatible and Version 4,4 where load average is pretty high (over 1 on idle) For those who use i2c, gpio, spi, serial and wifi ap mode, a bare system is great. Thank you for your time

mariusares avatar Jul 01 '20 23:07 mariusares

I can't see the emmc on fdisk ... A: BananaPi M2Z does not have eMMC!

Do you recommend a different kernel version? A: Scroll down the github page and you see the kernel history and new kernel versions, personally i like the kernel 5.3 and 5.7. Kernel 5.3 has great CPU Temp management and performance, Kernel 5.7 has a lot of bug fixes and it is maintained by the Linux community.

Is any chance to have a bare debian 10 A: Sorry, i am an Ubuntu user but would like to move to Debian, it can happen soon or take years. The idea behind this Image is to have a CLI (Command Line Interface and minimal) with few installed packages, M2Z has 512 MB of DRAM, users will not be pleased to run a Full Desktop, yet it is possible. You can install LXDE or try Armbian.

Start with this IMG and upgrade the kernel to 5.7: https://github.com/avafinger/bananapi-zero-ubuntu-base-minimal/releases/tag/v2.4

Upgrade Kernel: https://github.com/avafinger/bananapi-zero-ubuntu-base-minimal/releases/tag/v3.7

Kernel and some IMG releases: https://github.com/avafinger/bananapi-zero-ubuntu-base-minimal/releases

avafinger avatar Jul 02 '20 00:07 avafinger

I understand, i chose banana pi over raspberry pi because rpi won't implement eMmc on their boards anytime soon, but it's so poor on software support. Thanks to people like you who color a bit that side of the room :) I'll try to get your kernel sources to compile them in a debian system ... When I'll get some time to be honest ...

mariusares avatar Jul 02 '20 00:07 mariusares

This board has eMMC but the layout is a bit different: http://www.banana-pi.org/m2pz.html

avafinger avatar Jul 02 '20 00:07 avafinger

This is the board i have right now Si basically you are suggesting to upgrade the os image from Ubuntu 16.4 to ubuntu 19.* and kernel 5.7 I understand that Ubuntu 16.4 it's LTS correct? Can I use the kernel 5.7 and configuration on Ubuntu 16.4? I probably look stupid but i cant find the download links :) Thank you

mariusares avatar Jul 02 '20 01:07 mariusares

I got the links Sorry I'm on mobile so ...

mariusares avatar Jul 02 '20 01:07 mariusares

Ubuntu 19.10

avafinger avatar Jul 02 '20 01:07 avafinger

Ubuntu 19.10 - Eoan Ermine with Kernel 5.3.5

avafinger avatar Jul 02 '20 01:07 avafinger

Can I use the kernel 5.7 and configuration on Ubuntu 16.4? yes, i think it is possible, but the deb package will install the modules in /usr/lib/modules and i think Ubuntu 16.04 LTS has it in /lib/modules

If after you boot and you don't see the modules with lsmod you will have to move /usr/lib/modules/KERNEL_VERSION to /lib/modules/

If this happens you won't be able to ssh to the board and will need to use HDM or the serial debug

avafinger avatar Jul 02 '20 01:07 avafinger

I'll give it a try. What I need is Gpio, uart, i2c , spi , eth, wlan+ap mode and stability ... Let me install it and I'll get back to you Thank you

mariusares avatar Jul 02 '20 01:07 mariusares

ok so kernel 5.3 and 5.7 only detects /dev/mmcblk0 ... there is no way to detect eMMC for some reason any clue please? U-Boot SPL 2017.09-h2 (Jul 06 2018 - 10:16:12) DRAM: 512 MiB Trying to boot from MMC2 MMC Device 1 not found spl: could not find mmc device. error: -19 SPL: failed to boot from all boot devices

ERROR ### Please RESET the board

This is with the image flashed on eMMC ... works on sd card but not on eMMC ...

mariusares avatar Jul 02 '20 14:07 mariusares

Try this:

1 - Update u-boot (only the bootloader) from this tag: https://github.com/avafinger/bananapi-zero-ubuntu-base-minimal/releases/tag/v1.7

2 - make sure eMMC is active https://github.com/avafinger/bananapi-zero-ubuntu-base-minimal/issues/18

3 - Make sure the root device is correct for eMMC, change it in /boot/boot.cmd

avafinger avatar Jul 02 '20 15:07 avafinger

there is no /dev/sd* ... dd if=./bootloader_2z_v3.bin conv=notrunc bs=1k seek=8 of=/dev/mmcblk0p1 so /dev/mmcblk0p1 is the /boot sd card partition ... is that OK?

mariusares avatar Jul 02 '20 16:07 mariusares

/dev/sd* is for USB SDHC reader/writer (if you connect to a PC box running Linux) /dev/mmcblk0p1 that is OK if you do from M2Z

avafinger avatar Jul 02 '20 17:07 avafinger

i did this : https://github.com/avafinger/bananapi-zero-ubuntu-base-minimal/issues/11#issuecomment-461130750 basically i can see the eMMC now but i cant boot from eMMC ... do you have the kernel+kernel config able to boot from eMMC or we have to do that manually? im on Ubuntu 19.10 now with kernel 5.3 ... root@bpi-m2z:~# uname -a Linux bpi-m2z 5.3.5 #1 SMP Mon Oct 7 21:22:23 -03 2019 armv7l armv7l armv7l GNU/Linux root@bpi-m2z:~# fdisk -l Disk /dev/mmcblk0: 29.29 GiB, 31439454208 bytes, 61405184 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: 0x2474af91

Device Boot Start End Sectors Size Id Type /dev/mmcblk0p1 49152 253951 204800 100M 83 Linux /dev/mmcblk0p2 253952 15777791 15523840 7.4G 83 Linux

Disk /dev/mmcblk2: 7.29 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: 0x2474af91

Device Boot Start End Sectors Size Id Type /dev/mmcblk2p1 49152 253951 204800 100M 83 Linux /dev/mmcblk2p2 253952 15777791 15523840 7.4G 83 Linux root@bpi-m2z:~#

mariusares avatar Jul 02 '20 18:07 mariusares

i`m trying to change some settings here

setup boot_device

fdt set mmc${boot_mmc} boot_device <2>

and i get the same result on boot U-Boot SPL 2017.09-h2 (Jul 06 2018 - 10:16:12) DRAM: 512 MiB Trying to boot from MMC2 MMC Device 1 not found spl: could not find mmc device. error: -19 SPL: failed to boot from all boot devices

ERROR ### Please RESET the board

mariusares avatar Jul 02 '20 18:07 mariusares

There is no boot.cmd ... I'll try to decompile boot.scr and edit it in order to take action ... Let's see the result ...

mariusares avatar Jul 02 '20 18:07 mariusares

boot.cmd.tar.gz

to be able to boot from eMMC you have to format it and copy the bootloader, boot, and rootfs. There is a script that does that, search the releases and find the latest and instead of passing /dev/sdX you will pass /dev/mmcblkY

avafinger avatar Jul 02 '20 20:07 avafinger

well is not working for me unfortunately ...

mariusares avatar Jul 02 '20 22:07 mariusares

Boot from SD card and see what you get with this command:

ls /dev/mmcblk*

avafinger avatar Jul 02 '20 22:07 avafinger

root@bpi-m2z:~# ls /dev/mmc* /dev/mmcblk0 /dev/mmcblk0p2 /dev/mmcblk2boot0 /dev/mmcblk2p1 /dev/mmcblk0p1 /dev/mmcblk2 /dev/mmcblk2boot1 /dev/mmcblk2p2 root@bpi-m2z:~# its strange ... the bootloader should read the sd card and emmc as well ...

mariusares avatar Jul 03 '20 08:07 mariusares

1 - when booting from SD CARD: /dev/mmcblk0 is your SD CARD /dev/mmcblk2 is your eMMC

2 - when booting without SD CARD

/dev/mmcblk? - It changes device number, you should figure out what number will be, possible 1.

3 - Update u-boot with: https://github.com/avafinger/bananapi-zero-ubuntu-base-minimal/releases/tag/v3.4

4 - Use this scripts to format and install kernel and rootfs and update bootloader with the new version: https://github.com/avafinger/bananapi-zero-ubuntu-base-minimal/releases/tag/v15

              sudo ./format_sd_mainline.sh  /dev/mmcblk2
              sudo ./flash_sdcard_mz2_v2.sh  /dev/mmcblk2

reboot without SD CARD, i think a debug ttl uart is indispensable

avafinger avatar Jul 03 '20 12:07 avafinger

try: fdt set mmc${boot_mmc} boot_device <boot_mmc>

avafinger avatar Jul 03 '20 12:07 avafinger

i`m controlling the board via uart ttl the image does not see emmc without modification the bootloader does not boot from emmc

https://github.com/avafinger/bananapi-zero-ubuntu-base-minimal/releases/tag/v3.4

fdisk -l: root@bpi-m2z:~# fdisk -l Disk /dev/mmcblk0: 29.29 GiB, 31439454208 bytes, 61405184 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: 0x2474af91

Device Boot Start End Sectors Size Id Type /dev/mmcblk0p1 49152 253951 204800 100M 83 Linux /dev/mmcblk0p2 253952 15777791 15523840 7.4G 83 Linux root@bpi-m2z:~#

still can`t see the emmc ... so i have to use

https://github.com/avafinger/bananapi-zero-ubuntu-base-minimal/issues/11#issuecomment-461130750 bpi-m2-zero-v4.dtb_eMMC.zip

with this dtb the emmc is /dev/mmcblk2 and i dont think that would be changed after that ... so ... i dont know what would be the resolution ...

mariusares avatar Jul 03 '20 15:07 mariusares

This DTB has eMMC enabled, try with this dtb. bpi-m2-zero-v4.dtb_emmc.tar.gz

  • unzip it into /boot
  • sudo ln -sf bpi-m2-zero-v4.dtb_emmc bpi-m2-zero-v4.dtb
  • sync && sudo reboot

This for kernel 5.7.x-server

avafinger avatar Jul 03 '20 16:07 avafinger

you mean this one? https://github.com/avafinger/bananapi-zero-ubuntu-base-minimal/releases/tag/v3.7

i can only see that 5.7 kernel but no "server" tag on it

mariusares avatar Jul 03 '20 16:07 mariusares

yes!

avafinger avatar Jul 03 '20 16:07 avafinger

this is output from sd-card boot root@bpi-m2z:~# fdisk -l && uname -a && ls -la /boot && cat /etc/issue* Disk /dev/mmcblk0: 29.3 GiB, 31439454208 bytes, 61405184 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: 0x58b49123

Device Boot Start End Sectors Size Id Type /dev/mmcblk0p1 49152 253951 204800 100M 83 Linux /dev/mmcblk0p2 253952 15532031 15278080 7.3G 83 Linux

Disk /dev/mmcblk2: 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: 0x58b49123

Device Boot Start End Sectors Size Id Type /dev/mmcblk2p1 49152 253951 204800 100M 83 Linux /dev/mmcblk2p2 253952 15532031 15278080 7.3G 83 Linux Linux bpi-m2z 5.7.6 #1 SMP Sun Jun 28 00:11:55 -03 2020 armv7l armv7l armv7l GNU/Linux total 12220 drwxrwxr-x 3 ubuntu ubuntu 4096 Jul 3 17:39 . drwxr-xr-x 21 root root 4096 Jan 15 2018 .. lrwxrwxrwx 1 root root 20 Jan 15 2018 boot.scr -> bpi-m2-zero_boot.scr -rw-r--r-- 1 root root 26886 Jul 6 2018 bpi-m2-zero-v1.dtb_4.17.4-m2z -rw-r--r-- 1 root root 27076 Jul 6 2018 bpi-m2-zero-v2.dtb_4.17.4-m2z -rw-r--r-- 1 root root 28817 Jun 28 04:30 bpi-m2-zero-v4.dtb_5.7.6 -rw-rw-r-- 1 ubuntu ubuntu 28813 Jul 3 16:15 bpi-m2-zero-v4.dtb_emmc lrwxrwxrwx 1 root root 23 Jul 3 17:39 bpi-m2-zero.dtb -> bpi-m2-zero-v4.dtb_emmc -rw-r--r-- 1 root root 924 Jul 6 2018 bpi-m2-zero_boot.cmd -rw-r--r-- 1 root root 996 Jul 6 2018 bpi-m2-zero_boot.scr -rw-rw-r-- 1 ubuntu ubuntu 978454 Jul 6 2018 initrd.img drwx------ 2 root root 16384 Nov 5 2017 lost+found lrwxrwxrwx 1 root root 12 Jul 3 17:34 zImage -> zImage_5.7.6 -rwxr-xr-x 1 root root 5376808 Jul 6 2018 zImage_4.17.4-m2z -rwxr-xr-x 1 root root 6000368 Jun 28 03:48 zImage_5.7.6 Ubuntu 16.04.4 LTS \n \l

Ubuntu 16.04.4 LTS root@bpi-m2z:~#

dd if=/dev/mmcblk0 of=/dev/mmcblk2 bs=10M status=progress then i removed the sd-card and boot from eMMC ... output:

U-Boot SPL 2020.04 (Apr 21 2020 - 14:52:45 +0000) DRAM: 512 MiB Trying to boot from MMC2 MMC Device 1 not found spl: could not find mmc device 1. error: -19 SPL: failed to boot from all boot devices

ERROR ### Please RESET the board

on Ubuntu 19.10 the same ... so that dtb has a problem by booting from emmc ...

mariusares avatar Jul 03 '20 17:07 mariusares

Who told you this instructions would work?

dd if=/dev/mmcblk0 of=/dev/mmcblk2 bs=10M status=progress then i removed the sd-card and boot from eMMC ...

avafinger avatar Jul 03 '20 18:07 avafinger

well how can i boot from eMMC ?

mariusares avatar Jul 03 '20 18:07 mariusares

Trying to boot from MMC2 MMC Device 1 not found

boot.cmd must tell the boot loader what device number eMMC is. If you boot with SD CARD, eMMC has ID number X, if you boot WITHOUT SDCARD eMMC has ID number Y.

I will release a new Kernel and will prepare the script for writing to eMMC and try to guess which ID number we can try. This takes some time, i am at work now.

Meanwhile, you can edit the boot.cmd (mount it booting with SD CARD) and recompile it to .scr, unmount it, and reboot. Try Device number 2

avafinger avatar Jul 03 '20 18:07 avafinger