From e62142f516fc75ac4fe8e1fd17ca59283f90a1b1 Mon Sep 17 00:00:00 2001 From: Adam Greenwood-Byrne Date: Thu, 13 May 2021 12:07:17 +0100 Subject: [PATCH] Added a note about building a cross-compiler from source, with a link --- RPI-BUILD.md | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/RPI-BUILD.md b/RPI-BUILD.md index 787162b..265c18e 100644 --- a/RPI-BUILD.md +++ b/RPI-BUILD.md @@ -6,7 +6,7 @@ Building on the RPi4 itself It's possible (but not super-simple) to follow this tutorial on the Raspberry Pi without need for an additional build device. -It will require you firstly to re-image your Pi to use the 64-bit Raspberry Pi OS (Beta): +Perhaps the easiest route is to firstly re-image your Pi to use the 64-bit Raspberry Pi OS (Beta), and then use a pre-built cross-compiler: * Download a zipped _.img_ image file from the [64-bit image list](https://downloads.raspberrypi.org/raspios_arm64/images/), picking the newest update * Unzip it and use the [Raspberry Pi Imager](https://www.raspberrypi.org/software/) to write it to your SD card, selecting "Use custom" from the options and pointing it at your downloaded _.img_ file @@ -19,12 +19,14 @@ What you're looking for is the current [AArch64 ELF bare-metal target (aarch64-n Then unpack the archive using `tar -xf `. You'll end up with a _gcc_ directory (albeit with a slightly longer name), which itself contains a _bin_ subdirectory, wherein you'll find the _gcc_ executable (again - with a longer name!). Remember this path. +Note: if you don't want to re-image, you can [build a cross-compiler yourself](https://wiki.osdev.org/GCC_Cross-Compiler). + Now let's build something: * Use `git` to clone this repo: `git clone https://github.com/isometimes/rpi4-osdev.git` * Decide which part you want to build - I like testing with _part5-framebuffer_ (it's visual, so you'll know when it works!) * Copy the _Makefile.gcc_ to _Makefile_ - * Edit the _Makefile_ and ensure the `GCCPATH` variable points to the _bin_ subdirectory that you just unpacked + * Edit the _Makefile_ and ensure the `GCCPATH` variable points to the _bin_ subdirectory where your cross-compiler is to be found * Type `make` at the command line and it should build without errors If you want to then boot with this, you'll need to copy the _kernel8.img_ file to a prepped SD card as the tutorial discusses. For the purposes of testing this process, I did the following (NOTE: it will trash your OS install unless you backup the old files so you can move them back later):