ahmedawad
Posts: 42
Joined: Mon Apr 18, 2016 11:44 am
Location: Bremen, DE

Re: device tree overlays and U-Boot

Fri May 26, 2017 8:23 am

PhilE wrote:Reading the link swarren sent, u-boot sets "fdt_addr" to the DT address passed to the kernel. "fdt_addr_r" is the old constant value of 0x100, which is where the kernel used to put its ATAGs or DTB. Unfortunately the gap from 0x100 to where the kernel starts is only 32KB, and the decompressor seems to use memory starting at 0x4000, leaving only 16KB for the DTB - not enough in many cases, so the RPi firmware switched to loading the DTB high above the kernel and the u-boot startup code now stores the value passed to the "kernel" in the variable "fdt_addr".

Does u-boot let you print output from your script? I would suggest displaying "fdt_addr" and "fdt_addr_r" to see if they are sensible.
When I try @swarren's script as is. The Uboot displays the following:

Code: Select all

Warning: start.elf did not pass ATAGor FDT parameters
Net: Net Initialization Skipped
No ethernet found.
starting USB...
USB0:     core Release: 2.80a
scanning bus 0 for devices... unable to get device descriptor (error=-22)
6 USB Devices(s) found
          scanning usb for storage devices... 0 Storage Devices(s) found
          scanning usb for ehternet devices...
Error: sms0 address not set.
Warning: failed to set MAC address
1 Ethernet Devices(s) found
Hit any key to stop autoboot:   0
switch to partitions #0, OK
mmc0 is current device
Found U-Boot script /boot.scr
reading /boot.scr
272 bytes read in 27 ms
## Executing script at 02000000
reading kernel7.img
4235224 bytes read in 732 ms
Kernel image @ 0x1000000 [ 0x000000 - 0x409fd8]

Starting kernel ...
At this point the screen halts! ..

PhilE
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 2279
Joined: Mon Sep 29, 2014 1:07 pm
Location: Cambridge

Re: device tree overlays and U-Boot

Fri May 26, 2017 8:47 am

Code: Select all

Warning: start.elf did not pass ATAGor FDT parameters
That first line is telling. Clearly the communication between the firmware and u-boot is not working. Since the firmware is just treating u-boot like a kernel (passing it the DTB address in a register) and Linux still boots I would say the problem is on the u-boot side - probably the configuration.

PhilE
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 2279
Joined: Mon Sep 29, 2014 1:07 pm
Location: Cambridge

Re: device tree overlays and U-Boot

Fri May 26, 2017 9:01 am

Where are you getting your u-boot source (or binary) from? That message does not exist in the source tree link provided by swarren, or even in its history. I did find some repos containing that string, but they appear to be very out of date with some downstream patches.

Try:

Code: Select all

git clone http://git.denx.de/u-boot.git

ahmedawad
Posts: 42
Joined: Mon Apr 18, 2016 11:44 am
Location: Bremen, DE

Re: device tree overlays and U-Boot

Fri May 26, 2017 9:28 am

PhilE wrote:Where are you getting your u-boot source (or binary) from? That message does not exist in the source tree link provided by swarren, or even in its history. I did find some repos containing that string, but they appear to be very out of date with some downstream patches.

Try:

Code: Select all

git clone http://git.denx.de/u-boot.git
Yes you are right. Now I got the binaries from:

Code: Select all

git clone git://github.com/swarren/u-boot.git
and compile for rpi3 (make make rpi_3_32b_defconfig) then cp u-boot.bin /boot. The dtoverlays got read finally, but the resolution and the color of the Raspbian even the 4 berries logo at the beginning splash is violet :D. I don't know why.

Another interessting thing, when I cloned the mainline repository provided by your link. This what happens:

Code: Select all

Net:  No ehternet found
starting USB...
USB0: Core Release:2.80a
scanning usb for storage devices... 0 Storage Device(s) found
Hit any key ..............
switch to partition #0, OK
mmc0 is current device
scanning mmc 0:1...
Found U-Boot script /boot.scr
reading /boot.scr
272 bytes read in 25ms
## Executing script at 02000000
reading kernel7.img
4235224 bytes read in 720 ms
kernel image @ 0x1000000 [0x000000 - 0x409fd8]

Starting kernel ...

Here and every thing stops. I assure that I didn't do any thing strange, using the mainline repository and copy u-boot.bin --> /boot , compile @swarren script using mkimage and cp -> /boot and append kernel=u-boot.bin to config.txt . No thing more I did.

I really appreciate your help, many thanks!

PhilE
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 2279
Joined: Mon Sep 29, 2014 1:07 pm
Location: Cambridge

Re: device tree overlays and U-Boot

Fri May 26, 2017 9:34 am

