Skip to content

Commit bad4a2b

Browse files
committed
Updated Docker Image
1 parent 89248ab commit bad4a2b

File tree

8 files changed

+42
-33
lines changed

8 files changed

+42
-33
lines changed

Documentation/Build/Building-Lemon-OS-with-Docker.md

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
1-
# OUTDATED!
1+
# Building Lemon OS with Docker
22

33
## Prerequisites
44
* A UNIX-like build system
55
* Docker
6-
* qemu-img
76

87
Install the following (Arch) packages:\
98
`git`, `docker`\
@@ -20,10 +19,20 @@ Make sure you use `--recurse-submodules` to get the submodules
2019
Run ```Scripts/docker-configure.sh``` this will do the following:
2120
* Pull the docker image
2221
* Configure the meson projects
23-
* Build most of the various ports
22+
* Build the essential ports
23+
24+
## Build the system
25+
Run ```Scripts/docker-run.sh ninja -C Build install```
2426

2527
## Creating/Obtaining disk image
26-
Install the GRUB package for your distro and run `Scripts/createdisk.sh`. This will create a disk image with limine as BIOS bootloader and GRUB for EFI
28+
Run `Scripts/createdisk.sh`. \
29+
This will create `Disks/Lemon.img` with limine as BIOS and EFI bootloader if it does not exist. Then it will copy the built system files to the disk. For now this will have to be run on the host system.
30+
31+
## Running
32+
[Refer to Building Lemon OS](Building-Lemon-OS.md)
2733

28-
## Finally build and run
29-
In the main directory run `./docker-make all` to build everything. Finally `./docker-make run` to run Lemon OS with QEMU/KVM, or run Disks/Lemon.img in your favourite VM.
34+
## Building Ports
35+
Run
36+
```sh
37+
Scripts/docker-run.sh Ports/buildport.sh <port name> # e.g. ./buildport.sh nyancat
38+
```

Documentation/Build/Building-Lemon-OS.md

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
*~~It is recommended that you [build with docker](Building-Lemon-OS-with-Docker.md), building the toolchain will takes a long time.~~ Docker build Outdated*
1+
### *Building the toolchain can take an extremely long time, a Docker image has been built. Consider [Building Lemon OS with Docker](Building-Lemon-OS-with-Docker.md)*
2+
3+
24

