Booting Raspberry Pi 3: Difference between revisions

From OSDev.wiki
Jump to navigation Jump to search
[unchecked revision][unchecked revision]
Content added Content deleted
No edit summary
No edit summary
Line 22: Line 22:
====RPi 3: Firmware====
====RPi 3: Firmware====


Firmware is required for the RPi 3 to boot properly. The firmware can be found at this link:


https://github.com/raspberrypi/firmware/blob/master/boot/bootcode.bin

There is also another file required to boot properly. A config.txt file must be supplied to provide configuration details for the device and the OS. Here are the only entries you need:

<pre>
enable_uart=1
kernel=kernel8.img
</pre>

More details about booting and configuration can be found at thse links.

https://raspberrypi.stackexchange.com/a/10595
https://www.raspberrypi.org/documentation/configuration/config-txt/

When loading the OS onto an SD card, these file must be included in the boot partition.


== Overview ==
== Overview ==
Line 28: Line 44:
By now you should have your cross compiler set up. The compiler binaries have the same name as they usually would with "aarch64-elf-" prefixing them (e.x. aarch64-elf-gcc). For this example, three files are used:
By now you should have your cross compiler set up. The compiler binaries have the same name as they usually would with "aarch64-elf-" prefixing them (e.x. aarch64-elf-gcc). For this example, three files are used:


*start.S -
*start.S - Setup the environment and call the kernel
*kernel.c -
*kernel.c - Kernel entry and use
*uart.c - UART driver
*linker.ld -
*linker.ld - Linker script

Revision as of 18:20, 14 April 2018

This is a tutorial on bare-metal OS development on the AArch64 architecture. This article oriented to the Raspberry Pi 3 (RPi 3), but is aimed to be as device agnostic as possible. Therefore, some sections will be specific to the RPi 3 and will be marked.

This is the author's very first ARM system and wiki page. I learn as I write and will continue to develop this page once I feel comfortable enough at the subjet to share.

Preamble

This article assumes that you have all of the necessary materials needed to begin developing on your respective hardware. Other assumptions are that you are comfortable with low-level programming using C/C++, GNU Make buildsystem, and that you are comfortable enough about OS development and hardware to not be confused.. Such details are not in the scope of this article and must be done before proceeding to the next steps.

This article is also intended for beginner users who want a minimal solution for creating/starting an operating system, although some insight can be derived for the advanced audience.

Preperations

Cross Compiler

A bare-metal AArch64 toolchain is available on the AUR for installation. The links are provided here as well as a download link from the publisher for Windows users.

https://www.linaro.org/downloads/

https://aur.archlinux.org/packages/aarch64-elf-gcc-linaro-bin/

https://aur.archlinux.org/packages/aarch64-elf-newlib-linaro-bin/

RPi 3: Firmware

Firmware is required for the RPi 3 to boot properly. The firmware can be found at this link:

https://github.com/raspberrypi/firmware/blob/master/boot/bootcode.bin

There is also another file required to boot properly. A config.txt file must be supplied to provide configuration details for the device and the OS. Here are the only entries you need:

enable_uart=1
kernel=kernel8.img

More details about booting and configuration can be found at thse links.

https://raspberrypi.stackexchange.com/a/10595 https://www.raspberrypi.org/documentation/configuration/config-txt/

When loading the OS onto an SD card, these file must be included in the boot partition.

Overview

By now you should have your cross compiler set up. The compiler binaries have the same name as they usually would with "aarch64-elf-" prefixing them (e.x. aarch64-elf-gcc). For this example, three files are used:

  • start.S - Setup the environment and call the kernel
  • kernel.c - Kernel entry and use
  • uart.c - UART driver
  • linker.ld - Linker script