-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
6ad2431
commit 50ca3cd
Showing
18 changed files
with
494 additions
and
52 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
## Contributing to Raspberry Pi OS | ||
|
||
The general workflow is the following: | ||
|
||
1. Find an [issue](https://github.com/s-matyukevich/raspberry-pi-os/issues) that you want to start working on or create a new one. | ||
1. In the comments claim that you want to start working on the issue. The first person who did this will be assigned to the issue. In some circumstancies I may reasing the issue to somebody elase after contacting the original person. | ||
1. [Fork the repository](https://help.github.com/articles/fork-a-repo/). | ||
1. Make all necesary changes. | ||
1. [Send pull request](https://help.github.com/articles/about-pull-requests/). | ||
1. After a review your changes will be merged. | ||
|
||
The following types of contributions are particulary helpfull for the project. | ||
|
||
1. Validating source code and text of the lessons for errors. | ||
1. Helping to make lessons content more accurate and easier to understand. | ||
1. Working on sorce code and description for new lessons. | ||
1. Anything else that can help the project to become a perfect starting point for OS developers. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,15 @@ | ||
## Prerequisites | ||
|
||
|
||
### 1. [Raspberry Pi 3 model b](https://www.raspberrypi.org/products/raspberry-pi-3-model-b/) | ||
|
||
Older versions of Raspberry Pi are not going to work with this tutorial, because all lessons are designed to use 64 bit processor that supports ARM.v8 architecture and such processor is only available in Raspberry Pi 3 model. | ||
Older versions of Raspberry Pi are not going to work with this tutorial, because all lessons are designed to use 64 bit processor that supports ARMv8 architecture and such processor is only available in Raspberry Pi 3 model. | ||
|
||
### 2. [USB to TTL serial cable](https://www.amazon.com/s/ref=nb_sb_noss_2?url=search-alias%3Daps&field-keywords=usb+to+ttl+serial+cable&rh=i%3Aaps%2Ck%3Ausb+to+ttl+serial+cable) | ||
|
||
After you get serial cable you need to test you connection. If you never done this before I recommend you to follow [this guide](https://cdn-learn.adafruit.com/downloads/pdf/adafruits-raspberry-pi-lesson-5-using-a-console-cable.pdf) It describes the process of connecting your raspberry Pi via serial cabel in great details. One thin that I can recomment you to do is to use your serial cable to power your Raspberry Pi. How to do this is described in the previous link. | ||
|
||
### 3. Docker | ||
|
||
Strictly speaking Docker is not a required dependency. It is just convinient to use docker to build source code of the lessons, especially for Mac and Windows users. Each lesson has `build.sh` script (or `build.bat` for windows users) This script uses docker to build source code of the lesson. Instructions how to install docker for you platform can be found on the [official docker website](https://docs.docker.com/engine/installation/) | ||
|
||
If for some reasons you want to avoid using Docker, you can install [make utility](http://www.math.tau.ac.il/~danha/courses/software1/make-intro.html) as well as `aarch64-linux-gnu` toolchain. If you are using ubuntu you just need to install `gcc-aarch64-linux-gnu` and `build-essential` packages. |
Large diffs are not rendered by default.
Oops, something went wrong.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
#!/bin/bash | ||
|
||
docker run -v $(pwd):/app -w /app smatyukevich/raspberry-pi-os-builder make $1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
#ifndef _MM_H | ||
#define _MM_H | ||
|
||
#define PAGE_SHIFT 12 | ||
#define TABLE_SHIFT 9 | ||
#define SECTION_SHIFT (PAGE_SHIFT + TABLE_SHIFT) | ||
|
||
#define PAGE_SIZE (1 << PAGE_SHIFT) | ||
#define SECTION_SIZE (1 << SECTION_SHIFT) | ||
|
||
#ifndef __ASSEMBLER__ | ||
|
||
void memzero(unsigned long src, unsigned long n); | ||
|
||
#endif | ||
|
||
#endif /*_MM_H */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,8 @@ | ||
#ifndef _BOOT_H | ||
#define _BOOT_H | ||
|
||
extern void DELAY ( unsigned int); | ||
extern void PUT32 ( unsigned int, unsigned int ); | ||
extern unsigned int GET32 ( unsigned int ); | ||
extern void delay ( unsigned long); | ||
extern void put32 ( unsigned long, unsigned int ); | ||
extern unsigned int get32 ( unsigned long ); | ||
|
||
#endif /*_BOOT_H */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,24 @@ | ||
#include "mm.h" | ||
|
||
.section ".text.boot" | ||
|
||
.globl _start | ||
_start: | ||
mrs x0, mpidr_el1 | ||
and x0, x0,#0xFF // Check processor id | ||
cbz x0, master // Hang for all non-primary CPU | ||
b hang | ||
b proc_hang | ||
|
||
proc_hang: | ||
b proc_hang | ||
|
||
master: | ||
mov sp,#0x00400000 | ||
adr x0, bss_begin | ||
adr x1, bss_end | ||
sub x1, x1, x0 | ||
bl memzero | ||
|
||
mov sp, #(2 * SECTION_SIZE) | ||
bl kernel_main | ||
|
||
hang: b hang | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,3 @@ | ||
#include <stddef.h> | ||
#include <stdint.h> | ||
|
||
#include "utils.h" | ||
#include "mini_uart.h" | ||
|
||
void kernel_main(void) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,11 @@ | ||
SECTIONS | ||
{ | ||
.text : | ||
{ | ||
KEEP(*(.text.boot)) | ||
*(.text) | ||
} | ||
.rodata :{ *(.rodata) } | ||
.data :{ *(.data) } | ||
.text.boot : { *(.text.boot) } | ||
.text : { *(.text) } | ||
.rodata : { *(.rodata) } | ||
.data : { *(.data) } | ||
. = ALIGN(0x8); | ||
bss_begin = .; | ||
.bss : { *(.bss*) } | ||
bss_end = .; | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
.globl memzero | ||
memzero: | ||
str xzr, [x0], #8 | ||
subs x1, x1, #8 | ||
b.gt memzero | ||
ret |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,15 @@ | ||
.globl PUT32 | ||
PUT32: | ||
.globl put32 | ||
put32: | ||
str w1,[x0] | ||
ret | ||
|
||
.globl GET32 | ||
GET32: | ||
.globl get32 | ||
get32: | ||
ldr w0,[x0] | ||
ret | ||
|
||
.globl DELAY | ||
DELAY: | ||
.globl delay | ||
delay: | ||
subs x0, x0, #1 | ||
bne DELAY | ||
bne delay | ||
ret |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters