[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Install on Orange Pi Plus eMMC work but no reboot



On Thu, Oct 06, 2016 at 11:40:58AM +0200, Jean-Christian de Rivaz wrote:
> Le 06. 10. 16 à 02:16, Karsten Merker a écrit :

> The U-Boot and the installer was on a SD card that was only
> created by decompressing and concatenating this two files:
> https://d-i.debian.org/daily-images/armhf/daily/netboot/SD-card-images/firmware.orangepi_plus.img.gz
> https://d-i.debian.org/daily-images/armhf/daily/netboot/SD-card-images/partition.img.gz
> At some point this installer make some partitions and format on
> the eMMC with an offset to make place before them for the boot0
> and boot1 files that certainly correspond to first stages
> bootloader of the H3.
> 
> >The debian-installer doesn't itself install u-boot as a part of
> >the installation process but instead assumes that there already
> >is a u-boot available on the system, because otherwise the
> >installer couldn't have been booted :-).

> I think this is a wrong assumption. The firmware.orangepi_plus.img
> contain the first stages bootloaders and U-Boot to boot the
> installer.  Evidence are on that log file:
> https://d-i.debian.org/daily-images/armhf/daily/build_u-boot.log
> and the very basic fact that the installer simply boot. 
> Without the SD card inserted there is no message at all on the
> console.
> 
> >  If your u-boot is on
> >the SD card, you install to the eMMC and then remove the SD card,
> >this assumption isn't true anymore.
> 
> Yes, I think U-Boot is on the SD card to boot the installer.
> And yes, I expect that the installer install U-Boot on the
> eMMC, otherwise there is no point in having a such installer. 
> The goal is to install a working system, no ?  By the way it
> look like the installer have installed something that look like
> the two first stages bootloader on the /dev/mmcblk1boot0 and
> /dev/mmcblk1boot1 blocks on the eMMC, but for some reason this
> don't work as expected.

Sorry, maybe I haven't expressed myself in the proper way. "The
installer" in my last mail meant only the actual installer
software, not the SD card image that contains both the installer
and u-boot.  Debian provides the installer in various formats
(netboot tarball for tftp-booting, hd-media tarball for use on
USB sticks, and SD card images).  The first two only provide the
installer software and assume that there is a u-boot on the
system which can then boot the installer over the net or from
USB.  The SD card images combine u-boot and the installer.

The raw MLC NAND flash that was commonly used as fixed storage on
sunxi-based boards isn't yet properly supported in the mainline
kernel and sunxi-based systems with eMMC storage are a fairly
recent development.  Therefore until recently, on sunxi-based
devices installation was only possible to either the SD card that
the system was booted from and on which therefore a u-boot was
already installed, or to a SATA disk (on SoCs that have a SATA
controller), or to a USB mass storage device.  As no Allwinner
SoC can boot directly from SATA nor from USB mass storage
devices, in all cases u-boot still had to be loaded from the SD
card because there was no other way and u-boot was already
present there, so there was no need to install u-boot somewhere
as a part of the installation process.  With boards becoming
available now which use eMMC instead of raw MLC NAND flash, the
situation changes indeed.  AFAIK you are actually the first
person reporting about a Debian installation to eMMC on
sunxi-based boards.

> >So one attempt at a solution could be to manually install
> >u-boot to the eMMC.
> How ?

For booting the system please see below. If that doesn't work,
you could try running a rescue shell from the installer. Once
you have a shell, get the following file and gunzip it:

  https://d-i.debian.org/daily-images/armhf/daily/u-boot/orangepi_plus/u-boot-sunxi-with-spl.bin.gz

To write it to the eMMC, please run

  dd bs=1k seek=8 if=u-boot-sunxi-with-spl.bin of=/dev/YOUR_TARGET_DEVICE
  sync

with YOUR_TARGET_DEVICE being the first regular (i.e. non-boot)
eMMC partition; in your case probably /dev/mmcblk1p1. 
Unfortunately I don't know how the H3 BROM handles the
eMMC-specific hardware boot partitions (/dev/mmcblk1boot0 and
/dev/mmcblk1boot1), i.e. whether it tries to load the u-boot SPL
from the first regular partition or from the first hardware boot
partition.  If the latter, this would probably need extra support
in u-boot which to my knowledge isn't there yet.

I have neither access to a H3-based system nor to any other
sunxi-based device with eMMC, so unfortunately I cannot do any
tests in this regard.

Installing u-boot from within the debian-installer can be a
rather dangerous operation on many systems which is why the
installer doesn't try to do that yet.  The problem is that u-boot
isn't only a bootloader like GRUB but more like a PC BIOS and
nobody would expect the debian-installer to flash BIOS-updates on
a PC ;-).  There are quite a number of systems where writing
u-boot to internal storage going wrong completely bricks the
system, i.e the system is electronics garbage afterwards. Most
sunxi-based systems still have a way to trigger SD boot or FEL
boot as a way to manually restore the firmware, but not all of
them do, and on many non-sunxi-platforms a broken u-boot write is
completely unrecoverable except by unsoldering the flash or - if
one is lucky - by accessing it via JTAG, but both are methods
that are inaccessible for a normal user.

I'll put looking into support for installing u-boot from within
the installer at least on certain systems onto my (unfortunately
already way too long) todo list, but that will surely take quite
some time. I'm also CCing Vagrant Cascadian, the Debian u-boot
maintainer for some further input on this topic.

> >Does your u-boot build support two MMC devices - i.e. SD card and
> >eMMC - at the same time (IIRC that is a build time config option
> >in u-boot)? If yes, you could start u-boot from the SD card
> >and then boot the rest of the system from the eMMC.
> I don't know, the U-Boot is not build by me but by the Debian Installer
> team. This is precisely why I ask the question here.
> How to configure the U-Boot of the SD card to boot the system on the eMMC ?

Please stop the boot process by pressing return a few times when
u-boot prints "Hit any key to stop autoboot".  That should bring
you to the u-boot command prompt.  At the prompt, please run the
command "printenv boot_targets".  That should give you a list of
the boot devices which u-boot supports in their order of
preference.  The output should be something like:

  "boot_targets=fel mmc0 scsi0 usb0 pxe dhcp"

If there is more than one mmc entry, one of those is the SD card
and one of those is the eMMC.  Which number (mmc0/mmc1/mmc2/mmc3)
they have depends on the board design, so you might have to try
all the existing ones until you have the correct one.  You can
then execute the command "run bootcmd_mmc0" (respectively
mmc1/2/3), which should boot the system from the specified
device.

You can permanently change the boot order in u-boot by modifying
the boot_targets variable accordingly and saving the environment
(e.g. with "setenv boot_targets mmc1 mmc0 usb0 pxe dhcp" and
"saveenv").

Regards,
Karsten
-- 
Gem. Par. 28 Abs. 4 Bundesdatenschutzgesetz widerspreche ich der Nutzung
sowie der Weitergabe meiner personenbezogenen Daten für Zwecke der
Werbung sowie der Markt- oder Meinungsforschung.


Reply to: