Bananian

Update U-Boot on Bananian manually

7 3864
Hi,

has anyone tried to update U-Boot on Bananian manually?

The linux-sunxi wiki describes how to clean the boot loader for an SD card - while keeping the partition table - by erasing the first 1023 bytes (see here). But I'm not sure, whether Bananian images are built the same way, so I'm asking. My Bananian SD Card should be bases on version 14.09 iirc.

I'm asking since I'd like to test newer U-Boot version for newer kernels, while keeping the Bananian rootfs and partitioning scheme.

Thanks,

Timo
tkaiser  
Don't know if this is helpful at all. But this is the stuff I wrote down when trying to use Bananian 14.09 on my Olimex Lime2 (at this time Bananian had no support for the Lime2):
  1. https://groups.google.com/forum/#!topic/linux-sunxi/Zl4P07vtTNA

  2. root@a20-olimex:/# blkid
  3. /dev/sda1: UUID="c8d8506d-bdab-4be0-aa68-8e72edc379f6" TYPE="ext4"
  4. /dev/mmcblk0: UUID="804A-8E6E" TYPE="vfat"
  5. /dev/mmcblk0p1: SEC_TYPE="msdos" UUID="6B4C-FFFD" TYPE="vfat"
  6. /dev/mmcblk0p2: UUID="e6a5580a-2f70-487b-b090-070577a04181" TYPE="ext3"

  7. root@a20-olimex:/# export DISK=/dev/mmcblk0

  8. root@a20-olimex:/# dd if=${DISK} of=/tmp/lime2-uboot.bin bs=1024 seek=8 count=536
  9. 536+0 records in
  10. 536+0 records out
  11. 548864 bytes (549 kB) copied, 0.0413819 s, 13.3 MB/s

  12. root@bananapi ~ # dd if=/tmp/lime2-uboot.bin of=/dev/mmcblk0 bs=1024 seek=8
  13. 544+0 Datensätze ein
  14. 544+0 Datensätze aus
  15. 557056 Bytes (557 kB) kopiert, 0,0474752 s, 11,7 MB/s

  16. Booted with a20-lime2_debian_3.4.90_release_1.img: http://pastebin.com/QSvXiM1j

  17. Bananian 14.09 with Olimex' fex booted: http://pastebin.com/xU9wHBPP
Copy the Code

tkaiser  
It might be also a good idea to have a look at Igor's build scripts, especially how he tweaks/creates a recent u-boot version that's also capable to boot old 3.4 kernels and how u-boot+SPL is written in the closing_image function:
  1. dd if=u-boot-sunxi-with-spl.bin of=$LOOP bs=1024 seek=8 status=noxfer
Copy the Code

igorpec  
Edited by igorpec at Thu Apr 9, 2015 16:29

Now it's even easier

I am already packing u-boot as .deb and its updated automatically on install. (GitHub sources are not updated yet)

Latest dev version (2015.04 RC5) - use on your own risk:
  1. wget http://mirror.igorpecovnik.com/u-boot/linux-u-boot-3.4.106-bananapi_2.6_armhf.deb

  2. dpkg -i linux-u-boot-3.4.106-bananapi_2.6_armhf.deb
Copy the Code
Idea is to link uboot and kernel so it's updated automatic on kernel change.

tkaiser  
igorpec replied at Thu Apr 9, 2015 09:26
Now it's even easier

I am already packing u-boot as .deb and its updated automatically on instal ...

Great! I just had a look into the .deb and realized that the postinstall routine does just the following (when it's neither UDOO nor Cubox/Hummingboard):
  1. DEVICE="/dev/mmcblk0"
  2. dd if=/usr/lib/linux-u-boot-3.4.106-bananapi_2.6_armhf/u-boot-sunxi-with-spl.bin of=$DEVICE bs=1024 seek=8 status=noxfer
Copy the Code
Which should work with Bananian also

Thanks.

Actually, the part of writing U-Boot to the SD-Card is pretty clear to me. It was more the question of how to overwrite or clear it properly before writing it.

The idea behind my question is this: Let's say hypothetically, the old U-Boot version was 40KB of data. The new U-Boot version is smaller, just 30KB. Now I overwrite the old U-Boot with the new version, starting at the same offset. I would then have my new version installed, followed by the left-over 10KB chunk of the old binary. That's why I was wondering, how to clear it properly before writing the new version. The wiki gives an instruction for clearing the bootloader while keeping the partition table, but I wasn't sure whether these values would be the same no matter how the image and partition table were created.

Cheers,

Timo

tkaiser  
Edited by tkaiser at Fri Apr 10, 2015 00:41
silentcreek replied at Thu Apr 9, 2015 12:42
I would then have my new version installed, followed by the left-over 10KB chunk of the old binary.


Why do you want to change/erase the partition table at all? Partitions start beyond block 1024 and SPL+u-boot start at block 8 and can grow up to 536KB in size. If the new u-boot blob doesn't take the same amount of space than the older one it also doesn't matter since if there would be a pointer jumping into the junk the former u-boot left behind then there's something wrong with the new code. It shouldn't matter whether you 'clean up' before or leave old data in place since the new u-boot code should stop executing when kernel/rootfs are loaded (beyond block 1024)

Oh, I DO NOT want to erase the partition table - I want to make sure it stays intact! I just wanted to clear out the U-Boot part before writing the new version.

I thought already, that this might in practice not make any difference. I just wasn't sure. And with regards to clearing it - there's just so much different info about the position of the partition table, etc. Take, for example the lemaker wiki which claims that the partition table is stored within the first 8KB (http://wiki.lemaker.org/Setting_up_the_bootable_SD_card). Whereas you say - and the sunxi wiki suggests that, too - that the partition table is stored at/or beyond 1024KB. Also I read about some SD cards having an MBR, others don't, depending on how they were formatted, etc. In other words: I wanted to make sure that there are no differences in the way such an image (i.e. Bananian) can be built, that would in the end leave me with a corrupted disk layout or partition table, when I overwrite U-Boot.

You have to log in before you can reply Login | Sign Up

Points Rules