Armbian Buster and Bionic with 5.7.y

Started by igorpec, June 20, 2018, 12:12:56 PM

Previous topic - Next topic

khumarahn

Update on RTC: the armbian kernel did not set the time on startup from the hardware source. I turned on the corresponding kernel option, and it works properly now.

lambda

Quote from: khumarahn on February 07, 2019, 02:21:21 PM
I used the instructions on the debian wiki to build the u-boot. (I think found them really very useful!) The LCD was dark in u-boot. The only thing I did differently was I used a later branch in
git checkout -b teres origin/pinebook-wip-20180206
I think it was 201811-something. I may try to do it again, if this makes any sense.

Well, if the LCD is dark in u-boot, then u-boot or ATF fail to setup everything correctly.
If you post your serial log, I can have a look.

I think everything from the pinebook-wip branch is merged by now. Somebody tested
Icenowy's patch + mainline u-boot and reported it working via e-mail to me.

I suggest trying again with the documented wip branch or mainline u-boot. I have no
idea about the content of other wip branches ...

Quote
Suspend not working is more like jflesch described. I see the LCD go dark, that the power consumption does not change significantly, and then I cannot wake it up. Following jflesch advice, I tried closing and opening the lid, and te machine indeed woke up :-) So let's say that the suspend works in a very strange way.

Suspend works, but the lid switch is the only wakeup source available. Presumably because of missing power button driver. You can define additional wakeup sources in device tree, but there are few inputs that are sensible. (I think you can't use usb devices, because the TERES doesn't have USB-OTG available on the
exterior.)

HTH,
Harald

jflesch

Regarding waking up from suspend, would it be possible to make it work with both the lid and power button ? I'm fine with any of them, but I have the feeling it's really confusing for a lot of people when the laptop only wakes up when the lid is being opened.

lambda

Looks like I have been wrong on several counts:

1) I completely forgot that backlight support was dropped, when I submitted the teres DT upstream, because the PWM support didn't make it in in time. I had the full DT locally of course (and some distributions picked up the patches anyway, so many people didn't notice) and firmly believed that brightness can be set in sysfs - but probably some of you still can't. (I'll resubmit the patch soon of course.)

2) Seems that enabling the right driver is not enough to get the power button working as a wakeup source. There is also a bug/missfeature in the driver, that prevents this on some PMICs like the AXP803, that teres is using. I'll see what can be done.

