@@ -7,20 +7,20 @@ nav_order: 5
77## OpenRISC Linux
88
99Linux on OpenRISC is the essence of [ embedded Linux] ( https://elinux.org/Main_Page ) .
10- From the FPGA based SoC's , simulators, toolchains, kernel and software it provides a complete
10+ From the FPGA based SoCs , simulators, toolchains, kernel and software it provides a complete
1111open-source software and hardware stack.
1212
1313In this tutorial we cover the basics of OpenRISC embedded Linux before diving
1414into our Linux on OpenRISC tutorials. We will cover:
1515
1616 * Boot loaders - we need to get Linux onto the system, we will explain how this
1717 is done.
18- * Device tree - how does Linux know what hardware is available in the system
18+ * Device tree - how does Linux know what hardware is available in the system?
1919 * Toolchains - We covered this before, but a quick refresher on Linux
20- specific toolchains
21- * Rootfs - Applications
20+ specific toolchains.
21+ * Rootfs - Applications.
2222 * Memory layout - we explain how devices, Linux and our user processes
23- share memory space
23+ share memory space.
2424
2525If you wish to skip this you can continue directly with our tutorials:
2626
@@ -40,7 +40,7 @@ the entry point. Traditionally the popular Linux boot loader is
4040platforms like OpenRISC Linux more simple loaders are used. These include:
4141
4242 - For Simulators - or1ksim and QEMU provide built in boot loaders
43- - FPGA Boards - For larger FPGA boards with litex support we use the litex bios
43+ - FPGA Boards - For larger FPGA boards with LiteX support we use the LiteX BIOS
4444 - Tiny FPGA Boards - For tiny FPGA boards we use GDB as a simple boot loader
4545
4646Simulators like ` or1ksim ` and ` QEMU ` have the ability to be passed a kernel ELF
@@ -69,7 +69,7 @@ Address `0x100` is the OpenRISC default reset vector.
6969
7070The device tree file (.dts) is used to specify hardware configuration settings,
7171such as base addresses and interrupt numbers for peripherals, main memory, the
72- numbers of CPUs in the system and other things. OpenRISC Linux always needs a
72+ number of CPUs in the system and other things. OpenRISC Linux always needs a
7373device tree to boot. The device tree can be built into the kernel or passed as
7474a boot parameter via register ` r3 ` .
7575
7979 - 1 CPU
8080 - 1 UART at 0x90000000
8181 - 32 MB main memory at address 0x0
82- - 20 Mhz clock
82+ - 20 MHz clock
8383
8484The device tree will be compiled down to a ` .dtb ` binary file using the device
8585tree compiler (` dtc ` ) during the build processes. During the boot process the
@@ -154,7 +154,7 @@ The rootfs is like the Linux distribution for an embedded Linux.
154154We provide some [ prebuilt rootfs images] ( https://github.com/stffrdhrn/or1k-rootfs-build ) to
155155help get you started. The top choices are:
156156
157- - buildroot - a fully featured rootfs ideal for boards with and sd- card, with
157+ - buildroot - a fully featured rootfs ideal for boards with and SD card, with
158158 well known utilities like ` bash ` .
159159 - busybox - a lightweight single binary rootfs, coming in at under 3MB
160160
@@ -166,7 +166,7 @@ kernel and hardware devices. Memory protection between processes is achieved
166166using the OpenRISC memory management unit ** MMU** .
167167
168168The OpenRISC MMU uses 8KB (13-bits) pages leaving the most significant 19-bits
169- for indexing into a software page table. The architecture uses a 2-level [ page table] ( linux/ mm/page_tables.rst )
169+ for indexing into a software page table. The architecture uses a 2-level [ page table] ( https://docs.kernel.org/ mm/page_tables.html )
170170using 8-bits to index a 256 entry page directory and 11-bits to index 2048 page table entry leaf nodes.
171171
172172The ** page global directory** or ** pgd** looks like the following in OpenRISC:
@@ -228,34 +228,34 @@ space.
228228
229229#### Physical Addresses
230230
231- In Linux SoC's our data caches are configured with a 31-bit addresses width.
231+ In Linux SoCs our data caches are configured with a 31-bit addresses width.
232232This means only the first 2GB of physical memory space addresses are cached. This is useful
233233as it guarantees that all operations on addresses above ` 0x80000000 ` are not cached.
234234We use these upper address ranges for IO devices which we do not want to be
235235cached.
236236
237- This means that technically OpenRISC systems cannot have more than 2GiB of main
237+ This means that technically OpenRISC systems cannot have more than 2GB of main
238238memory. However, due to the OpenRISC kernel not supporting highmem and some
239- other reserved address space, the main memory limit is about 768MiB ; which is
239+ other reserved address space, the main memory limit is about 768MB ; which is
240240plenty for OpenRISC embedded system.
241241
242242The physical address space looks like the follow:
243243
244244```
245- Address Range | Description
246- -------------------+---------------------------
247- 0x80000000 ~ (2GB) | IO space, not cached
248- -------------------+---------------------------
249- 0x00000000 ~ (2GB) | Physical RAM space, cached
245+ Address Range | Description
246+ -------------------- +---------------------------
247+ 0x80000000 ~ (2GB) | IO space, not cached
248+ -------------------- +---------------------------
249+ 0x00000000 ~ (2GB) | Physical RAM space, cached
250250```
251251
252252#### Virtual Memory
253253
254254Virtual memory in Linux is split between kernel space and user space as below.
255- There is 1GB reserved for the kernel, 2GB reserved for user space and a 1GB hole
255+ There is 1GB reserved for the kernel, 2GiB reserved for user space and a 1GiB hole
256256which we reserve for other purposes.
257257
258- OpenRISC uses 8kb pages.
258+ OpenRISC uses 8KB pages.
259259
260260```
261261| Address Range | Defines | Size | Usage
@@ -265,7 +265,7 @@ OpenRISC uses 8kb pages.
265265| 0xc0000000 - 0xf7fbffff | KERNELBASE | ~1GB | direct mapped, kernel space (30-bits)
266266+-------------------------+-------------------------------+-------+-------
267267| 0xbc000000 - 0xbfffffff | VMALLOC_START to VMALLOC_END) | 64MB | vmalloc/ioremap
268- | 0x80000000 - 0xbbffffff | | ~1GB | hole
268+ | 0x80000000 - 0xbbffffff | | ~1GB | Reserved
269269+-------------------------+-------------------------------+-------+------
270270| 0x00002000 - 0x7fffffff | TASK_SIZE | ~2GB | User space
271271| 0x00000000 - 0x00001fff | | 8KB | Unmapped page, NULL catch
@@ -426,5 +426,5 @@ We can see a few things looking at this map:
426426
427427We have gone over some of the internals of the OpenRISC Linux implementation.
428428We hope this helps you in the understanding of the fundamentals of embedded
429- Linux and will improve your understanding of the Linux bring up tutorials that
429+ Linux and will improve your understanding of the Linux bring- up tutorials that
430430follow.
0 commit comments