Welcome, Guest

Author Topic: Armbian Stretch and Bionic with 4.19.y  (Read 6096 times)

khumarahn

  • Jr. Member
  • **
  • Posts: 92
  • Karma: +9/-0
Re: Armbian Stretch and Bionic with 4.19.y
« Reply #45 on: February 10, 2019, 12:39:07 AM »
Well, I still cannot compile a working u-boot myself; the one of armbian does not count because it is hard to follow what is going on.

I mean, sunxi' branch of u-boot with atf-allwinner (whether I compile if myself or copy is from debian) does not really see the eMMC at all.

The magic number error is strange. Maybe it is something simple like one u-boot supporting compression and the other not.
I think now it is not related to the magic number... The u-boot does not even see the boot.scr, so probably things get wrong somewhere in the very beginning.

khumarahn

  • Jr. Member
  • **
  • Posts: 92
  • Karma: +9/-0
Re: Armbian Stretch and Bionic with 4.19.y
« Reply #46 on: February 10, 2019, 01:53:25 AM »
OK, I know how to build a working u-boot:
Code: [Select]
set -e # exit if any command fails

git clone https://salsa.debian.org/debian/atf-allwinner.git --depth=1
cd atf-allwinner
make PLAT=sun50iw1p1 DEBUG=1 -j4 bl31
cp build/sun50iw1p1/debug/bl31.bin ../
cd ..

wget https://github.com/Icenowy/u-boot/commit/960ae7.diff
git clone --single-branch --branch pinebook-wip-20181109 --depth=1 https://github.com/anarsoul/u-boot-pine64.git
cd u-boot-pine64
git apply ../960ae7.diff
BL31=../bl31.bin make teres_i_defconfig
BL31=../bl31.bin make -j4
cp u-boot-sunxi-with-spl.bin ../
cd ..

Now: how to build the mainline u-boot for teres?

lambda

  • Full Member
  • ***
  • Posts: 180
  • Karma: +21/-0
    • Support my work
Re: Armbian Stretch and Bionic with 4.19.y
« Reply #47 on: February 10, 2019, 10:47:23 AM »
Quote
I think now it is not related to the magic number... The u-boot does not even see the boot.scr, so probably things get wrong somewhere in the very beginning.

Hm, then I must have misunderstood something in your previous message. Never mind.

Quote
Now: how to build the mainline u-boot for teres?

Probably not yet. Your results indicate that not everything needed for eMMC is merged yet. (And since anarsoul seems to be actively working on upstreaming his patches, there probably isn't much you can do to speed this up.)

OTOH the teres enable patch seems to work fine and it appears icenowy has stopped working on teres. So bringing this patch to shape and submitting it would help a lot. (And it's no real "building from mainline" so long as this patch is missing.) Also once teres support is in u-boot, people will keep it updated when changing related bits of u-boot, that might break it.

khumarahn

  • Jr. Member
  • **
  • Posts: 92
  • Karma: +9/-0
Re: Armbian Stretch and Bionic with 4.19.y
« Reply #48 on: February 10, 2019, 12:57:40 PM »
I have a working installation on the eMMC with the u-boot built as above and config that avoids the volatile /dev/mmcblk{1,2} devices:
Code: [Select]
$ cat /boot/boot.cmd
setenv bootargs rootwait root=PARTUUID=3807bc36-02 rootfstype=f2fs debug=on console=tty0 console=ttyS0,115200n8 no_console_suspend
load mmc 1 0x44000000 dtb
load mmc 1 0x41000000 Image
booti 0x41000000 - 0x44000000
My fstab also uses UUID. It would be good to figure out how to make /dev/mmcblk{1,2} predictable, but it is not a pressing issue.

I'd be happy to cleanup Icenowy's patch. Though I still understand little about what needs to be done. It looks rather clean already, no?

lambda

  • Full Member
  • ***
  • Posts: 180
  • Karma: +21/-0
    • Support my work
Re: Armbian Stretch and Bionic with 4.19.y
« Reply #49 on: February 10, 2019, 08:52:38 PM »
What's the trick to avoid volatile devices? From to code snippet I don't understand what your solution is.

Patch cleanup:
Step 1: Sync the DT in the patch with what we have in the linux kernel now. (Ie use DT from linux kernel, but readd all the nodes, that are in patch but not in linux. - I guess this is mostly the eDP bridge, but check yourself to be sure nothing gets lost.) Have a look at the DT for pinebook to see how it is done. (Also a git log on the pinebook DT might clear up things.)

Step 2: The defconfig probably contains symbols randomly enabled until "it works". Try to disable anything that might be unnecessary. Cross checking with pinebook defconfig will help a lot, but some things are different. (You will now about them once you compare DTs). Also cross check with common sense - maybe there is something that would improve things when enabled. (USB stuff (working keyboard in u-boot anybody?) comes to mind, but I have no idea really).

Step 3: Test. It should work realiably on external sd card. Don't worry if it doesn't work on eMMC, though if you can make it work there (maybe some more patches merged by anarsould in time) even better.

Step 4: Submit it to the right mailinglist/people. I guess scripts/get_mainter.pl is your friend, but I don't know u-boot customs.

TIA,
Harald

khumarahn

  • Jr. Member
  • **
  • Posts: 92
  • Karma: +9/-0
Re: Armbian Stretch and Bionic with 4.19.y
« Reply #50 on: February 10, 2019, 09:21:53 PM »
Thanks!

What's the trick to avoid volatile devices? From to code snippet I don't understand what your solution is.

That is `root=PARTUUID=3807bc36-02` in kernel command line, in place of `root=/dev/mmcblk1p1`. Apparently, we cannot use UUID there, but PARTUUID works OK. Perhaps, could use partition labels.

lambda

  • Full Member
  • ***
  • Posts: 180
  • Karma: +21/-0
    • Support my work
Re: Armbian Stretch and Bionic with 4.19.y
« Reply #51 on: February 10, 2019, 10:04:19 PM »
That is `root=PARTUUID=3807bc36-02` in kernel command line, in place of `root=/dev/mmcblk1p1`. Apparently, we cannot use UUID there, but PARTUUID works OK. Perhaps, could use partition labels.

Hm, that should help the kernel find the rootfs. But how does this help u-boot find the right device to load the kernel from?

khumarahn

  • Jr. Member
  • **
  • Posts: 92
  • Karma: +9/-0
Re: Armbian Stretch and Bionic with 4.19.y
« Reply #52 on: February 10, 2019, 10:16:13 PM »
Loading kernel works from mmc 1, regardless whether kernel identifies eMMC as /dev/mmcblk1 or /dev/mmcblk2.

lambda

  • Full Member
  • ***
  • Posts: 180
  • Karma: +21/-0
    • Support my work
Re: Armbian Stretch and Bionic with 4.19.y
« Reply #53 on: February 11, 2019, 10:05:49 AM »
Ah, then I completely misunderstood what the issue was. Yes device numbering is not reliable in the kernel. (Hasn't been since 2.6.0 or something.) UUIDs is the way to go. (Also we now use libgpiod instead of /sys/class/gpio for the same reason, etc.)