Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: "Gaël PORTAY" <gael.portay+rtone@gmail.com>
To: "Fiona Klute" <fiona.klute@gmx.de>,
	"Gaël PORTAY" <gael.portay@gmail.com>,
	buildroot@buildroot.org
Cc: "José Mendes" <jp.baltazar.mendes@gmail.com>,
	"Martin Bark" <martin@barkynet.com>,
	"Julien Grossholtz" <julien.grossholtz@openest.io>,
	"Yann E . MORIN" <yann.morin.1998@free.fr>
Subject: Re: [Buildroot] [PATCH next v2 3/3] configs/raspberrypicm4io_64_uboot_defconfig: new defconfig
Date: Fri, 07 Feb 2025 11:14:35 +0100	[thread overview]
Message-ID: <D7M4USL2KEM9.3MZ9W5ZLL5HOW@gmail.com> (raw)
In-Reply-To: <ba8e5707-9c21-4303-a9ae-1b307bc27173@gmx.de>

On Wed Feb 5, 2025 at 7:07 PM CET, Fiona Klute wrote:
>>> diff --git a/board/raspberrypi/boot.scr.in b/board/raspberrypi/boot.scr.in
>>> new file mode 100644
>>> index 0000000000..a5c986ef99
>>> --- /dev/null
>>> +++ b/board/raspberrypi/boot.scr.in
>>> @@ -0,0 +1,9 @@
>>> +# Please note that this is only a sample, we recommend you to change
>>> +# it to fit your needs. You should override this file using
>>> +# BR2_PACKAGE_HOST_UBOOT_TOOLS_BOOT_SCRIPT_SOURCE.
>>> +
>>> +# load kernel from the root partition
>>> +load mmc 0:2 ${kernel_addr_r} boot/Image
>>> +env set bootargs "root=/dev/mmcblk0p2 rootwait console=tty1 console=ttyAMA0,115200"
>>> +# boot using the FDT provided by firmware
>>> +booti ${kernel_addr_r} - ${fdt_addr}
>>
>> The raspberrypi5 uses a different console (i.e. console=ttyAMA10,11500)
>> and thus it requires a different file, right?
>
> Either that, or some logic to detect different boards and adjust the
> command line (e.g. "fdt get value" to read the compatible string and
> compare, or just the default board_name environment variable). Not sure
> what's preferable, do you have an opinion?
>

Oh I got it...

>> What do you think about adding a suffix so we can make the distinction
>> between the whole Raspberry Pi 4 64bit familly and an hypotetical
>> Raspberry Pi 5 boot.scr file?
>>
>> I am thinking about renaming the file boot_4_64bit.scr (or maybe
>> boot_cm4io_64bit.scr it the file is specific to the CM4-IO Board) and
>> update BR2_PACKAGE_HOST_UBOOT_TOOLS_BOOT_SCRIPT_SOURCE accordingly.
>
> I'd expect it to work with pretty much any 64 bit RPi variant, maybe
> with adjustments to the bootargs as you mentioned. It's not like the
> script itself has anything board specific, the variables are provided by
> U-Boot. If we go with separate scripts, the suffix is fine with me.
>

.... You are right, since this is all about scripting, this can be done
at runtime. Thus, we can have a single boot.scr compatible with every pi
(1-4-32bit, pi1-4-64bit, and pi5), and avoid another hassle of files
with prefixes.

So, IIUC, adding the raspberrypi5 is just about updating boot.scr this
way:

	# load kernel from the root partition
	load mmc 0:2 ${kernel_addr_r} boot/Image
	-env set bootargs "root=/dev/mmcblk0p2 rootwait console=tty1 console=ttyAMA0,115200"
	+if test "$board_name" = "5 Model B"; then
	+  env set bootargs "root=/dev/mmcblk0p2 rootwait console=tty1 console=ttyAMA10,115200"
	+else
	+ env set bootargs "root=/dev/mmcblk0p2 rootwait console=tty1 console=ttyAMA00,115200"
	+fi
	# boot using the FDT provided by firmware
	booti ${kernel_addr_r} - ${fdt_addr}

So forget what I said about the prefix, and stick to boot.scr, you got
the right approach ;)

Here all the environment for the pi5:

	U-Boot> printenv
	arch=arm
	baudrate=115200
	board=rpi
	board_name=5 Model B
	board_rev=0x17
	board_rev_scheme=1
	board_revision=0xD04170
	boot_targets=mmc usb pxe dhcp
	bootcmd=bootflow scan
	bootdelay=2
	cpu=armv8
	dhcpuboot=usb start; dhcp u-boot.uimg; bootm
	fdt_addr=2efec100
	fdt_addr_r=0x02600000
	fdt_high=ffffffffffffffff
	fdtcontroladdr=3f726f80
	fdtfile=broadcom/bcm2712-rpi-5-b.dtb
	initrd_high=ffffffffffffffff
	kernel_addr_r=0x00080000
	loadaddr=0x1000000
	preboot=pci enum; usb start;
	pxefile_addr_r=0x02500000
	ramdisk_addr_r=0x02700000
	scriptaddr=0x02400000
	serial#=xxxxxxxxxxxxxxxx
	soc=bcm283x
	stderr=serial,vidconsole
	stdin=serial,usbkbd
	stdout=serial,vidconsole
	usb_ignorelist=0x1050:*,
	vendor=raspberrypi

And I supposed the 32bit support can be added by testing the variable
$cpu.

Regards,
Gaël
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

  reply	other threads:[~2025-02-07 10:14 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-08-31 19:01 [Buildroot] [PATCH next v2 0/3] U-Boot on RPi boards Fiona Klute via buildroot
2024-08-31 19:01 ` [Buildroot] [PATCH next v2 1/3] board/raspberrypi: Support boot.scr for U-Boot Fiona Klute via buildroot
2024-08-31 19:01 ` [Buildroot] [PATCH next v2 2/3] board/raspberrypi: allow non-matching globs for DTBs Fiona Klute via buildroot
2024-08-31 19:01 ` [Buildroot] [PATCH next v2 3/3] configs/raspberrypicm4io_64_uboot_defconfig: new defconfig Fiona Klute via buildroot
2024-09-03 11:08   ` Niklas Cassel via buildroot
2024-09-03 13:10     ` Fiona Klute via buildroot
2024-09-03 13:29       ` Niklas Cassel via buildroot
2024-09-04 18:52         ` Fiona Klute via buildroot
     [not found]   ` <D7JTJDZQ286V.32BNGSIJOMVCI@gmail.com>
2025-02-05 18:07     ` Fiona Klute via buildroot
2025-02-07 10:14       ` Gaël PORTAY [this message]
2025-02-07 17:23         ` Fiona Klute via buildroot

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=D7M4USL2KEM9.3MZ9W5ZLL5HOW@gmail.com \
    --to=gael.portay+rtone@gmail.com \
    --cc=buildroot@buildroot.org \
    --cc=fiona.klute@gmx.de \
    --cc=gael.portay@gmail.com \
    --cc=jp.baltazar.mendes@gmail.com \
    --cc=julien.grossholtz@openest.io \
    --cc=martin@barkynet.com \
    --cc=yann.morin.1998@free.fr \
    /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