3) I kind of implied that the proper drm display driver works with 4.20. Which probably is true, but it isn't enabled for either pinebook or teres in DT. Looks like this is intentional - I guess some issue where proper driver and simple framebuffer (still needed on LCD) can't coexist. (But then maybe the author just didn't have the laptops around to test it there.) Not sure if I'll have time to look into this.

HTH,
Harald

khumarahn

I am very confused by what exactly patches I need to apply to the mainline u-boot and kernel. I ended up using armbian's build system in virtualbox (it did not work in a chroot), where I built deb packages with u-boot and kernel sources. Then I unpack the packages and take what I need. This seems unnecessarily complicated.

khumarahn

I tried to install u-boot and kernel to the eMMC, the same way as it works on an SD card:
u-boot  at 8KiB, then ext3 boot partition at 2MiB. I copied the content of the boot partition from the SD card. But it does not boot:

U-Boot SPL 2018.11-rc3-armbian (Feb 05 2019 - 16:24:03 +0000)
DRAM: 2048 MiB
Trying to boot from MMC2
NOTICE:  BL3-1: Running on A64/H64 (1689) in SRAM A2 (@0x44000)
NOTICE:  Configuring SPC Controller
NOTICE:  BL3-1: v1.0(debug):c9f55c0
NOTICE:  BL3-1: Built : 16:24:00, Feb  5 2019
NOTICE:  DT: sun50i-a64-teres-i
INFO:    Configuring AXP PMIC
INFO:    PMIC: DRAM voltage: 1.36V
INFO:    PMIC: enabled TERES I display power
INFO:    PMIC: setup successful
NOTICE:  SCPI: dummy stub handler, implementation level: 000000
INFO:    BL3-1: Initializing runtime services
INFO:    BL3-1: Preparing for EL3 exit to normal world
INFO:    BL3-1: Next image address: 0x4a000000, SPSR: 0x3c9


U-Boot 2018.11-rc3-armbian (Feb 05 2019 - 16:24:03 +0000) Allwinner Technology

CPU:   Allwinner A64 (SUN50I)
Model: TERES I
DRAM:  2 GiB
MMC:   SUNXI SD/MMC: 0, SUNXI SD/MMC: 1
Loading Environment from FAT... Unable to use mmc 1:1... In:    serial
Out:   vidconsole
Err:   vidconsole
Net:   No ethernet found.
Card did not respond to voltage select!
Card did not respond to voltage select!
starting USB...
USB0:   USB EHCI 1.00
USB1:   USB OHCI 1.0
USB2:   USB EHCI 1.00
USB3:   USB OHCI 1.0
scanning bus 0 for devices... 1 USB Device(s) found
scanning bus 2 for devices... 1 USB Device(s) found
       scanning usb for storage devices... 0 Storage Device(s) found
Autoboot in 1 seconds, press <Space> to stop
switch to partitions #0, OK
mmc1(part 0) is current device
Scanning mmc 1:1...
Found U-Boot script /boot.scr
281 bytes read in 3 ms (90.8 KiB/s)
## Executing script at 4fc00000
Card did not respond to voltage select!
Card did not respond to voltage select!
Card did not respond to voltage select!
Card did not respond to voltage select!
Bad Linux ARM64 Image magic!
SCRIPT FAILED: continuing...
Card did not respond to voltage select!

Device 0: device type unknown
... is now current device
No ethernet found.
missing environment variable: pxeuuid
missing environment variable: bootfile
Retrieving file: pxelinux.cfg/00000000
No ethernet found.
missing environment variable: bootfile
Retrieving file: pxelinux.cfg/0000000
No ethernet found.
missing environment variable: bootfile
Retrieving file: pxelinux.cfg/000000
No ethernet found.
missing environment variable: bootfile
Retrieving file: pxelinux.cfg/00000
No ethernet found.
missing environment variable: bootfile
Retrieving file: pxelinux.cfg/0000
No ethernet found.
missing environment variable: bootfile
Retrieving file: pxelinux.cfg/000
No ethernet found.
missing environment variable: bootfile
Retrieving file: pxelinux.cfg/00
No ethernet found.
missing environment variable: bootfile
Retrieving file: pxelinux.cfg/0
No ethernet found.
missing environment variable: bootfile
Retrieving file: pxelinux.cfg/default-arm-sunxi
No ethernet found.
missing environment variable: bootfile
Retrieving file: pxelinux.cfg/default-arm
No ethernet found.
missing environment variable: bootfile
Retrieving file: pxelinux.cfg/default
No ethernet found.
Config file not found
No ethernet found.
No ethernet found.
=>


Am I doing something badly wrong?

lambda

You seem to be quite far already, so it can't be badly wrong... :)

Maybe it is something simple. like the kernel image being compressed (some build systems do that by default) but u-boot expecting an uncompressed image? What das 'file <yourkernelimage>' say?

You can always manually enter the commands in your /boot.scr to see where it goes wrong.

About patches:
For the kernel no patches should be strictly necessary. - You will see (in serial console) when you miss something and some important device like backlight fails to come up. However it is very important to have a proper kernel .config, to actually compile all the drivers you need. Usually you can copy the config from any installation and use that as base. Then do "make olddefconfig" as first step in building your own kernel.

For u-boot I'm less sure, because I didn't look into it in details for a long time. But I suspect, that with
a recent u-boot the only patch you need is:
https://github.com/Icenowy/u-boot/commit/960ae79950a2b0a8d2e62bb3dfb5727764512a8b

Maybe you can tell us, where you are being confused?

khumarahn

Thanks! I will try the mainline kernel and u-boot with Icenowy's patch, and will report. I have armbian .config which works, so I will use it as a base.

The kernel image I use is uncompressed one (built with `make Image`). It worked just fine on an sd card, with the same boot.scr. For some reason, it stopped working when copied to eMMC.
`file Image` says: `Image: data`.

lambda

But it correctly read '/boot.scr' from the same partition? That's quite strange unless the other device hardcoded in the '/boot.scr' - anway, I guess your only option to find out is to manually step through boot.scr command by command.

khumarahn

#39
Quote from: lambda on February 08, 2019, 06:11:06 PM
But it correctly read '/boot.scr' from the same partition?

Yes, and the boom.scr is generated from a very simple boot.cmd:
setenv bootargs rootwait root=/dev/mmcblk0p2 rootfstype=f2fs debug=on console=tty0 console=ttyS0,115200n8 no_console_suspend
load mmc 0 0x44000000 dtb
load mmc 0 0x41000000 Image
booti 0x41000000 - 0x44000000

Identical configuration boots from an sd card and works fine. I will look into the individual commands in boot.cmd soon.

Now, I tried to build the u-boot myself:
git clone https://github.com/ARM-software/arm-trusted-firmware --depth=1
cd arm-trusted-firmware
make PLAT=sun50i_a64 DEBUG=1 -j4 bl31
cd ..

wget https://github.com/Icenowy/u-boot/commit/960ae7.diff
git clone git://git.denx.de/u-boot-sunxi.git --depth=1
cd u-boot-sunxi
git apply ../960ae7.diff
BL31=../arm-trusted-firmware/build/sun50i_a64/debug/bl31.bin make teres_i_defconfig
BL31=../arm-trusted-firmware/build/sun50i_a64/debug/bl31.bin make -j4
cd ..
cp u-boot-sunxi/u-boot-sunxi-with-spl.bin .

It is built on teres itself, so no cross compilation is necessary.

It does not work:

U-Boot SPL 2019.01-ga7cca57 (Feb 09 2019 - 15:42:13 +0000)
DRAM: 2048 MiB
Trying to boot from MMC2
NOTICE:  BL31: v2.0(debug):32bcba0
NOTICE:  BL31: Built : 15:40:11, Feb  9 2019
NOTICE:  BL31: Detected Allwinner A64/H64/R18 SoC (1689)
NOTICE:  BL31: Found U-Boot DTB at 0x4084c88, model: TERES I
INFO:    ARM GICv2 driver initialized
INFO:    Configuring SPC Controller
NOTICE:  BL31: PMIC: Detected AXP803 on RSB.
INFO:    PMIC: AXP803: dcdc1 voltage: 3.300V
INFO:    PMIC: AXP803: dcdc5 voltage: 1.360V
INFO:    PMIC: AXP803: dcdc6 voltage: 1.100V
INFO:    PMIC: AXP803: dldo1 voltage: 3.300V
INFO:    PMIC: AXP803: Enabling DC1SW
INFO:    BL31: Platform setup done
INFO:    BL31: Initializing runtime services
INFO:    BL31: cortex_a53: CPU workaround for 843419 was applied
INFO:    BL31: cortex_a53: CPU workaround for 855873 was applied
INFO:    BL31: Preparing for EL3 exit to normal world
INFO:    Entry point address = 0x4a000000
INFO:    SPSR = 0x3c9


U-Boot 2019.01-ga7cca57 (Feb 09 2019 - 15:42:13 +0000) Allwinner Technology

CPU:   Allwinner A64 (SUN50I)
Model: TERES I
DRAM:  2 GiB
MMC:   mmc@1c0f000: 0
Loading Environment from FAT... In:    serial
Out:   serial
Err:   serial
Net:   No ethernet found.
starting USB...
USB0:   USB EHCI 1.00
USB1:   USB EHCI 1.00
scanning bus 0 for devices... 1 USB Device(s) found
scanning bus 1 for devices... 1 USB Device(s) found
       scanning usb for storage devices... 0 Storage Device(s) found
Hit any key to stop autoboot:  2  1  0
MMC Device 1 not found
no mmc device at slot 1
Card did not respond to voltage select!

Device 0: unknown device
No ethernet found.
missing environment variable: pxeuuid
missing environment variable: bootfile
Retrieving file: pxelinux.cfg/00000000
No ethernet found.
missing environment variable: bootfile
Retrieving file: pxelinux.cfg/0000000
No ethernet found.
missing environment variable: bootfile
Retrieving file: pxelinux.cfg/000000
No ethernet found.
missing environment variable: bootfile
Retrieving file: pxelinux.cfg/00000
No ethernet found.
missing environment variable: bootfile
Retrieving file: pxelinux.cfg/0000
No ethernet found.
missing environment variable: bootfile
Retrieving file: pxelinux.cfg/000
No ethernet found.
missing environment variable: bootfile
Retrieving file: pxelinux.cfg/00
No ethernet found.
missing environment variable: bootfile
Retrieving file: pxelinux.cfg/0
No ethernet found.
missing environment variable: bootfile
Retrieving file: pxelinux.cfg/default-arm-sunxi
No ethernet found.
missing environment variable: bootfile
Retrieving file: pxelinux.cfg/default-arm
No ethernet found.
missing environment variable: bootfile
Retrieving file: pxelinux.cfg/default
No ethernet found.
Config file not found
No ethernet found.
No ethernet found.
=>

And there is no display. Probably, there is something I do not understand here.

lambda

Quote from: khumarahn on February 09, 2019, 08:21:59 PM
setenv bootargs rootwait root=/dev/mmcblk0p2 rootfstype=f2fs debug=on console=tty0 console=ttyS0,115200n8 no_console_suspend
load mmc 0 0x44000000 dtb
load mmc 0 0x41000000 Image
booti 0x41000000 - 0x44000000

Identical configuration boots from an sd card and works fine. I will look into the individual commands in boot.cmd soon.

Well, probably too identical. "mmc 0" is the sd card. I think you need to replace this with "mmc 1" or "mmc  2" - not sure about the u-boot mmc numbering...

Quote
Now, I tried to build the u-boot myself:
git clone https://github.com/ARM-software/arm-trusted-firmware --depth=1
cd arm-trusted-firmware
make PLAT=sun50i_a64 DEBUG=1 -j4 bl31


I think this is the wrong ATF. You need "atf-allwinner". I think we had a link to the repo in the wiki, but when a proper debian package became available, it was removed, I guess.

Maybe just use the binary from the debian package. I don't remember which version it builds, but it is confirmed working.

(The author / upstream maintainer of atf-allwinner is an arm employee. No idea why this isn't merged into ATF proper. (Maybe size constraints?). The situation is unresolved for long enough, that debian has to ATF packages...

Quote
And there is no display. Probably, there is something I do not understand here.

atf-allwinner sets up some voltages for the eDP bridge.

ATM you have untested ATF + untested u-boot version. I suggest you get rid of one uncertainty (probably ATF) and try to test the other.

HTH,
Harald

khumarahn

#41
Many thanks! I managed to build a u-boot in which the LCD works:
git clone https://salsa.debian.org/debian/atf-allwinner.git --depth=1
cd atf-allwinner
make PLAT=sun50iw1p1 DEBUG=1 -j4 bl31
cd ..

wget https://github.com/Icenowy/u-boot/commit/960ae7.diff
git clone git://git.denx.de/u-boot-sunxi.git --depth=1
cd u-boot-sunxi
git apply ../960ae7.diff
BL31=../atf-allwinner/build/sun50iw1p1/debug/bl31.bin make teres_i_defconfig
BL31=../atf-allwinner/build/sun50iw1p1/debug/bl31.bin make -j4
cd ..
cp u-boot-sunxi/u-boot-sunxi-with-spl.bin .


I was under impression that `mmc 0` is always the boot device... Thanks for the clarification. Now I see that eMMC is `mmc 1`: commands `load mmc 0 0x44000000 dtb` and `load mmc 2 0x44000000 dtb` result in
Card did not respond to voltage select!
but `load mmc 1 0x44000000 dtb` gives no output (probably, works?)

I still cannot boot, but now for a different reason:
=> load mmc 1 0x44000000 dtb
=> load mmc 1 0x41000000 Image
=> booti 0x41000000 - 0x44000000
Bad Linux ARM64 Image magic!


EDIT: u-boot does not see the file boot.scr:
U-Boot 2019.04-rc1-gbe433ef (Feb 09 2019 - 19:42:58 +0000) Allwinner Technology

CPU:   Allwinner A64 (SUN50I)
Model: TERES I
DRAM:  2 GiB
MMC:   mmc@1c0f000: 0
Loading Environment from FAT... In:    serial
Out:   vidconsole
Err:   vidconsole
Net:   No ethernet found.
starting USB...
USB0:   USB EHCI 1.00
USB1:   USB EHCI 1.00
scanning bus 0 for devices... 1 USB Device(s) found
scanning bus 1 for devices... 1 USB Device(s) found
       scanning usb for storage devices... 0 Storage Device(s) found
Hit any key to stop autoboot:  2  1  0
MMC Device 1 not found
no mmc device at slot 1
Card did not respond to voltage select!

Device 0: unknown device
No ethernet found.
missing environment variable: pxeuuid
missing environment variable: bootfile
Retrieving file: pxelinux.cfg/00000000
No ethernet found.
missing environment variable: bootfile
Retrieving file: pxelinux.cfg/0000000
No ethernet found.
missing environment variable: bootfile
Retrieving file: pxelinux.cfg/000000
No ethernet found.
missing environment variable: bootfile
Retrieving file: pxelinux.cfg/00000
No ethernet found.
missing environment variable: bootfile
Retrieving file: pxelinux.cfg/0000
No ethernet found.
missing environment variable: bootfile
Retrieving file: pxelinux.cfg/000
No ethernet found.
missing environment variable: bootfile
Retrieving file: pxelinux.cfg/00
No ethernet found.
missing environment variable: bootfile
Retrieving file: pxelinux.cfg/0
No ethernet found.
missing environment variable: bootfile
Retrieving file: pxelinux.cfg/default-arm-sunxi
No ethernet found.
missing environment variable: bootfile
Retrieving file: pxelinux.cfg/default-arm
No ethernet found.
missing environment variable: bootfile
Retrieving file: pxelinux.cfg/default
No ethernet found.
Config file not found
No ethernet found.
No ethernet found.


khumarahn

=> mmc list
mmc@1c0f000: 0
=> mmc dev 0
Card did not respond to voltage select!
=> mmc info
Card did not respond to voltage select!

khumarahn

(Now I can boot with the u-boot from armbian: I use `load mmc 1` instead of `load mmc 0`. It does not work reliably though: the eMMC is sometimes /dev/mmcblk1 and other times /dev/mmcblk2; in my setup I need a static name, so every about second time linux does not boot.)

lambda

Gratulations!

I can't help you with eMMC issues. I'm still running mainline on sd card and olimex on eMMC to have something to cross-check and compare when doing kernel stuff, so you are probably on new territory now.

I guess you could work around the mmc numbering issue by writing a boot script that checks for both. Also maybe somebody works already on it: See this commit for example
http://git.denx.de/?p=u-boot/u-boot-sunxi.git;a=commit;h=708b5da38a19d41e6ccb9bff14f54b5f2d1db43c

Since it seems to be a DT related issue, maybe you can clean up the patch for teres-i support and submit it to u-boot? I think there is a good chance, that cleaning up the patch also fixes the device numbering issues ...

The magic number error is strange. Maybe it is something simple like one u-boot supporting compression and the other not.

HTH,
Harald