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

Bug#851469: flash-kernel: ARM new boot.scr does not allow the device to boot



On Sun, Jan 15, 2017 at 08:24:37PM +0100, permondes - sagen wrote:
> Am Sonntag, den 15.01.2017, 12:39 +0100 schrieb Karsten Merker:
> > On Sun, Jan 15, 2017 at 12:02:56PM +0100, permondes - sagen wrote:
[...]
> > > I would like to test the reset of the environment, how do I get into
> > > u-boot prompt? I just have ssh access to the box, no serial, nor
> > > keyboard or so.
> > 
> > Hm, that poses a problem.  The "normal" way is via serial console,
> > or, if the u-boot version is relatively new, via a display
> > connected to the HDMI port and a USB keyboard.  U-Boot isn't memory
> > resident (except for the PSCI functions), i.e. once the Linux
> > kernel is booted, there is no u-boot anymore with which one could
> > interact directly.
> > 
> > What you could try is clobbering the area on the SD card in which
> > u-boot stores the environment.  This results in a checksum mismatch
> > and u-boot falls back to the integrated default environment.  On
> > the LIME, the u-boot environment is stored on the SD card starting
> > at offset 544kB from the start of the device, and is 128kB in size. 
> > So on the LIME running
> > 
> > $ sudo dd if=/dev/zero bs=1k count=128 seek=544 of=/dev/mmcblk0
> > 
> > should overwrite the complete environment area with zeros,
> > resulting in u-boot falling back to the built-in defaults. But
> > without some form of console you still won't be able to see which
> > version of u-boot is really installed (cf. my mail to debian-arm)
> > and what exactly happens at boot time.  If you want to make sure
> > that you have a current u-boot version installed, you can replace
> > whatever version is currently on the SD card by running
> > 
> > $ sudo dd if=/usr/lib/u-boot/A20-OLinuXino-Lime/u-boot-sunxi-with-spl.bin of=/dev/mmcblk0 bs=1k seek=8
> > 
> > Doing all this "blind" without console is of course inherently
> > dangerous, so make an image backup of your SD card that you can
> > restore in case of problems before trying any of this.
> > 
> > HTH,
> > Karsten
> 
> Hi Karsten,
> 
> this what I did:
> 
> to get a fresh boot.scr I used a command I got from the freedombox list
> some time ago:
> mkimage -C none -A arm -T script -d /boot/boot.cmd /boot/boot.scr

This boot.cmd doesn't come from flash-kernel; I would guess that
it is probably provided as part of the freedombox setup and
targets an older u-boot version.

> Then I zeroed the environment and copied the correct u-boot.

Just to be sure I don't misunderstand you: you have run the
following commands?

sudo dd if=/usr/lib/u-boot/A20-OLinuXino-Lime/u-boot-sunxi-with-spl.bin of=/dev/mmcblk0 bs=1k seek=8
sudo dd if=/dev/zero bs=1k count=128 seek=544 of=/dev/mmcblk0

> The devices booted, but I realized that boot.scr did not have the
> correct content, so I copied the before mentioned boot script for
> Allwinner SunXi-based devices over it and restarted the device. This
> time, it did not boot afterwards. 

Again just to be sure: have you installed the real boot.scr
created by flash-kernel, including the u-boot image header (i.e. 
the "garbage" part that you had cut out for your original bug
report), or only the plaintext part of it?  If the latter, it is
normal that the system doesn't boot because u-boot expects a
specific image header at the beginning of the boot script (which
is automatically generated by flash-kernel by calling the
appropriate mkimage command).

> Copying back the previous boot.scr made it boot again. The environment
> variables were the same as before. So I am back where I have been
> before.

To make sure that we are talking about the same thing here: You
wrote before that you have no way to access the u-boot prompt, so
how do you know what your current u-boot environment looks like? 
Is it perhaps possible that you mix up the u-boot environment and
the Linux shell environment?  The boot.scr is not executed by a
Linux shell; u-boot has its own internal bourne-shell-style
scripting language and has its own shell environment, which is
completely separate from any Linux shell environment.

> My understanding is, that this strange behavior is due to a transition
> that happened in the Freedombox project. So I will ask them to provide
> updated live images to start with a fresh and correct system instead of
> wasting time and trying to solve this particular case. 

Could you (after making an image backup of your SD card so that
you can easily restore the previous setup) please try the
following procedure on the LIME:

$ sudo apt-get install u-boot-sunxi
$ sudo dd if=/usr/lib/u-boot/A20-OLinuXino-Lime/u-boot-sunxi-with-spl.bin of=/dev/mmcblk0 bs=1k seek=8
$ sudo dd if=/dev/zero bs=1k count=128 seek=544 of=/dev/mmcblk0
$ sudo flash-kernel
$ sync
$ sudo reboot

This should (at least in theory) provide you with a booting
system, unless there is some freedombox-specific mechanism
that modifies the boot.scr behind flash-kernel's back.

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: