在 2013-04-29一的 12:40 -0700,David Hendricks写道:
On Mon, Apr 29, 2013 at 1:56 AM, li guang lig.fnst@cn.fujitsu.com wrote:
[...]
A very simplified overview of each stage:
- bootblock is the very first instructions executed by the CPU. It
does very basic CPU setup. It has also been used to detect if the previous boot succeeded and, if not, select a fallback (or "failover") firmware to boot.
- romstage usually consists of code which runs before RAM is ready to
use, for example to initialize the DRAM controller interface.
- ramstage consists of everything else.
Overall we try to avoid assembly after the bootblock stage. For romstage, we use a technique called "cache-as-RAM" to exploit the processor cache (or embedded SRAM, if available) as a temporary location to set up a stack and run C code.
If you're interested in following the code flow for ARMv7, the Snow mainboard is the current example. Here are the files you should look at in order of usage:
- src/arch/armv7/bootblock.inc: Assembly code which sets ARM chip in
service mode, puts non-bootstrap CPU cores to sleep, initializes stack.
- src/arch/armv7/bootblock_simple.c: Generic ARM cache setup, calls
mainboard-specific routines, jumps to romstage
- src/mainboard/google/snow/bootblock.c: Determine if we are resuming
and can jump to resume vector.
- src/mainboard/google/snow/romstage.c: Set up PMIC, clocks, and RAM,
jump to ramstage. x86 platforms will also copy ramstage code into DRAM at this point for the next stage, but the Exynos5250 CPU on the Snow mainboard has a large enough embedded SRAM which we continue to use for ramstage on this platform.
- src/mainboard/google/snow/ramstage.c: Set up MMU, framebuffer,
exception handler, etc, and load payload.
Thanks! follow your pointing, I know execution flow, I want to know why coreboot force to boot a payload? can't we skip this payload(by changing hardwaremain())? or can we write a simple pseudo payload?
> > As I do not know the Loongson/MIPS architecture, I have no idea if the > coreboot “framework” is suitable or not for it. From coreboot’s > perspective it would be nice if you could spend the time trying to do a > Loongson/MIPS port. I also cannot remember if that has been tried in the > past. > seems there's no conflict with coreboot's framework.
I tend to agree. The real question is whether it might be useful for future MIPS-based laptops. I suspect coreboot is overkill for current MIPS-based products. However, we may see more complex systems where the Loongson is only a small part of the system as a whole, and where you may need flexibility to customize for different products with shared components.
ARM is similar in that regard. Fundamentally, ARMv7 setup is very easy and could be done in a few hundred lines of assembly code. However, each CPU implementation (ie Exynos5250) includes dozens of peripherals and each product requires customization. So in that case it's useful to have a framework which is flexible enough to account for differences in CPU implementation, mainboard components, and overall product design.
-- David Hendricks (dhendrix) Systems Software Engineer, Google Inc. -- coreboot mailing list: coreboot@coreboot.org http://www.coreboot.org/mailman/listinfo/coreboot
On Mon, Apr 29, 2013 at 7:37 PM, li guang lig.fnst@cn.fujitsu.com wrote:
Thanks!
I should thank you :-) You finally motivated me to start a wiki page for this stuff: http://www.coreboot.org/Exynos5
I want to know why coreboot force to boot a payload?
can't we skip this payload(by changing hardwaremain())? or can we write a simple pseudo payload?
You will need a payload. If you wish to try a simple pseudo payload, the "hello world" example for libpayload would be a good start: http://www.coreboot.org/Libpayload .
The term "payload" refers to the code which runs after coreboot, so you will need one. Unlike pmon2000, u-boot, uefi, etc, coreboot does not attempt to function as an OS in any capacity. It does not include an interactive console or a network server. It is intended to perform very basic hardware initialization only. Everything else is the responsibility of the payload.
The "payload" may be a Linux kernel if you can fit it on the ROM. As Vladimir pointed out, this is only 512KB. If you have a very small kernel then you may simply set it as the payload.
On Mon, Apr 29, 2013 at 7:37 PM, li guang lig.fnst@cn.fujitsu.com wrote:
Thanks! follow your pointing, I know execution flow, I want to know why coreboot force to boot a payload? can't we skip this payload(by changing hardwaremain())? or can we write a simple pseudo payload?
what would your pseudo payload do?
But first, let's start getting the directories set up.
Could you put together a simple CL to create src/cpu/loongson, with a Kconfig in it, and a src/arch/mips, with a config in it? If you want, you can follow the path we took with ARM, where we started out with an empty tree and then filled it in.
you could start with this example: http://review.coreboot.org/#/c/1939/