BPI-R2 new Image:Ubuntu-16.04-mate-desktop-bpi-r2-sd-emmc-v1.2.0.img.zip 2017-09-04

I`m trying to make Ubuntu booting from EMMC. I follow steps on how to copy Ubuntu image to EMMC here: https://bananapi.gitbooks.io/banana-pi-bpi-r2-open-source-smart-router/content/linux-image.html. But I cannot copy the image to EMMC because of not enough space there.

root@bpi-iot-ros-ai:/home/pi# bpi-copy /media/pi/Flash/2017-09-04-ubuntu-16.04-mate-desktop-bpi-r2-sd-emmc-v1.2.0.img.zip 
bpi-copy(v1.2.1(github)), bananapi image & disk tools

Usage: bpi-copy [OPTIONS]...
       bpi-copy [ --help | -v | --version ]
       bpi-copy IMGFILE
       bpi-copy IMGDIR
       bpi-copy IMGFILE DEVICE
       bpi-copy DEVICE IMGFILE

Warning: Try to write /media/pi/Flash/2017-09-04-ubuntu-16.04-mate-desktop-bpi-r2-sd-emmc-v1.2.0.img.zip to BOOTDISK /dev/mmcblk1
Mon Oct 16 04:21:52 CST 2017
*** start COPY (blue led on ) .....
INFO: /dev/mmcblk1 : SD/eMMC !!
umount device: /dev/mmcblk1
dd: error writing '/dev/mmcblk1': No space left on device                      ]
7.28GiB 0:18:40 [6.65MiB/s] [                   <=>                            ]
0+66932 records in
0+66931 records out
***  end  COPY (blue led off) .....
Mon Oct 16 04:40:43 CST 2017
OK!! You can remove the BOOTDISK /dev/mmcblk1 now!!

Any idea how to resolve that?

BTW: No blue LED is on during copy process.


Can you please try it with a 16GB SD card?

@garywang the emmc is fixed to 8GB :wink: so the image is to large for emmc

maybe you can resize the image like that: https://softwarebakery.com/shrinking-images-on-linux

@frank-w, yeah exactly. In fact I was not sure why @garywang advised me to use larger SD card when I try to write image to emmc. It is interesting that the same image fits fine to 8GB SD card but not to 8GB emmc. Actually only 7.28GB fits there. Couldn’t it be because I have already LEDE written to emmc? But I suppose it should be overwritten when writing new image. Or am I wrong? Should I somehow erase emmc before writing new image there? If so, how?

BTW thank you for pointing me at image shrinking. But I’m not sure if it would help me because, if I remember well, there is only approx. 0.4GB unused space on 8GB SD card after writing image there. But approx. 0.7GB is missing for writing the same image to emmc right now.

hi, don’t know the structure of emmc…but lede should be overridden by the new image. maybe you cannot write emmc beginning at “block 0”

as my advice, try to shrink the image (~200MB free space on root-Partition) and try again writing it to emmc

remeber 8G are not 8GB in storage hardware due to different calculations…https://en.wikipedia.org/wiki/Byte (decimal vs. binary)

Thank you for the image shrinking advise. It does the trick. Now I finally boot Ubuntu from emmc! I already know why the original 8GB image doesn’t fit into 8GB emmc. It is because there is 250MB large boot partition on emmc which is used for booting instead of the boot partition on the image I suppose. For writing image to emmc there is roughly only 7.3GB of space available. Maybe except of shrinking the image the boot partition it contains could be removed (or shrinked to almost zero size) as well. Just an idea, not tested yet.

Anyway one should add the shrinking advise into the steps on how to setup booting from emmc here: https://bananapi.gitbooks.io/banana-pi-bpi-r2-open-source-smart-router/content/linux-image.html. Or even better to make the image smaller…:wink:

Don’t you write full sd to full emmc,only root-partition?

I see dd above writes to mmcblk1,so the full emmc…partition-layout should be same as sd

Don’t you write full sd to full emmc,only root-partition?

Hmm, yes I do. I write full SD to emmc. I follow the instruction on the referenced page. Step 5 says:

5. bpi-copy /path_to_your_image/xxx.img.zip

So I so with the image that is provided on the same page… I’m sorry if I’m missing something, but there is clearly no evidence that it has to be customised image with the root partition only.:confused:

I see dd above writes to mmcblk1,so the full emmc…partition-layout should be same as sd

Yes, it was also my initial understanding that it overwrites the whole emmc with the whole SD image and preserved its structure (ie. partitions in SD image). But in the preceding step (hope already existing) emmc boot partition /dev/mmcblk1boot0 is written with the BPI-R2-EMMC-boot0-0k.img image. And this boot partition takes some 250MB from 8GB emmc. Therefore 8GB SD image could never fit in the remaining space.

writing a larger boot-partition needs to move root-partition.where do you have the info about boot-0k.img? => OK, Step 4 in manual behind your link “bpi-bootsel BPI-R2-EMMC-boot0-0k.img.gz /dev/mmcblk1boot0 #write once” but this is done before bpi-copy which semms to overwrite that previous bootloader. https://github.com/BPI-SINOVOIP/bpi-tools/blob/master/bpi-copy from line 311

Out of space error occours in first step (full image write). I assume that emmc is only a bit smaller than sd-image. you write direct on the pi,right? Where lies the image? You must have space for the zip on sdcard…extraction should be done direct to dd (without needing disc space).

Making the images smaller is much more work, but that prevents errors like that and reduce downloadsize and disk-space. Also on my debian image there are kernels for different devices and some old logs (full syslog from other devices).

  • unused data (other kernels,modules for other devices) can be deleted if image is only for one device.

  • personal data (users/login,homedir-content) must be cleaned

  • logs should be cleared (echo -n “”>logfile to preserve rights)

  • tmp/cache,backup-files cleared

  • free space should be overwritten by 0-bytes (no restore and better packing)

All can be done in img-file mounted as loop-device

It’s not so easy to create a public image :slight_smile:

Yes, I write directly on BPI and have the image on USB flash.

It seems you are right that bpi-copy overwrites the whole emmc. Below is the comparison of the shrinked image file structure (first pic) with the emmc structure (second pic) after writing that image with bpi-copy into it.

Structures are the same. Then I really don’t understand why my first attempt on writing the original (not shrinked) 8GB image failed because out of space error as soon as only some 7.3GB has been written. At that point there still had to be some 0.7GB space available on emmc. And I also don’t understand why bpi-bootsel step nr. 4 has to be done when the next bpi-copy step overwrites what it does. Strange…

But never mind. Thanks to you I can shrink image and write it on emmc when I need.


you can look at devices size (windowtitle in your screenshots or fdisk-command)…i think emmc is a bit smaller than sd.

Frank, you are right. EMMC is really smaller than the original SD image 2017-09-04-ubuntu-16.04-mate-desktop-bpi-r2-sd-emmc-v1.2.0.img (not shrinked). Even more I compared it with the previous Ubuntu Mate image and with Raspbian image too. All these are the same size as emmc! See the sizes below:

emmc									7818182656 bytes
2017-09-04-ubuntu-16.04-mate-desktop-bpi-r2-sd-emmc-v1.2.0.img		7948206080 bytes
2017-08-01-ubuntu-16.04-mate-desktop-preview2-bpi-r2-sd-emmc.img	7818182656 bytes
2017-09-14-raspbian-stretch-preview-bpi-r2-sd-emmc.img			7818182656 bytes

So only the image I intended to write into emmc cannot fit there… But I already know how to shrink it so no problem anymore.

Will this work onthe Latest version of R2? I tried to boot it but it is getting stuck as root password for maintenance and when I enter root password then it logs me in to the boot and not the os itself. It also says press Control + D to continue and when I press that it gets stuck. Anyone ?

I never tested this image but according to first post of this thread you might have encountered one of the known limitations

  1. Sometimes Linux kernel 4.4.70 can’t boot successfully

Why not install Desktop Environment in my 18.4 image?

Yes i guess.

Coz DE is just for testing and I only have 1 sd so once 1 format it, it will be lost. That’s why I tried to use a ready img so i don’t have to download the DE every time.
Just trying to save on some data.

You could mount imagefile with losetup+partptobe+mount+chroot and install DE direct to image :slight_smile:

But maybe on ubuntu-image you need to update kernel too (imho used 4.14 has no hdmi yet…was ported later)

Hello, I think your ubuntu buster img doesn’t have meson enabled in kernel? To support gpu?

No,only hdmi without gpu

because i have no info about getting lima/mesa working at the Moment

1 Like

Lima/mesa was merged recently but Ihave been use meson drm for amlogic soc with mali gpu. So most graphical work was handled by gpu except for the video playback which is done by vpu.

I have been able to get arch linux ready will try to boot it tomorrow, but I think I will have to recompile the kernel with different config. Will follow your branch on git i think 4.19 or maybe 5.3.