9front - general discussion about 9front
 help / color / mirror / Atom feed
From: Daniel Morandini <danielmorandini@me.com>
To: 9front@9front.org
Subject: Re: [9front] PXE booting Rpi
Date: Wed, 7 Apr 2021 10:39:31 +0200	[thread overview]
Message-ID: <B5B48522-4D77-45DE-A2DD-FE29EB0B3258@me.com> (raw)
In-Reply-To: <abe8a349-9dcf-40b5-aae9-20d9a43e7a5c@pixelhero.dev>

Hi people,
9pi2 is now getting its kernel configuration params! :D

Summary: add a “device_tree=“ line to your config.txt file if you
want your bcm pi to load cmdline.txt (9front 18e1e1c3aaf1, bootcode.bin
from [4] 8717598).

I spotted the “problem" in bcm/bootargs.c, `bootargsinit`.
```
void
bootargsinit(uintptr pa)
{
	uintptr len;

	/*
	 * kernel gets DTB/ATAGS pointer in R0 on entry
	 */
	if(pa != 0 && (len = cankaddr(pa)) != 0){
		void *va = KADDR(pa);
		if(parseatags(va, len) == 0 || parsedevtree(va, len) == 0) {
			return;
		}
	}

	/*
	 * /dev/reboot case, check CONFADDR
	 */
	if(parseatags(BOOTARGS, BOOTARGSLEN) != 0)
		plan9iniinit(BOOTARGS, 0);
}
```
Some notes. DTB/ATAGS pointer is passed to R2 on entry, not R0,
according to [1] and [2].
We call bootargsinit(0) though (main.c:87), so the first if statement
is never asserted, at least from the references within the bcm
folder.

Now according to the comment we should reach the second block only
when rebooting (?), but apparently this is not true. Quoting [3],

> The firmware will always try to load the DT and pass it to the
> kernel, since all kernels since rpi-4.4.y will not function without
> a DTB. You can override this by adding device_tree= in config.txt,
> which forces the use of ATAGs, which can be useful for simple
> "bare-metal" kernels.

And that was it! The second block in fact does not try to parse a
device tree but atags.

Why is bootargsinit called with pa=0? I think this function is not
working as intended anymore!

Cheers,
dan

[1] https://wiki.osdev.org/ARM_RaspberryPi
[2] http://www.simtec.co.uk/products/SWLINUX/files/booting_article.html#appendix_tag_reference
[3] https://www.raspberrypi.org/documentation/configuration/device-tree.md#part3
[4] https://github.com/raspberrypi/firmware/blob/master/boot/bootcode.bin

  parent reply	other threads:[~2021-04-07  8:45 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-10 14:05 Daniel Morandini
2021-03-10 17:20 ` cinap_lenrek
2021-03-12 10:36   ` Daniel Morandini
2021-03-25 10:55     ` Daniel Morandini
2021-03-25 18:49       ` Noam Preil
2021-03-25 21:49         ` Noam Preil
2021-04-07  8:39         ` Daniel Morandini [this message]
2021-04-08 14:21           ` cinap_lenrek
2021-04-08 15:45             ` Daniel Morandini
2021-04-08 16:12               ` cinap_lenrek
2021-04-11 12:11                 ` cinap_lenrek
2021-04-12  9:04                   ` Daniel Morandini
2021-04-12 10:14                     ` cinap_lenrek
2021-04-12 16:48                       ` Daniel Morandini
2021-04-15 21:15                         ` cinap_lenrek
2021-04-19  7:53                           ` Daniel Morandini
2021-04-19 16:20                             ` Daniel Morandini

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=B5B48522-4D77-45DE-A2DD-FE29EB0B3258@me.com \
    --to=danielmorandini@me.com \
    --cc=9front@9front.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).