How to flash ubuntucore image to emmc from sdcard

my problem is the title:how to flash ubuntucore image to emmc from sdcard,or is there a tool i can burn image directly to emmc on board


when i tried the method above,i get err like below.
i am confused ,snap got all its dependency.why there is still lack of so lib

morning2050@localhost:/mnt/usb_disk$ sudo godd if=./ftgw-snd.img of=/dev/mmcblk4
/snap/godd/18/bin/godd: error while loading shared libraries: cannot open shared object file: No such file or directory
morning2050@localhost:/mnt/usb_disk$ godd: error while loading shared libraries:

Thanks for this problemreport @molin2050! There is indeed a bug on the armhf architecture and the libraries are missing there. I’m fixing this and will let you know once there is a new version available.

Could you please snap refresh --edge godd and let me know if that fixes the issue?

morning2050@localhost:/$ sudo snap install --devmode --edge godd
error: cannot install “godd”: Post
dial tcp: lookup on [::1]:53: read udp
[::1]:46238->[::1]:53: read: connection refused
morning2050@localhost:/$ [ 1239.794051] sd 0:0:0:0: timing out command, waited 180s

morning2050@localhost:/$ snap info godd
error: no snap found for “godd”
morning2050@localhost:/$ snap info minicom
name: minicom
summary: Minicom is a friendly menu-driven serial communications program.
publisher: positronsecurity
license: unknown
description: |
This port is optimized for the Snap system. Unfortunately, it may not work
in strict mode on all platforms due to missing serial port support. In
case, try installing it in devmode.

Bug reports and development are tracked at:

  • minicom
    snap-id: vebSIQSI7l6gBJLcOPKStNQJwYvJSiIN
    tracking: stable
    refresh-date: today at 01:41 UTC
    installed: 2.7.1-1 (1) 360kB -

Hey @molin2050 - I’m not sure what is going on with your system that it cannot find godd.

However I managed to test this now on my pi2:

mvo@localhost:~$ snap info godd
name:      godd
summary:   godd is a nice dd replacement
publisher: canonical
description: |
  godd is a nice improvement over dd as it has nice progress bars and
  knows about target devices
snap-id:     63ZF0yuD6Oe3wAgm14KDXISLkczFtxE4
  stable:    –            
  candidate: –            
  beta:      –            
  edge:      0.6 (32) 1MB devmode
mvo@localhost:~$ sudo snap install --devmode --edge godd
Mount snap "godd" (32)                                                          Mount snap "godd" (32)                                                          Mount snap "godd" (32)                                                          godd (edge) 0.6 from 'canonical' installed
mvo@localhost:~$ godd
failed to dd: open : no such file or directory
mvo@localhost:~$ godd /etc/fstab /tmp/lala
 1.74 KiB / ? [------------------------------------------------=-----------] 0s
mvo@localhost:~$ uname -a
Linux localhost.localdomain 4.4.0-1030-raspi2 #37-Ubuntu SMP Thu Oct 20 15:06:25 UTC 2016 armv7l armv7l armv7l GNU/Linux

So the missing lib issue is fixed. Fwiw I am looking into how to archive the same goal without using libudev (parsing udevadm output maybe).

godd is ok now
when flash img to emmc,err goes like

U-Boot SPL 2017.05 (Aug 02 2018 - 16:48:43)
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

it seems something wrong with uboot?

Yes, this looks like something is wrong with uboot, maybe @ogra has some insight about this particular failure.

well, i’d need to see the gadget source for this, but it looks like your is not configured correctly for the MMC device or that the u-boot binary misses some feature to find the device.

some forum posts say that uboot2016 is ok while new one gets this err

this has nothing to do with the age of your source tree but with how it is configured …

your u-boot binary needs full support for the MMC controller built in to find the MMC and your in the gadget source needs to be set up to initialize the internal MMC and point all boot scripts to load kernel, dtb and initrd from there. if these defaults are properly set in your source it will work regardless which uboot version you use.

if you take a look at of the gadget source below:

you will see mmcdev and mmcpart that define the MMC boot device in this case (your variables might be called completely different so it is hard to tell what you need to do without seeing the source, but my guess is that you have at least an equivalent if even differently named variable there …)

as i said, it is hard to tell without seeing the source of your gadget but you will likely need changes along the lines above