Perhaps you could try swarrens branch: http://elinux.org/RPi_U-Boot#Stephen_Wa ... ess_branch

swarren
Posts: 45
Joined: Tue Mar 01, 2016 5:56 am

Re: device tree overlays and U-Boot

Fri May 26, 2017 5:44 pm

ahmedawad wrote:
PhilE wrote:Where are you getting your u-boot source (or binary) from?
Yes you are right. Now I got the binaries from:

Code: Select all

git clone git://github.com/swarren/u-boot.git
Well, there aren't any binaries in that repository... I assume you meant you got the source from there.

Also, that's the wrong repository to use. Always use the upstream U-Boot repo:

Code: Select all

git clone git://git.denx.de/u-boot.git
My github repo is just my personal "work in progress" repo. I publish it as a backup and so I can share work-in-progress with anyone I'm collaborating with. It's not intended as something that anyone should blindly use. At any given time, it might contain (a) outright stale content, possibly from a time when things were broken upstream, and/or (b) actively broken commits I'm in the process of writing.

ahmedawad
Posts: 42
Joined: Mon Apr 18, 2016 11:44 am
Location: Bremen, DE

Re: device tree overlays and U-Boot

Fri May 26, 2017 6:36 pm

swarren wrote:
ahmedawad wrote:
PhilE wrote:Where are you getting your u-boot source (or binary) from?
Yes you are right. Now I got the binaries from:

Code: Select all

git clone git://github.com/swarren/u-boot.git
Well, there aren't any binaries in that repository... I assume you meant you got the source from there.

Also, that's the wrong repository to use. Always use the upstream U-Boot repo:

Code: Select all

git clone git://git.denx.de/u-boot.git
My github repo is just my personal "work in progress" repo. I publish it as a backup and so I can share work-in-progress with anyone I'm collaborating with. It's not intended as something that anyone should blindly use. At any given time, it might contain (a) outright stale content, possibly from a time when things were broken upstream, and/or (b) actively broken commits I'm in the process of writing.
Thanks for your help and replies @swarren and @PhilE. Please I want to clarify that the upstream or the mainline repository is not working at all with RPI3. I am saying that after several days of trials.

However I used your script @swarren and changed from fdt_addr_r to fdt_addr and the kernel doesn"t start at all.

Again please, here i am summarizing what I did:
I - downloaded the last Jessie image.
2- git clone git://git.denx.de/u-boot.git ==> this is the mainline repo
3- cd u-boot , make rpi_3_32b_defconfig , make -j4
4- I get the u-boot.bin , then copy it to /boot
5- add kernel=u-boot.bin to config.txt
6- prepare boot.txt with the following: ==> this is your script @swarren

Code: Select all

fatload mmc 0:1 ${kernel_addr_r} kernel7.img
setenv bootargs earlyprintk dwc_otg.lpm_enable=0 console=serial0,115200 root=/dev/mmcblk0p2 rootfstype=ext4 rootwait
bootz ${kernel_addr_r} - ${fdt_addr}
7- execute

Code: Select all

mkimage -A arm -O linux -T script -C none -a 0x00000000 -e 0x00000000 -n "rpi3 boot script" -d boot.txt boot.scr
8- cp boot.scr /boot
when reboot, the image and kernel halts!! and this is what I get:

Code: Select all

Net:  No ehternet found
starting USB...
USB0: Core Release:2.80a
scanning usb for storage devices... 0 Storage Device(s) found
Hit any key ..............
switch to partition #0, OK
mmc0 is current device
scanning mmc 0:1...
Found U-Boot script /boot.scr
reading /boot.scr
272 bytes read in 25ms
## Executing script at 02000000
reading kernel7.img
4235224 bytes read in 720 ms
kernel image @ 0x1000000 [0x000000 - 0x409fd8]

Starting kernel ...
Another comment:
The last script provided by you @swarren is actually working with your repository, but not perfect. I mean, the kernel starts and dtoverlays are read by the kernel as well, but the hdmi resolution is not perfectly set and the color of the raspbian became orange. That is, the system loads but not like the normal operation without U-Boot.
Many thanks!

swarren
Posts: 45
Joined: Tue Mar 01, 2016 5:56 am

Re: device tree overlays and U-Boot

Fri May 26, 2017 6:42 pm

Code: Select all

3- cd u-boot , make rpi_3_32b_defconfig , make -j4
4- I get the u-boot.bin , then copy it to /boot
5- add kernel=u-boot.bin to config.txt
That's probably the problem. The RPi 3 is a 64-bit system by default, but you've built a 32-bit U-Boot. "make rpi_3_defconfig" instead, or use config.txt entries to request a 32-bit boot.

Return to “Device Tree”