This repository has no description
0

Configure Feed

Select the types of activity you want to include in your feed.

update README

Ivan Ilak (Mar 19, 2023, 3:32 PM +0100) 5ef5fc09 bd483da7

+40 -51
+2
.gitignore
··· 7 7 8 8 **/.vscode 9 9 **/build 10 + 11 + **/export
+1 -1
.gitlab-ci.yml
··· 9 9 # - docker build -t $CI_REGISTRY_IMAGE . 10 10 # - docker push $CI_REGISTRY_IMAGE 11 11 12 - myapp: 12 + piOS: 13 13 image: rushmash/gcc-arm-embedded-docker:latest 14 14 stage: build 15 15 script:
-45
Dockerfile
··· 1 - FROM rushmash/gcc-arm-embedded-docker:latest AS base 2 - 3 - ARG BUILD_TYPE=Release 4 - ARG BUILD_DIR=build 5 - 6 - # RUN apk update && apk add \ 7 - # gdb-multiarch \ 8 - # wget \ 9 - # make cmake ninja-build bzip2 mc file 10 - 11 - # RUN mkdir /usr/opt/ 12 - # # RUN wget --directory-prefix=/usr/opt/ https://developer.arm.com/-/media/Files/downloads/gnu-a/10.3-2021.07/binrel/gcc-arm-10.3-2021.07-aarch64-aarch64-none-elf.tar.xz 13 - # # RUN mkdir -p /usr/opt/aarch64-none-elf 14 - # # RUN tar -xf /usr/opt/gcc-arm-10.3-2021.07-aarch64-aarch64-none-elf.tar.xz -C /usr/opt/aarch64-none-elf --strip-components=1 15 - # # RUN ln -s /usr/opt/aarch64-none-elf/bin/aarch64-none-elf-gcc /usr/bin/aarch64-none-elf-gcc 16 - # # RUN ln -s /usr/opt/aarch64-none-elf/bin/aarch64-none-elf-ar /usr/bin/aarch64-none-elf-ar 17 - # # RUN ln -s /usr/opt/aarch64-none-elf/bin/aarch64-none-elf-as /usr/bin/aarch64-none-elf-as 18 - # # RUN ln -s /usr/opt/aarch64-none-elf/bin/aarch64-none-elf-ld /usr/bin/aarch64-none-elf-ld 19 - # # RUN ln -s /usr/opt/aarch64-none-elf/bin/aarch64-none-elf-objcopy /usr/bin/aarch64-none-elf-objcopy 20 - 21 - 22 - # # ENV CC="/usr/bin/aarch64-none-elf-gcc" 23 - # # ENV CXX="/usr/bin/aarch64-none-elf-gcc" 24 - 25 - # RUN wget --directory-prefix=/usr/opt/ https://developer.arm.com/-/media/Files/downloads/gnu-rm/10.3-2021.10/gcc-arm-none-eabi-10.3-2021.10-aarch64-linux.tar.bz2 26 - # RUN mkdir -p /usr/opt/gcc-arm-none-eabi 27 - # RUN tar -xvjf /usr/opt/gcc-arm-none-eabi-10.3-2021.10-aarch64-linux.tar.bz2 -C /usr/opt/gcc-arm-none-eabi --strip-components=1 28 - # RUN ln -s /usr/opt/gcc-arm-none-eabi/bin/arm-none-eabi-gcc /usr/bin/arm-none-eabi-gcc 29 - # RUN ln -s /usr/opt/gcc-arm-none-eabi/bin/arm-none-eabi-ar /usr/bin/arm-none-eabi-ar 30 - # RUN ln -s /usr/opt/gcc-arm-none-eabi/bin/arm-none-eabi-as /usr/bin/arm-none-eabi-as 31 - # RUN ln -s /usr/opt/gcc-arm-none-eabi/bin/arm-none-eabi-ld /usr/bin/arm-none-eabi-ld 32 - # RUN ln -s /usr/opt/gcc-arm-none-eabi/bin/arm-none-eabi-objcopy /usr/bin/arm-none-eabi-objcopy 33 - 34 - WORKDIR /home/piOS 35 - 36 - # COPY . . 37 - 38 - # FROM base AS build 39 - 40 - # RUN rm -rf ./${BUILD_DIR} 41 - # RUN cmake -G Ninja -B ./${BUILD_DIR} -S . 42 - # RUN cmake --build ./${BUILD_DIR} 43 - 44 - # FROM scratch AS export-stage 45 - # COPY --from=build ./home/piOS/build/bin .
+37 -5
README.md
··· 1 1 # piOS 2 + ![pipeline](https://gitlab.example.com/iilak/pios/badges/master/pipeline.svg) 2 3 This project is trying to build a simple OS for the RaspberryPi Zero W. 3 4 I have zero experience with embedded SW-development and unfortunately also never had a change to look at it in university. This is a hobby project that I started to get some familiarity with the subject. 4 - I don't really have a clear goal, but I'm using other peoples projects on the internet as a reference and will see where it will take me... I have two RaspberryPi's (Zero W, Zero 2 W, and B+) and in the end I would like the code to run on all devices. 5 + I don't really have a clear goal, but I'm using other peoples projects on the internet as a reference and will see where it will take me... I have two RaspberryPi's (Zero W, Zero 2 W, and B+) and in the end I would like the code to run on all devices. 6 + 7 + [[_TOC_]] 5 8 6 9 ## Notes 7 10 Since I don't belive there is one perfect source for the relevant topics, I spend a lot of time reading code from others. ··· 10 13 I changed some things were I found it appropritate, but at the end of the day I think Thanos did a great job and since I'm just trying to learn more about the subject, this project was a godsend! 11 14 * [Bare metal Raspberry Pi 3 tutorials (*Zoltan Baldaszti*)](https://github.com/bztsrc/raspi3-tutorial/): Really nice tutorial that introduces the basic ways of how HW and SW should interact with each other. 12 15 13 - To build the project run 16 + ## How to build the project? 17 + As often with embedded projects, the toolchain hassle is real. The tricky part for this project is the compiler. Since we are writing code that is supposed to run on an ARM processor, you will need the corresponding compiler. All compilers to build for ARM CPU's can be found on [ARM's website](https://developer.arm.com/downloads/-/arm-gnu-toolchain-downloads). You will most probably have to cross-compile (`x86`->`arm`) and you will need to be careful if you are compiling the kernel for a `32-bit` or a `64-bit` CPU (`arm-none-eabi` vs `aarch64-none-elf`). 18 + 19 + Once you have all of this setup, you should be able to simple `cd` into the root of this repo and run (assuming you have `cmake` and `ninja-build` installed on your system) 14 20 ```bash 15 - DOCKER_BUILDKIT=1 docker build --progress=plain -f Dockerfile --rm -t pi_os:latest . --output ./export/ 21 + cmake -G Ninja -B ./build -S . 22 + cmake --build ./build 16 23 ``` 24 + If you like to use docker, you can also use this minimal `Dockerfile` (for the `32-bit` version): 25 + ```docker 26 + FROM rushmash/gcc-arm-embedded-docker:latest AS base 17 27 18 - To run it in `qemu` you can use 28 + ARG BUILD_DIR=build 29 + 30 + WORKDIR /home/piOS 31 + 32 + COPY . . 33 + 34 + FROM base AS build 35 + 36 + RUN rm -rf ./${BUILD_DIR} 37 + RUN cmake -G Ninja -B ./${BUILD_DIR} -S . 38 + RUN cmake --build ./${BUILD_DIR} 39 + 40 + FROM scratch AS export-stage 41 + COPY --from=build ./home/piOS/build/bin . 42 + 19 43 ``` 20 - qemu-system-arm -M raspi0 -serial null stdio -kernel .export/kernel7.elf 44 + and run it via 45 + ```bash 46 + DOCKER_BUILDKIT=1 docker build --progress=plain -f Dockerfile --rm -t pi_os:latest . --output ${PATH_TO_WHERE_YOU_WANT_THE_ELF_AND_IMG} 21 47 ``` 48 + 49 + ## How to run the kernel? 50 + While the ultimate goal of course is to run the kernel on a RaspberryPi, for development it is useful to also run it in `qemu`. For the `32-bit` version you can use 51 + ```bash 52 + qemu-system-arm -M raspi0 -serial null stdio -kernel ${PATH_TO_ELF_FILE}/kernel7.elf 53 + ```
export/.git-keep

This is a binary file and will not be displayed.