New tutorial, raspbootin for 64 bit

pull/4/head
bzt 6 years ago
parent 05bc1c0204
commit f5d935e936

@ -16,11 +16,11 @@ Hogy ezt megvalósítsuk, egy alacsonyabb címre linkeljük a kódot, és mivel
nekünk kell a módosított címre másolnunk magunkat. Fontos, hogy ezalatt csak relatív címzést használhatunk. Amikor
végeztünk, a 0x80000-as címen lévő memóriának használaton kívülinek kell lennie. Ajánlott a kódunkat minimalizálni, mivel
úgyis figyelmen kívül hagyja az újonnan betöltendő kód. Ezért kivettem az `uart_puts()` eljárást, így a teljes méret
1024 bájt alá csökkent. Ezt a következő paranccsal ellenőriztem:
1024 bájt alá csökkent. Ezt a következő paranccsal ellenőrizheted:
```sh
$ aarch64-elf-readelf -s kernel8.elf | grep __bss_end
21: 000000000007ffd0 0 NOTYPE GLOBAL DEFAULT 4 __bss_end
21: 000000000007ffc0 0 NOTYPE GLOBAL DEFAULT 4 __bss_end
```
Start

@ -13,14 +13,14 @@ If you want to send kernels from a Windows machine, I suggest to take a look at
In order to load the new kernel to the same address, we have to move ourself out of the way. It's called chain
loading: one code loads the next code to the same position in memory, therefore the latter thinks it was loaded
by the firmware. To implement that we use a different linking address this time, and since GPU loads us to 0x80000
regardless, we have to copy our code to that link address. That's important that we can only use relative addresses
regardless, we have to copy our code to that link address. What's important, that we can only use relative addresses
while doing so. When we're done, the memory at 0x80000 must be free to use. We also should minimize the size of the
loader, since it will be regarded by the newly loaded code anyway. By removing `uart_puts()` I've managed to shrink the
size below 1024 bytes. I've checked that with:
size below 1024 bytes. You can checked that with:
```sh
$ aarch64-elf-readelf -s kernel8.elf | grep __bss_end
21: 000000000007ffd0 0 NOTYPE GLOBAL DEFAULT 4 __bss_end
21: 000000000007ffc0 0 NOTYPE GLOBAL DEFAULT 4 __bss_end
```
Start

Binary file not shown.

@ -25,13 +25,10 @@
#include "uart.h"
// import our start address from linker
extern char _start;
void main()
{
int size=0;
char *kernel=(char*)&_start;
char *kernel=(char*)0x80000;
// set up serial console
uart_init();

Loading…
Cancel
Save