-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* new User Guide section * compile-kernel page * build-initramfs page Signed-off-by: RedbeanGit <dubois.julien.mail@gmail.com>
- Loading branch information
1 parent
8dec1c9
commit a675ef6
Showing
8 changed files
with
179 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,5 @@ | ||
{ | ||
"-- Getting Started --": { | ||
"type": "separator", | ||
"title": "Getting Started" | ||
}, | ||
"index": "Introduction" | ||
"index": "Introduction", | ||
"getting-started": "Getting Started", | ||
"user-guide": "User Guide" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
{} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
{ | ||
"compile-kernel": "Compiling the Kernel", | ||
"build-initramfs": "Build initramfs" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,115 @@ | ||
import Image from 'next/image'; | ||
import Link from 'next/link'; | ||
import InitramfsComponentsImage from '../../../public/images/schemas/initramfs-components.png'; | ||
|
||
# Building initramfs | ||
|
||
Requirements: | ||
|
||
- [Rust toolchain](https://www.rust-lang.org/fr/learn/get-started) | ||
|
||
## Introduction | ||
|
||
Lambdo uses custom initramfs builded from Docker images. You can build it by | ||
yourself or use prebuilt one. | ||
|
||
## Lambdo initramfs structure | ||
|
||
Lambdo initramfs contains at least 3 components: | ||
|
||
- **init** - init process which starts all other processes. | ||
- **agent** - agent process which is responsible for communication with Lambdo | ||
API. | ||
- **config.yaml** - configuration file which contains all necessary | ||
configuration for Lambdo agent (see | ||
[Configuration documentation](/docs/reference/configuration)). | ||
|
||
<div className="col-span-2 flex items-center justify-center py-2"> | ||
<Image | ||
src={InitramfsComponentsImage} | ||
alt="Initramfs components" | ||
width={500} | ||
height={500} | ||
/> | ||
</div> | ||
|
||
## Preparation | ||
|
||
Create an empty directory for initramfs: | ||
|
||
```bash copy | ||
mkdir initramfs | ||
``` | ||
|
||
Clone `lambdo` repository: | ||
|
||
```bash copy | ||
git clone https://github.com/faast-rt/lambdo.git | ||
``` | ||
|
||
## Build Lambdo agent | ||
|
||
Build Lambdo agent and move it to initramfs directory: | ||
|
||
```bash copy | ||
cd lambdo/agent | ||
cargo build --release | ||
cd ../.. | ||
mv lambdo/target/release/agent initramfs | ||
``` | ||
|
||
## Write init script | ||
|
||
You can write your own script or use example one (must be named `init`): | ||
|
||
```bash copy filename="initramfs/init" | ||
#! /bin/sh | ||
mount -t devtmpfs dev /dev | ||
mount -t proc proc /proc | ||
mount -t sysfs sysfs /sys | ||
ip link set up dev lo | ||
|
||
exec /agent --config /config.yaml | ||
|
||
exit | ||
poweroff -f | ||
``` | ||
|
||
> **Note 1:** Your init script must be executable. | ||
> **Note 2:** Your init script must start agent process. | ||
## Write configuration file | ||
|
||
You can write your own configuration file or use example one (must be named | ||
`config.yaml`): | ||
|
||
```yaml copy filename="initramfs/config.yaml" | ||
apiVersion: lambdo.io/v1alpha1 | ||
kind: AgentConfig | ||
serial: | ||
path: /dev/pts/6 | ||
baudRate: 9600 | ||
``` | ||
## Build initramfs by yourself | ||
Build initramfs tool and move it to initramfs directory: | ||
```bash copy | ||
cd lambdo/initramfs | ||
cargo build --release | ||
cd ../.. | ||
mv lambdo/target/release/initramfs initramfs | ||
``` | ||
|
||
Run initramfs tool (replace `node:20-alpine` with the image of the language you | ||
want): | ||
|
||
```bash copy | ||
cd initramfs | ||
./initramfs --image node:20-alpine | ||
``` | ||
|
||
**The image built here is stored at | ||
`initramfs/initramfs-library-node-20-alpine.img`.** |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
# Compiling Linux kernel | ||
|
||
Lambdo uses a Linux kernel compiled from source. This is a guide to compile the | ||
kernel. | ||
|
||
## Install dependencies | ||
|
||
#### Debian/Ubuntu | ||
|
||
```bash copy filename="bash" | ||
sudo apt update | ||
sudo apt install git build-essential bc flex bison | ||
``` | ||
|
||
#### Fedora/RHEL/CentOS | ||
|
||
```bash copy filename="bash" | ||
sudo dnf install git gcc make xz bc flex bison diffutils | ||
``` | ||
|
||
#### Arch Linux | ||
|
||
```bash copy filename="bash" | ||
sudo pacman -Syu | ||
sudo pacman -S git gcc make xz bc flex bison diffutils | ||
``` | ||
|
||
## Build the kernel | ||
|
||
Clone the Linux kernel official repository: | ||
|
||
```bash copy filename="bash" | ||
git clone https://github.com/torvalds/linux.git | ||
``` | ||
|
||
Generate the default configuration: | ||
|
||
```bash copy filename="bash" | ||
cd linux | ||
sudo make tinyconfig | ||
``` | ||
|
||
Compile the kernel: | ||
|
||
```bash copy filename="bash" | ||
KCFLAGS="-Wa,-mx86-used-note=no" sudo make bzImage -j `nproc` | ||
``` | ||
|
||
**The image is located at `arch/x86/boot/compressed/vmlinux.bin`** |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.