Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
building-snacklinux [2022/12/18 09:19] – snacsnoc | building-snacklinux [2022/12/19 05:05] (current) – snacsnoc | ||
---|---|---|---|
Line 1: | Line 1: | ||
- | (adapted from Github readme) | + | See [[https:// |
- | + | ||
- | # Build system | + | |
- | + | ||
- | * Linux is preferable to build with | + | |
- | + | ||
- | **Debian** | + | |
- | ``` | + | |
- | apt-get install build-essential git libgmp-dev libmpc-dev flex bison bc | + | |
- | ``` | + | |
- | Optional: | + | |
- | ``` | + | |
- | apt-get install genisoimage #used for generating x86 ISO images | + | |
- | ``` | + | |
- | + | ||
- | **Mac OS*** | + | |
- | * Mac OS is **incredibly** difficult to get working alone to build the kernel, otherwise cross-compiling packages works | + | |
- | * An alternative to a tradtional VM is to use something like [krunvm](https:// | + | |
- | + | ||
- | #### gcc | + | |
- | ``` | + | |
- | arch -arm64 brew install gcc@12 | + | |
- | ``` | + | |
- | + | ||
- | If you have an alternate version of gcc installed, create symlinks: | + | |
- | ``` | + | |
- | cd / | + | |
- | ln -s gcc-12 gcc | + | |
- | ln -s g++-12 g++ | + | |
- | ``` | + | |
- | + | ||
- | # Toolchain | + | |
- | + | ||
- | + | ||
- | ## Build your own | + | |
- | Compile your own toolchain with [musl-cross-make](https:// | + | |
- | + | ||
- | `git clone https:// | + | |
- | + | ||
- | ### arm64 | + | |
- | + | ||
- | ``` | + | |
- | TARGET=aarch64-linux-musl make | + | |
- | TARGET=aarch64-linux-musl make install | + | |
- | ``` | + | |
- | + | ||
- | ### x86 | + | |
- | + | ||
- | ``` | + | |
- | TARGET=i486-linux-musl make | + | |
- | TARGET=i486-linux-musl make install | + | |
- | ``` | + | |
- | + | ||
- | + | ||
- | ### TODO: | + | |
- | + | ||
- | + | ||
- | Installs to `output/` | + | |
- | Add the toolchain to your shell' | + | |
- | `export PATH=$PATH:/ | + | |
- | + | ||
- | # Building SnackLinux | + | |
- | + | ||
- | ## Environment vars | + | |
- | + | ||
- | `JOBS` Set number of parallel jobs to create, defaults to -j8 | + | |
- | Example | + | |
- | `make busybox JOBS=-j12` | + | |
- | + | ||
- | ### Architechtures | + | |
- | Change target arch by using switches with make: | + | |
- | ``` | + | |
- | arch=aarch64 | + | |
- | arch=x86 | + | |
- | arch=x86_64 | + | |
- | ``` | + | |
- | + | ||
- | Building for arm64: | + | |
- | + | ||
- | Example | + | |
- | `make busybox arch=aarch64 JOBS=-j4` | + | |
- | + | ||
- | Defaults to x86 | + | |
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | ## Versions | + | |
- | See `defs.sh` for kernel and package versions | + | |
- | + | ||
- | + | ||
- | ## Getting started | + | |
- | + | ||
- | + | ||
- | Download source tars and link | + | |
- | + | ||
- | `bash ./ | + | |
- | + | ||
- | Set the amount of parallel jobs to run when using make | + | |
- | ``` | + | |
- | export JOBS=j16 | + | |
- | ``` | + | |
- | + | ||
- | Compile the kernel | + | |
- | + | ||
- | ``` | + | |
- | make kernel | + | |
- | ``` | + | |
- | + | ||
- | Build musl, Bash and BusyBox | + | |
- | ``` | + | |
- | make system | + | |
- | ``` | + | |
- | + | ||
- | Install to `/ | + | |
- | + | ||
- | ``` | + | |
- | make install | + | |
- | ``` | + | |
- | + | ||
- | Next step: [booting](# | + | |
- | + | ||
- | + | ||
- | #### Compile individual packages | + | |
- | + | ||
- | + | ||
- | #### Linux - | + | |
- | + | ||
- | ``` | + | |
- | make kernel | + | |
- | ``` | + | |
- | + | ||
- | #### musl - | + | |
- | ``` | + | |
- | make musl | + | |
- | ``` | + | |
- | #### BusyBox - | + | |
- | + | ||
- | ``` | + | |
- | make busybox | + | |
- | ``` | + | |
- | + | ||
- | #### Bash - | + | |
- | + | ||
- | ``` | + | |
- | make bash | + | |
- | ``` | + | |
- | #### Binutils (optional) | + | |
- | + | ||
- | ``` | + | |
- | make binutils | + | |
- | ``` | + | |
- | + | ||
- | #### Syslinux | + | |
- | + | ||
- | ``` | + | |
- | make syslinux | + | |
- | ``` | + | |
- | + | ||
- | + | ||
- | If you would also like to install binutils, use: | + | |
- | + | ||
- | ``` | + | |
- | make binutils-install | + | |
- | ``` | + | |
- | + | ||
- | #### stripping symbols | + | |
- | + | ||
- | This target strips all debug symbols files matching LSB executable, shared object or ar archive | + | |
- | ``` | + | |
- | make arch=arm64 strip-fs | + | |
- | ``` | + | |
- | # Booting | + | |
- | Prerequisites: | + | |
- | ``` | + | |
- | #Base files (/etc) | + | |
- | git clone https:// | + | |
- | cp -R snacklinux-base/rootfs/* /opt/ | + | |
- | + | ||
- | # | + | |
- | ./ | + | |
- | + | ||
- | #fbpkg (package manager) | + | |
- | git clone https:// | + | |
- | cp fbpkg/ | + | |
- | ``` | + | |
- | ## ISO | + | |
- | + | ||
- | Run `make iso`. The output ISO will be in `iso/` | + | |
- | + | ||
- | Note: you do not have to have the toolchain to create the ISO | + | |
- | + | ||
- | ## qemu | + | |
- | Create a gzipped rootfs by running: | + | |
- | ``` | + | |
- | cd / | + | |
- | ``` | + | |
- | + | ||
- | Packages | + | |
- | ------- | + | |
- | Read the [Packages page](http:// | + | |
- | For SnackLinux' | + | |
- | + | ||
- | Hacking | + | |
- | ------- | + | |
- | Edit anything in `/ | + | |
- | The kernel can also be recompiled to fit your needs. | + | |
- | + | ||
- | The `boot/ | + |