below is my file, i can’t tell what difference is the key
boot_a_script=load ${devtype} ${devnum}:${distro_bootpart} ${scriptaddr} ${prefix}${script}; source ${scriptaddr}
boot_efi_binary=load ${devtype} ${devnum}:${distro_bootpart} ${kernel_addr_r} efi/boot/bootarm.efi; if fdt addr ${fdt_addr_r}; then bootefi ${kernel_addr_r} ${fdt_addr_r};else bootefi ${kernel_addr_r} ${fdtcontroladdr};fi
boot_extlinux=sysboot ${devtype} ${devnum}:${distro_bootpart} any ${scriptaddr} ${prefix}extlinux/extlinux.conf
boot_net_usb_start=usb start
boot_prefixes=/ /boot/
boot_scripts=boot.scr.uimg boot.scr
boot_targets=fel mmc0 usb0 pxe dhcp
bootcmd=run snappy_boot
bootcmd_dhcp=run boot_net_usb_start; if dhcp ${scriptaddr} ${boot_script_dhcp}; then source ${scriptaddr}; fi;setenv efi_fdtfile ${fdtfile}; if test -z “${fdtfile}” -a -n “${soc}”; then setenv efi_fdtfile ${soc}-${board}${boardver}.dtb; fi; setenv efi_old_vci ${bootp_vci};setenv efi_old_arch ${bootp_arch};setenv bootp_vci PXEClient:Arch:00010:UNDI:003000;setenv bootp_arch 0xa;if dhcp ${kernel_addr_r}; then tftpboot ${fdt_addr_r} dtb/${efi_fdtfile};if fdt addr ${fdt_addr_r}; then bootefi ${kernel_addr_r} ${fdt_addr_r}; else bootefi ${kernel_addr_r} ${fdtcontroladdr};fi;fi;setenv bootp_vci ${efi_old_vci};setenv bootp_arch ${efi_old_arch};setenv efi_fdtfile;setenv efi_old_arch;setenv efi_old_vci;
bootcmd_fel=if test -n ${fel_booted} && test -n ${fel_scriptaddr}; then echo ‘(FEL boot)’; source ${fel_scriptaddr}; fi
bootcmd_mmc0=setenv devnum 0; run mmc_boot
bootcmd_pxe=run boot_net_usb_start; dhcp; if pxe get; then pxe boot; fi
bootcmd_usb0=setenv devnum 0; run usb_boot
dfu_alt_info_ram=kernel ram 0x42000000 0x1000000;fdt ram 0x43000000 0x100000;ramdisk ram 0x43300000 0x4000000
distro_bootcmd=for target in ${boot_targets}; do run bootcmd_${target}; done
efi_dtb_prefixes=/ /dtb/ /dtb/current/
load_efi_dtb=load ${devtype} ${devnum}:${distro_bootpart} ${fdt_addr_r} ${prefix}${efi_fdtfile}
loadfdt=fatload mmc 0:1 ${fdt_addr} ${snap_kernel}/dtbs/${fdt_file}
loadfiles=run loadkernel; run loadinitrd; run loadfdt
loadinitrd=fatload mmc 0:1 ${ramdiskaddr} ${snap_kernel}/${initrd_file}; setenv initrd_size ${filesize}
loadkernel=fatload mmc 0:1 ${loadaddr} ${snap_kernel}/${kernel_file}
mmcargs=setenv bootargs “console=ttyS0,115200 console=tty0 root=${mmcroot}”
mmc_boot=if mmc dev ${devnum}; then setenv devtype mmc; run scan_dev_for_boot_part; fi
preboot=usb start
scan_dev_for_boot=echo Scanning ${devtype} ${devnum}:${distro_bootpart}…; for prefix in ${boot_prefixes}; do run scan_dev_for_extlinux; run scan_dev_for_scripts; done;run scan_dev_for_efi;
scan_dev_for_boot_part=part list ${devtype} ${devnum} -bootable devplist; env exists devplist || setenv devplist 1; for distro_bootpart in ${devplist}; do if fstype ${devtype} ${devnum}:${distro_bootpart} bootfstype; then run scan_dev_for_boot; fi; done
scan_dev_for_efi=setenv efi_fdtfile ${fdtfile}; if test -z “${fdtfile}” -a -n “${soc}”; then setenv efi_fdtfile ${soc}-${board}${boardver}.dtb; fi; for prefix in ${efi_dtb_prefixes}; do if test -e ${devtype} ${devnum}:${distro_bootpart} ${prefix}${efi_fdtfile}; then run load_efi_dtb; fi;done;if test -e ${devtype} ${devnum}:${distro_bootpart} efi/boot/bootarm.efi; then echo Found EFI removable media binary efi/boot/bootarm.efi; run boot_efi_binary; echo EFI LOAD FAILED: continuing…; fi; setenv efi_fdtfile
scan_dev_for_extlinux=if test -e ${devtype} ${devnum}:${distro_bootpart} ${prefix}extlinux/extlinux.conf; then echo Found ${prefix}extlinux/extlinux.conf; run boot_extlinux; echo SCRIPT FAILED: continuing…; fi
scan_dev_for_scripts=for script in ${boot_scripts}; do if test -e ${devtype} ${devnum}:${distro_bootpart} ${prefix}${script}; then echo Found U-Boot script ${prefix}${script}; run boot_a_script; echo SCRIPT FAILED: continuing…; fi; done
snappy_boot=if test “${snap_mode}” = “try”; then setenv snap_mode “trying”; saveenv; if test “${snap_try_core}” != “”; then setenv snap_core “${snap_try_core}”; fi; if test “${snap_try_kernel}” != “”; then setenv snap_kernel “${snap_try_kernel}”; fi; elif test “${snap_mode}” = “trying”; then setenv snap_mode “”; saveenv; fi; run loadfiles; setenv mmcroot “/dev/disk/by-label/writable ${snappy_cmdline} snap_core=${snap_core} snap_kernel=${snap_kernel}”; run mmcargs; bootz ${loadaddr} ${ramdiskaddr}:${initrd_size} ${fdt_addr}
snappy_cmdline=rng_core.default_quality=700 net.ifnames=0 init=/lib/systemd/systemd ro panic=-1 fixrtc
usb_boot=usb start; if usb dev ${devnum}; then setenv devtype usb; run scan_dev_for_boot_part; fi

are you sure mmc 0 is the emmc ?
(try getting to the uboot shell (hit enter at the countdown) and look around which mmc devices actually exist, use fatls to find the uboot.env file on the right one)

MMC1 is mmc0(sdcard) and MMC2 is mmc1(emmc).uboot seem it does not recognise MMC2.mmc list command just finds mmc0(sdcard)

so you need to change your u-boot to recognize it … check the upstream documentation/u-boot documentation for your board about how to enable it.