Compare commits

..

11 Commits

Author SHA1 Message Date
Joel Severin
970e08b0d6
Merge pull request #9 from hmaerki/fix_readme
Fix the contained Docker images
2025-11-30 20:51:20 +01:00
Hans Maerki
c84810636a Dockerfile: Prevent git asking for user
Signed-off-by: Hans Maerki <buhtig.hans.maerki@ergoinfo.ch>
2025-11-30 05:38:25 +01:00
Hans Maerki
6f33d46d74 Dockerfile: Add missing packages
Signed-off-by: Hans Maerki <buhtig.hans.maerki@ergoinfo.ch>
2025-11-30 05:38:25 +01:00
Hans Maerki
4e892e9d7a README.md: Fix some typos. Add .dockerignore
Signed-off-by: Hans Maerki <buhtig.hans.maerki@ergoinfo.ch>
2025-11-30 05:38:25 +01:00
Joel Severin
1733c5ed43
Merge pull request #11 from Ggjorven/fix_typos
Fix typos in README
2025-11-29 12:27:55 +01:00
Jorben van der Wal
97b8381ad4
Fix typos in README. 2025-11-11 16:58:31 +01:00
Joel Severin
e3196f2cee
Merge pull request #7 from jeff-hykin/patch-1
Small typo fix of readme
2025-11-07 17:22:35 +01:00
Joel Severin
719cd8d974 Remove stray patch from linux-wasm.sh 2025-11-07 17:18:52 +01:00
Jeff Hykin
a70ff8846a
small typo fix 2025-11-06 08:05:38 -06:00
Joel Severin
3998897b81
Merge pull request #6 from aldoridhoni/patch-1
fix: remove duplicated word in sentence ("direct direct")
2025-11-05 20:41:03 +01:00
Aldo Ridhoni
5c93c77a6c
fix: remove duplicated word in sentence ("direct direct") 2025-11-05 10:43:10 +07:00
5 changed files with 21 additions and 14 deletions

3
.dockerignore Normal file
View File

@ -0,0 +1,3 @@
*
!patches/**
!linux-wasm.sh

View File

@ -1,5 +1,5 @@
# Scripts for Building a Linux/Wasm Operating System
This project contains scripts to download, build and run a Linux system that can executed on the web, using native WebAssembly (Wasm).
This project contains scripts to download, build and run a Linux system that can be executed on the web, using native WebAssembly (Wasm).
These scripts can be run in the following way:
* Directly on a host machine.
@ -27,7 +27,7 @@ The project is built and assembled from following pieces of software:
* A hack patch (minimal and incorrect) that:
* Adds Wasm as a target to musl (I guessed and cheated a lot on this one).
* Allows musl to be built using clang and wasm-ld (linker script support may be needed).
* Atifacts: musl libc
* Artifacts: musl libc
* Dependencies: clang, wasm-ld, compiler-rt
* Linux kernel headers for BusyBox
* Base version: from the kernel
@ -39,13 +39,13 @@ The project is built and assembled from following pieces of software:
* Base version: 1.36.1
* Patches:
* A hack patch (minimal and incomplete) that:
* Allows BuxyBox to be built using clang and wasm-ld (linker script support might be unnecessary).
* Allows BusyBox to be built using clang and wasm-ld (linker script support might be unnecessary).
* Adds a Wasm defconfig.
* Artifacts: BusyBox installation (base binary and symlinks for ls, cat, mv etc.)
* Dependencies: musl libc, modified headers for BusyBox
* A minimal initramfs:
* Notes:
* Packages up the busybox installation into a compessed cpio archive.
* Packages up the busybox installation into a compressed cpio archive.
* It sets up a pty for you (for proper signal/session/job management) and drops you into a shell.
* Artifacts: initramfs.cpio.gz
* Dependencies: BusyBox installation
@ -69,24 +69,24 @@ The following commands should be executed in this repo root.
There are two containers:
* **linux-wasm-base**: Contains an Ubuntu 20.04 environment with all tools installed for building (e.g. cmake, gcc etc.).
* **linux-wasm-contained**: Actually builds everything into the container. Meant as a dispoable way to build everything isolated.
* **linux-wasm-contained**: Actually builds everything into the container. Meant as a disposable way to build everything isolated.
Create the containers:
```
```bash
docker build -t linux-wasm-base:dev ./docker/linux-wasm-base
docker build -t linux-wasm-contained:dev ./docker/linux-wasm-contained
docker build -t linux-wasm-contained:dev -f ./docker/linux-wasm-contained/Dockerfile .
```
Note that the latter command will copy linux-wasm.sh, in its current state, into the container.
To launch a simple docker container with a mapping to host (recommended for development):
```
```bash
docker run -it --name my-linux-wasm --mount type=bind,src="$(pwd)",target=/linux-wasm linux-wasm-base:dev bash
(Inside the bash prompt, run for example:) /linux-wasm/linux-wasm.sh all
```
To actually build everything inside the container (mostly useful for build servers):
```
docker run -it -name full-linux-wasm linux-wasm-contained:dev /linux-wasm/linux-wasm.sh all
```bash
docker run -it --name full-linux-wasm linux-wasm-contained:dev /linux-wasm/linux-wasm.sh all
```
To change workspace folder, docker run -e LW_WORKSPACE=/path/to/workspace ...blah... can be used. This may be useful together with docker volumes.

View File

@ -12,5 +12,10 @@ RUN apt update && \
apt update && \
test -f /usr/share/doc/kitware-archive-keyring/copyright || rm /usr/share/keyrings/kitware-archive-keyring.gpg && \
apt install -y kitware-archive-keyring && \
apt install -y build-essential git cmake ninja-build && \
apt install -y build-essential git cmake ninja-build python3 flex bison bc rsync cpio && \
rm -rf /var/lib/apt/lists/*
# Prevent git asking for user
# Corresponds to:
RUN git config --system user.email "you@example.com"
RUN git config --system user.name "Your Name"

View File

@ -53,7 +53,6 @@ case "$1" in # note use of ;;& meaning that each case is re-tested (can hit mult
"fetch-kernel"|"all-kernel"|"fetch"|"all")
mkdir -p "$LW_SRC/kernel"
git clone -b v6.4.16 $LW_GITFLAGS https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git "$LW_SRC/kernel"
git -C "$LW_SRC/kernel" am < "$LW_ROOT/patches/kernel/0009-HACK-Workaround-broken-wq_worker_comm.patch"
git -C "$LW_SRC/kernel" am < "$LW_ROOT/patches/kernel/0001-Always-access-the-instruction-pointer-intrinsic-via-.patch"
git -C "$LW_SRC/kernel" am < "$LW_ROOT/patches/kernel/0002-Allow-architecture-specific-panic-handling.patch"
git -C "$LW_SRC/kernel" am < "$LW_ROOT/patches/kernel/0003-Add-missing-processor.h-include-for-asm-generic-barr.patch"

View File

@ -193,7 +193,7 @@ Examples: ls watch uptime head /proc/cpuinfo
<p>
Linux in the browser has been done a few times before, either by slow emulation of other architectures in Wasm or
even pure JavaScript, or by running Linux as a library (LKL aka. um). Such attempts have inspired this more direct
direct approach. The goal is to expose the syscalls that the Linux kernel provides. This should allow porting of
approach. The goal is to expose the syscalls that the Linux kernel provides. This should allow porting of
many more programs than possible with WASI or the current generation of Emscripten. Note that a program does not
necessarily have to run as a process inside Linux either, you could have just one (or a few) frontend threads that
you use for syscalls, possibly via some kind of message passing. This way, your program does not have to live