Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
170 views
in Technique[技术] by (71.8m points)

beagleboard - How to run custom kernel on beaglebone?

I am starting kernel or operating system programming for beaglebone with TI - AM3359 SoC. I have written an assembly program to write some characters to the serial interface (just to start off with) and i want to run this as kernel on beaglebone, just like linux kernel.

what is the linking address for my program?

and

How to boot it from u-boot by default? I don't want to get into u boot programming and want to use the available u-boot which came with angstrom distribution along with the BBone.

Any help is appreciated.

Thanks

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

I have written an assembly program to write some characters to the serial interface (just to start off with) and i want to run this as kernel on beaglebone, just like linux kernel.

What you have written is called a "standalone program". It does not require any external code to operate, compared to an application program that depends on an OS for resources and services. You should not call it a kernel (not yet anyway), since it does not have any of the capabilities that a kernel should have.

what is the linking address for my program?

Note: For a typical standalone program, "load address" and "linking address" are often the same value, since standalone code is typically not relocatable or position independent.

U-Boot is typically linked, loaded and executed in upper physical main memory.

The Linux kernel is typically linked to execute at the start of physical main memory + 0x8000 (for ARM anyway). But the kernel image, especially if it's a compressed file such as zImage or uImage, is typically loaded into memory at a higher address, and the decompression routine installs the Linux kernel at its proper load & start address.

So any "nice" address in low physical main memory is suitable to link and load your program.

How to boot it from u-boot by default?

U-Boot can transfer execution to two types of "programs" (as well as scripts).
One type of program is a "kernel" that uses the bootm command.
This is for a kernel or program that has a header installed by the mkimage utility, that is fully self-contained, and will take over the system. U-Boot can be customized to prepare the system for this kernel. For Linux a memory buffer is allocated, initialized with user-defined text and passed on to the Linux kernel as the kernel command line. For ARM Linux, another memory buffer is allocated, initialized with data and passed on to the ARM Linux kernel as ATAGs.

The other type of program uses the go command.
This is for a simpler program that can use U-Boot's service functions and maybe even return control back to U-Boot when done. If buffer preparations are not required, then your simple stand-alone program should use the go command.

You can use either command in your definition of the bootcmd environment variable, which is the variable that is run/executed when the boot timer expires.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

1.4m articles

1.4m replys

5 comments

57.0k users

...