35
## Prerequisites
46
_NOTE: Building on WSL2 is doable, however I strongly recommend an actual UNIX system._
@@ -56,15 +58,15 @@ ninja disk
5658
```
5759

5860
### Running with QEMU/KVM
59-
To run with QEMU run `ninja run`
61+
To run with QEMU run `Scripts/run.sh`
6062
```sh
61-
ninja run
63+
Scripts/run.sh
6264
```
6365

6466
### Running with VirtualBox
65-
To run with VirtualBox create a vm called "LemonOS". You'll need to symlink `Disks/Lemon.img` to `Disks/Lemon.hdd` Then run `ninja run-vbox`
67+
To run with VirtualBox create a vm called "LemonOS". You'll need to symlink `Disks/Lemon.img` to `Disks/Lemon.hdd` as VirtualBox cannot use `.img` files.
6668
```sh
67-
ninja run-vbox
69+
Scripts/run.sh vbox
6870
```
6971

7072
## Building Ports

README.md

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,17 +11,16 @@ If you have any questions or concerns feel free to open a GitHub issue, join our
1111
[Discord Server](https://discord.gg/NAYp6AUYWM)
1212

1313
## Building
14-
- [Building Lemon OS](Documentation/Build/Building-Lemon-OS.md)
15-
- [Building Lemon OS with Docker (Outdated)](Documentation/Build/Building-Lemon-OS-with-Docker.md)
14+
- [Building Lemon OS (Requires building toolchain)](Documentation/Build/Building-Lemon-OS.md)
15+
- [Building Lemon OS with Docker](Documentation/Build/Building-Lemon-OS-with-Docker.md)
1616

1717
## Prebuilt Image
1818
[Nightly Images](https://github.com/LemonOSProject/LemonOS/actions/workflows/ci.yml?query=is%3Asuccess+branch%3Amaster) - Go to latest job, `Lemon.img` located under Artifacts\
19-
[Latest Release](https://github.com/LemonOSProject/LemonOS/releases/latest)
2019

2120
**Before running**
2221
See [System Requirements](#system-requirements)
2322

24-
![Lemon OS Screenshot](Screenshots/image8.png)\
23+
![Lemon OS Screenshot](Screenshots/image9.png)\
2524
[More screenshots](Screenshots)
2625
## Features
2726
- Modular Kernel

Screenshots/image9.png

546 KB
Loading

Scripts/Dockerfile

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
FROM alpine:3.12
22

3-
RUN apk add --no-cache nasm python3 ninja make cmake automake autoconf libtool make gcc g++ musl-dev git curl patch
3+
RUN apk add --no-cache nasm python3 ninja make cmake automake autoconf libtool make gcc g++ musl-dev git curl patch e2fsprogs dosfstools
44

55
RUN cd /root && curl https://raw.githubusercontent.com/fido2020/Lemon-OS/master/Toolchain/buildtoolchain.sh -o buildtoolchain.sh && curl https://raw.githubusercontent.com/fido2020/Lemon-OS/master/Toolchain/lemon-binutils-2.32.patch -o lemon-binutils-2.32.patch && chmod 755 /root/buildtoolchain.sh
66

77
RUN /root/buildtoolchain.sh prepare
88
RUN /root/buildtoolchain.sh binutils
99
RUN /root/buildtoolchain.sh llvm CC=gcc CXX=g++
1010
RUN /root/buildtoolchain.sh limine
11-
RUN if [ ! -f "/root/.local/share/lemon/bin/clang" ]; then ninja -C /root/llvm-project/build install; fi && ln -sf /root/.local/share/lemon/bin/clang /root/.local/share/lemon/bin/lemon-clang && ln -sf /root/.local/share/lemon/bin/clang++ /root/.local/share/lemon/bin/lemon-clang++ && ln -sf ../../include/c++ /root/.local/share/lemon/sysroot/system/include/c++
12-
13-
RUN apk del g++ && /root/buildtoolchain.sh clean && python3 -m ensurepip --default-pip && python3 -m pip install meson && chmod -R a+rx /root
11+
RUN if [ ! -f "/root/.local/share/lemon/bin/clang" ]; then ninja -C /root/llvm-project/build install; fi && ln -sf /root/.local/share/lemon/bin/clang /root/.local/share/lemon/bin/lemon-clang && ln -sf /root/.local/share/lemon/bin/clang++ /root/.local/share/lemon/bin/lemon-clang++ && ln -sf ../../include/c++ /root/.local/share/lemon/sysroot/system/include/c++ \
12+
&& cd /root/.local/share/lemon/bin && rm clang-repl clang-scan-deps clang-check clang-refactor clang-rename clang-extdef-mapping diagtool \
13+
&& /root/buildtoolchain.sh clean && python3 -m ensurepip --default-pip && python3 -m pip install meson && chmod -R a+rx /root
1414

1515
ENV PATH=$PATH:/root/.local/share/lemon/bin:/root/.local/share/lemon/x86_64-lemon/bin/

Scripts/buildinterfaces.sh

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,30 +2,26 @@
22

33
set -e
44

5-
if [ -z $LEMOND ]; then
6-
export LEMOND=$(dirname $(readlink -f "$0"))/..
7-
fi
8-
9-
if [ -z "$LEMON_SYSROOT" ]; then
10-
export LEMON_SYSROOT=$HOME/.local/share/lemon/sysroot
11-
fi
5+
SPATH=$(dirname $(readlink -f "$0"))
6+
source $SPATH/env.sh
127

138
INCLUDEDIR="$LEMON_SYSROOT/system/include/Lemon/Services/"
149

15-
LIC="$LEMOND/InterfaceCompiler/lic"
16-
LIC_SRC="$LEMOND/InterfaceCompiler/main.cpp"
10+
LIC="$LEMON_BUILDROOT/InterfaceCompiler/lic"
11+
LIC_SRC="$LEMON_BUILDROOT/InterfaceCompiler/main.cpp"
1712

1813
WD="$(pwd)"
1914

2015
if ! [ -f "$LIC" ] || [ "$LIC_SRC" -nt "$LIC" ]; then # If the lic executable doesent exist or is older than source, build it
21-
cd "$LEMOND/InterfaceCompiler"
16+
echo "Rebuilding $LIC_SRC"
17+
cd "$LEMON_BUILDROOT/InterfaceCompiler"
2218
./build.sh
2319
cd "$WD"
2420
fi
2521

2622

2723
mkdir -p "$INCLUDEDIR"
28-
cd "$LEMOND/Services"
24+
cd "$LEMON_BUILDROOT/Services"
2925

3026
"$LIC" lemon.lemond.li "$INCLUDEDIR/lemon.lemond.h"
3127
"$LIC" lemon.networkgovernor.li "$INCLUDEDIR/lemon.networkgovernor.h"

Scripts/configure.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,4 +48,7 @@ cd "$LEMON_BUILDROOT/Ports"
4848
cd $SPATH/..
4949

5050
meson Build --cross $SPATH/lemon-crossfile.txt
51+
5152
$SPATH/buildinterfaces.sh
53+
54+
>&2 echo "Done configuring system."

Scripts/docker-configure.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
SPATH=$(dirname $(readlink -f "$0"))
22

3-
cd $SPATH/..
4-
export LEMONDIR=$(pwd)
3+
cd $SPATH
4+
source ./env.sh
55

66
mkdir -p $HOME/.local/share/lemon/sysroot/system
77
mkdir -p $HOME/.local/share/lemon/sysroot/system/include
88
mkdir -p $HOME/.local/share/lemon/sysroot/system/lib
99
mkdir -p $HOME/.local/share/lemon/sysroot/system/bin
1010

1111
docker pull computerfido/lemontoolchain:latest
12-
docker run -v $(pwd):$(pwd) -v "$HOME/.local/share/lemon/sysroot":"/root/.local/share/lemon/sysroot" -w $(pwd) --user $(id -u):$(id -g) -it computerfido/lemontoolchain:latest sh -c "HOME=/root LEMON_SYSROOT=/root/.local/share/lemon/sysroot $LEMONDIR/Scripts/configure.sh"
12+
./docker-run.sh "$LEMON_BUILDROOT/Scripts/configure.sh"

0 commit comments

Comments
 (0)