Skip to content

Commit

Permalink
Merge pull request s-matyukevich#190 from a-v-v/lesson01
Browse files Browse the repository at this point in the history
Lesson 1 enhancement
  • Loading branch information
s-matyukevich authored May 5, 2020
2 parents 1e64c8f + 48344b1 commit 3fe67b6
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 7 deletions.
2 changes: 1 addition & 1 deletion docs/lesson01/exercises.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
Exercises are optional, though I strongly recommend you to experiment with the source code a little bit. If you were able to complete any of the exercises - please share your source code with others. For details see the [contribution guide](../Contributions.md).

1. Introduce a constant `baud_rate`, calculate necessary Mini UART register values using this constant. Make sure that the program can work using baud rates other than 115200.
1. Change the OS code to use UART device instead of Mini UART. Use `BCM2837 ARM Peripherals` manual to figure out how to access UART registers and how to configure GPIO pins.
1. Change the OS code to use UART device instead of Mini UART. Use `BCM2837 ARM Peripherals` and [ARM PrimeCell UART (PL011)](http://infocenter.arm.com/help/topic/com.arm.doc.ddi0183g/DDI0183G_uart_pl011_r1p5_trm.pdf) manuals to figure out how to access UART registers and how to configure GPIO pins. The UART device uses the 48MHz clock as a base.
1. Try to use all 4 processor cores. The OS should print `Hello, from processor <processor index>` for all of the cores. Don't forget to set up a separate stack for each core and make sure that Mini UART is initialized only once. You can use a combination of global variables and `delay` function for synchronization.
1. Adapt lesson 01 to run on qemu. Check [this](https://github.com/s-matyukevich/raspberry-pi-os/issues/8) issue for reference.

Expand Down
10 changes: 4 additions & 6 deletions docs/lesson01/linux/project-structure.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
## 1.2: Linux project structure

This is the first time we are going to talk about Linux. The idea is first to complete some small step in writing our own kernel, and then take a look at how the same things work in Linux. So far we have done very little: we just implemented our first bare metal hello world program, Still, we will be able to find some similarities between the RPi OS and Linux. And now we are going to explore some of them.
This is the first time we are going to talk about Linux. The idea is first to complete some small step in writing our own kernel, and then take a look at how the same things work in Linux. So far we have done very little: we just implemented our first bare metal hello world program, Still, we will be able to find some similarities between the RPi OS and Linux. And now we are going to explore some of them.

### Project structure

Expand All @@ -9,9 +9,7 @@ Whenever you start investigating any large software project, it worth taking a q
First of all, you need to clone the Linux repository.

```
git clone https://github.com/torvalds/linux.git
cd linux
git checkout v4.14
git clone -b v4.14 --depth 1 https://github.com/torvalds/linux.git
```

We are using `v4.14` version because this was the latest version at the time of writing. All references to the Linux source code will be made using this specific version.
Expand All @@ -21,11 +19,11 @@ Next, let's take a look at the folders that we can find inside the Linux reposit
* [arch](https://github.com/torvalds/linux/tree/v4.14/arch) This folder contains subfolders, each for a specific processor architecture. Mostly we are going to work with [arm64](https://github.com/torvalds/linux/tree/v4.14/arch/arm64) - this is the one that is compatible with ARM.v8 processors.
* [init](https://github.com/torvalds/linux/tree/v4.14/init) Kernel is always booted by architecture specific code. But then execution is passed to the [start_kernel](https://github.com/torvalds/linux/blob/v4.14/init/main.c#L509) function that is responsible for common kernel initialization and is an architecture independent kernel starting point. `start_kernel` function, together with some other initialization functions, is defined in the `init` folder.
* [kernel](https://github.com/torvalds/linux/tree/v4.14/kernel) This is the core of the Linux kernel. Almost all major kernel subsystems are implemented there.
* [mm](https://github.com/torvalds/linux/tree/v4.14/mm) All data structures and methods related to memory management are defined there.
* [mm](https://github.com/torvalds/linux/tree/v4.14/mm) All data structures and methods related to memory management are defined there.
* [drivers](https://github.com/torvalds/linux/tree/v4.14/drivers) This is the largest folder in the Linux kernel. It contains implementations of all device drivers.
* [fs](https://github.com/torvalds/linux/tree/v4.14/fs) You can look here to find different filesystem implementations.

This explanation is very high-level, but this is enough for now. In the next chapter, we will try to examine Linux build system in some details.
This explanation is very high-level, but this is enough for now. In the next chapter, we will try to examine Linux build system in some details.

##### Previous Page

Expand Down

0 comments on commit 3fe67b6

Please sign in to comment.