9front - general discussion about 9front
 help / color / mirror / Atom feed
* [9front] Reform MNT Boot Process
@ 2024-02-12  8:17 alex-ml
  2024-02-12 13:52 ` Sigrid Solveig Haflínudóttir
  0 siblings, 1 reply; 5+ messages in thread
From: alex-ml @ 2024-02-12  8:17 UTC (permalink / raw)
  To: 9front

Hello everyone,

I am new to Plan 9 / 9front and am trying to understand the system. 
Since I'm using an MNT Reform, I'm particularly interested in the 
aarch64 architecture. As a starting point, I'm reading the Plan 9 3rd 
Edition Kernel Notes (is there by any chance a way to get the 
assignments mentioned therein?).

I can't find 9boot or 9load in /sys/src/boot/reform/, so I wonder 
whether there is another way to load the kernel?

The notes state:
"The boot process starts when you press the power button on your PC. The 
BIOS (a program in ROM) is instructed to search for several devices to 
boot from. Usually, it will search for a floppy disk unit, a cdrom unit, 
and a hard disk. Once the boot device is located, the BIOS loads a block 
from the device. For hard disks, it loads the Master Boot Record (MBR), 
for floppies, it loads the boot sector (PBS).
Once either the MBR or the PBS get loaded, the BIOS jumps to its 
starting address. The BIOS is done. Both MBR and PBS contain a tiny 
program that proceeds the loading process. The MBR scans the partition 
table for active partitions and loads the PBS sector of the active 
partition. Thus, all in all, we end up with the PBS loaded in memory. 
Plan 9 supplies its own PBS program. It will load the program 9load 
which will continue the job."

My guess would be that flash.bin (built via the mkfile) is loading the 
kernel with the information from boot.scr (also built via mkfile). Is 
that right? In this case, the boot process would be a bit easier than 
described above (at least with fewer steps).

In /sys/src/cmd/aux/txt2uimage.c/, which is used in the recipe for 
boot.scr, there are some numbers that I would like to understand where 
they come from. Is there some documentation explaining how an uimage and 
/ or header has to look like? Unfortunately I wasn't able to find this 
information on https://docs.u-boot.org/.

And the same question for /sys/src/boot/reform/boot.txt/, where some 
addresses are given. How do I obtain this information?

I am very sorry for my beginner questions and I would really appreciate 
any explanations/hints to help me understand what happens during the 
boot process.

Thank you very much in advance!

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [9front] Reform MNT Boot Process
  2024-02-12  8:17 [9front] Reform MNT Boot Process alex-ml
@ 2024-02-12 13:52 ` Sigrid Solveig Haflínudóttir
  2024-02-12 14:01   ` Sigrid Solveig Haflínudóttir
  0 siblings, 1 reply; 5+ messages in thread
From: Sigrid Solveig Haflínudóttir @ 2024-02-12 13:52 UTC (permalink / raw)
  To: 9front

Quoth alex-ml@posteo.de:
> My guess would be that flash.bin (built via the mkfile) is loading the 
> kernel with the information from boot.scr (also built via mkfile). Is 
> that right? In this case, the boot process would be a bit easier than 
> described above (at least with fewer steps).

Yes.  flash.bin is U-Boot built for Reform.  It is in turn the one
loading the kernel by following the instructions in boot.txt (which
gets "compiled" into boot.scr).

> In /sys/src/cmd/aux/txt2uimage.c/, which is used in the recipe for 
> boot.scr, there are some numbers that I would like to understand where 
> they come from. Is there some documentation explaining how an uimage and 
> / or header has to look like? Unfortunately I wasn't able to find this 
> information on https://docs.u-boot.org/.
> 
> And the same question for /sys/src/boot/reform/boot.txt/, where some 
> addresses are given. How do I obtain this information?

"uImage" is a wrapper for whichever files you intend to use with
U-Boot.  In this specific case it tells U-Boot it's a "script" file
with a specific load address (where to put the "raw" unwrapped data)
and an entry point (where to start execution from).  I am not sure
where to find any documentation for this besides looking at U-Boot
sources (include/image.h describes a lot of it).

>
> I am very sorry for my beginner questions and I would really appreciate 
> any explanations/hints to help me understand what happens during the 
> boot process.

Don't think it's beginner questions but even if those were, no harm in
asking.


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [9front] Reform MNT Boot Process
  2024-02-12 13:52 ` Sigrid Solveig Haflínudóttir
@ 2024-02-12 14:01   ` Sigrid Solveig Haflínudóttir
  2024-02-13  7:25     ` alex-ml
  0 siblings, 1 reply; 5+ messages in thread
From: Sigrid Solveig Haflínudóttir @ 2024-02-12 14:01 UTC (permalink / raw)
  To: 9front

I forgot to mention where the addresses come from.
0x40010000 is the plan9.ini files which gets loaded by U-Boot as is and
is used by 9front kernel when booting, it's hardcoded in /sys/src/9/imx8/mem.h:71

The other one (0x40100000) is where the kernel gets placed - /sys/src/9/imx8/mem.h:48

Hope that helps.


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [9front] Reform MNT Boot Process
  2024-02-12 14:01   ` Sigrid Solveig Haflínudóttir
@ 2024-02-13  7:25     ` alex-ml
  2024-02-13  8:53       ` alex-ml
  0 siblings, 1 reply; 5+ messages in thread
From: alex-ml @ 2024-02-13  7:25 UTC (permalink / raw)
  To: 9front

Hello Sigrid,

thank you very much, that helps me a lot :)

I will have a look at /sys/src/9/imx8/mem.h and U-Boot’s 
include/image.h.

Best regards,
Alex

Am 12.02.2024 15:01 schrieb Sigrid Solveig Haflínudóttir:
> I forgot to mention where the addresses come from.
> 0x40010000 is the plan9.ini files which gets loaded by U-Boot as is and
> is used by 9front kernel when booting, it's hardcoded in
> /sys/src/9/imx8/mem.h:71
> 
> The other one (0x40100000) is where the kernel gets placed -
> /sys/src/9/imx8/mem.h:48
> 
> Hope that helps.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [9front] Reform MNT Boot Process
  2024-02-13  7:25     ` alex-ml
@ 2024-02-13  8:53       ` alex-ml
  0 siblings, 0 replies; 5+ messages in thread
From: alex-ml @ 2024-02-13  8:53 UTC (permalink / raw)
  To: 9front

Hello everyone,

Thanks to Sigrid, I have found the struct legacy_img_hdr on 
https://github.com/u-boot/u-boot/blob/master/include/image.h, which 
helps a lot in understanding /sys/src/cmd/aux/txt2uimage.c/, but I still 
have a few questions:

If there is a "legacy" struct, is there possibly a newer struct that 
could also be used?

The "Image Magic Number" in /sys/src/cmd/aux/txt2uimage.c/ is the same 
es the one defined in include/image.h, but what is its function? (And 
why is it that number?)

Why are 8 bit added to the Image Data Size? (header[12])

Why is IH_OS_INVALID (0) used instead of IH_OS_PLAN9 (23)? (header[28])

Why is IH_ARCH_INVALID (0) used instead of IH_ARCH_ARM64 (22)? 
(header[29])

Thank you very much in advance!

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2024-02-13  8:54 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-02-12  8:17 [9front] Reform MNT Boot Process alex-ml
2024-02-12 13:52 ` Sigrid Solveig Haflínudóttir
2024-02-12 14:01   ` Sigrid Solveig Haflínudóttir
2024-02-13  7:25     ` alex-ml
2024-02-13  8:53       ` alex-ml

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).