Merge branch 'master' of https://gitlab.redox-os.org/redox-os/redox
This commit is contained in:
commit
35832abf8a
6
Makefile
6
Makefile
|
@ -64,9 +64,13 @@ include mk/virtualbox.mk
|
||||||
# CI
|
# CI
|
||||||
include mk/ci.mk
|
include mk/ci.mk
|
||||||
|
|
||||||
env: prefix FORCE
|
env: prefix FORCE $(CONTAINER_TAG)
|
||||||
|
ifeq ($(PODMAN_BUILD),1)
|
||||||
|
$(PODMAN_RUN) $(MAKE) $@
|
||||||
|
else
|
||||||
export PATH="$(PREFIX_PATH):$$PATH" && \
|
export PATH="$(PREFIX_PATH):$$PATH" && \
|
||||||
bash
|
bash
|
||||||
|
endif
|
||||||
|
|
||||||
gdb: FORCE
|
gdb: FORCE
|
||||||
gdb cookbook/recipes/kernel/build/kernel.sym --eval-command="target remote localhost:1234"
|
gdb cookbook/recipes/kernel/build/kernel.sym --eval-command="target remote localhost:1234"
|
||||||
|
|
14
build.sh
14
build.sh
|
@ -11,16 +11,16 @@ usage()
|
||||||
echo "build.sh: Invoke make for a particular architecture and configuration."
|
echo "build.sh: Invoke make for a particular architecture and configuration."
|
||||||
echo "Usage:"
|
echo "Usage:"
|
||||||
echo "./build.sh [-X | -A | -6 | -a ARCH] [-c CONFIG] [-f FILESYSTEM_CONFIG] TARGET..."
|
echo "./build.sh [-X | -A | -6 | -a ARCH] [-c CONFIG] [-f FILESYSTEM_CONFIG] TARGET..."
|
||||||
echo " -X Equivalent to -a x86_64 (see below)."
|
echo " -X Equivalent to -a x86_64."
|
||||||
echo " -A Equivalent to -a aarch64 (see below)."
|
echo " -A Equivalent to -a aarch64."
|
||||||
echo " -6 Equivalent to -a i686 (see below)."
|
echo " -6 Equivalent to -a i686."
|
||||||
echo " -a ARCH: Processor Architecture. Normally one of x86_64, aarch64 or"
|
echo " -a ARCH: Processor Architecture. Normally one of x86_64, aarch64 or"
|
||||||
echo " i686. ARCH is not checked, so you can add a new architecture."
|
echo " i686. ARCH is not checked, so you can add a new architecture."
|
||||||
echo " Defaults to the directory containing the FILESYSTEM_CONFIG file,"
|
echo " Defaults to the directory containing the FILESYSTEM_CONFIG file,"
|
||||||
echo " or x86_64 if no FILESYSTEM_CONFIG is specified."
|
echo " or x86_64 if no FILESYSTEM_CONFIG is specified."
|
||||||
echo " -c CONFIG: The name of the config, e.g. desktop, server or demo."
|
echo " -c CONFIG: The name of the config, e.g. desktop, server or demo."
|
||||||
echo " Determines the name of the image, build/ARCH/CONFIG_harddrive.img"
|
echo " Determines the name of the image, build/ARCH/CONFIG/harddrive.img"
|
||||||
echo " e.g. build/x86_64/desktop_harddrive.img"
|
echo " e.g. build/x86_64/desktop/harddrive.img"
|
||||||
echo " Determines the name of FILESYSTEM_CONFIG if none is specified."
|
echo " Determines the name of FILESYSTEM_CONFIG if none is specified."
|
||||||
echo " Defaults to the basename of FILESYSTEM_CONFIG, or 'desktop'"
|
echo " Defaults to the basename of FILESYSTEM_CONFIG, or 'desktop'"
|
||||||
echo " if FILESYSTEM_CONFIG is not specified."
|
echo " if FILESYSTEM_CONFIG is not specified."
|
||||||
|
@ -32,8 +32,8 @@ usage()
|
||||||
echo " config/ARCH/CONFIG.toml"
|
echo " config/ARCH/CONFIG.toml"
|
||||||
echo " If you specify both CONFIG and FILESYSTEM_CONFIG, it is not"
|
echo " If you specify both CONFIG and FILESYSTEM_CONFIG, it is not"
|
||||||
echo " necessary that they match, but it is recommended."
|
echo " necessary that they match, but it is recommended."
|
||||||
echo " Examples: ./build.sh -c demo live - make build/x86_64/demo_livedisk.iso"
|
echo " Examples: ./build.sh -c demo live - make build/x86_64/demo/livedisk.iso"
|
||||||
echo " ./build.sh -6 qemu - make build/i686/desktop_harddrive.img and"
|
echo " ./build.sh -6 qemu - make build/i686/desktop/harddrive.img and"
|
||||||
echo " and run it in qemu"
|
echo " and run it in qemu"
|
||||||
echo " NOTE: If you do not change ARCH or CONFIG very often, edit mk/config.mk"
|
echo " NOTE: If you do not change ARCH or CONFIG very often, edit mk/config.mk"
|
||||||
echo " and set ARCH and FILESYSTEM_CONFIG. You only need to use this"
|
echo " and set ARCH and FILESYSTEM_CONFIG. You only need to use this"
|
||||||
|
|
|
@ -12,7 +12,7 @@ CONTAINER_WORKDIR?=/mnt/redox
|
||||||
PODMAN_VOLUMES?=--volume "`pwd`":$(CONTAINER_WORKDIR):Z
|
PODMAN_VOLUMES?=--volume "`pwd`":$(CONTAINER_WORKDIR):Z
|
||||||
PODMAN_ENV?=--env PATH=/home/poduser/.cargo/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin --env PODMAN_BUILD=0
|
PODMAN_ENV?=--env PATH=/home/poduser/.cargo/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin --env PODMAN_BUILD=0
|
||||||
PODMAN_CONFIG?=--env ARCH=$(ARCH) --env CONFIG_NAME=$(CONFIG_NAME) --env FILESYSTEM_CONFIG=$(FILESYSTEM_CONFIG)
|
PODMAN_CONFIG?=--env ARCH=$(ARCH) --env CONFIG_NAME=$(CONFIG_NAME) --env FILESYSTEM_CONFIG=$(FILESYSTEM_CONFIG)
|
||||||
PODMAN_OPTIONS?=--rm --workdir $(CONTAINER_WORKDIR) --userns keep-id --user `id -u` --interactive
|
PODMAN_OPTIONS?=--rm --workdir $(CONTAINER_WORKDIR) --userns keep-id --user `id -u` --interactive --tty --env TERM=$(TERM)
|
||||||
PODMAN_RUN?=podman run $(PODMAN_OPTIONS) $(PODMAN_VOLUMES) $(PODMAN_ENV) $(PODMAN_CONFIG) $(IMAGE_TAG)
|
PODMAN_RUN?=podman run $(PODMAN_OPTIONS) $(PODMAN_VOLUMES) $(PODMAN_ENV) $(PODMAN_CONFIG) $(IMAGE_TAG)
|
||||||
|
|
||||||
container_shell: build/container.tag
|
container_shell: build/container.tag
|
||||||
|
|
|
@ -101,7 +101,7 @@ sudo dnf install podman
|
||||||
|
|
||||||
**Podman** is a container that executes a virtual machine image. In our case, we are creating an **Ubuntu** image, with a **Rust** installation and all the packages needed to build the system.
|
**Podman** is a container that executes a virtual machine image. In our case, we are creating an **Ubuntu** image, with a **Rust** installation and all the packages needed to build the system.
|
||||||
|
|
||||||
The build process is performed in your normal working directory, e.g. `~/tryredox/redox`. Compilation of the Redox components is performed in the container, but the final Redox image (`build/harddrive.img` or `build/livedisk.iso`) is constructed using [Fuse](https://github.com/libfuse/libfuse) running directly on your host machine.
|
The build process is performed in your normal working directory, e.g. `~/tryredox/redox`. Compilation of the Redox components is performed in the container, but the final Redox image (`build/ARCH/CONFIG/harddrive.img` or `build/ARCH/CONFIG/livedisk.iso`) is constructed using [Fuse](https://github.com/libfuse/libfuse) running directly on your host machine.
|
||||||
|
|
||||||
Setting `PODMAN_BUILD` to 1 in the environment (e.g. `PODMAN_BUILD=1 make all`) or in `mk/config.mk` will cause **Podman** to be invoked when building.
|
Setting `PODMAN_BUILD` to 1 in the environment (e.g. `PODMAN_BUILD=1 make all`) or in `mk/config.mk` will cause **Podman** to be invoked when building.
|
||||||
|
|
||||||
|
@ -113,21 +113,21 @@ The build process is using **Podman**'s `keep-id` feature, which allows your reg
|
||||||
|
|
||||||
### NOTES
|
### NOTES
|
||||||
|
|
||||||
- Envionment and Command Line Variables are not passed to the part of `make` that is done in **Podman**. You must set any config variables in `mk/config.mk` and not on the command line or in your environment.
|
- Envionment and Command Line Variables, other than ARCH, CONFIG_NAME and FILESYSTEM_CONFIG, are not passed to the part of `make` that is done in **Podman**. You must set any other config variables in `mk/config.mk` and not on the command line or in your environment.
|
||||||
|
|
||||||
- If you are building your own software to include in Redox, and you need to install additional packages using `apt-get` for the build, follow [Adding Packages to the Build](#adding-packages-to-the-build).
|
- If you are building your own software to include in Redox, and you need to install additional packages using `apt-get` for the build, follow [Adding Packages to the Build](#adding-packages-to-the-build).
|
||||||
|
|
||||||
## build/container.tag
|
## build/container.tag
|
||||||
|
|
||||||
The building of the **image** is controlled by the *tag file* `build/container.tag`. If you run `make all` with **PODMAN_BUILD=1**, the file `build/container.tag` will be created after the **image** is built. This file tells `make` that it can skip updating the **image** after the first time.
|
The building of the **image** is controlled by the *tag* file `build/container.tag`. If you run `make all` with **PODMAN_BUILD=1**, the file `build/container.tag` will be created after the **image** is built. This file tells `make` that it can skip updating the **image** after the first time.
|
||||||
|
|
||||||
Many targets in the Makefiles `mk/*.mk` include `build/container.tag` as a dependency. If the *tag file* is missing, building any of those targets may trigger an image to be created, which can take some time.
|
Many targets in the Makefiles `mk/*.mk` include `build/container.tag` as a dependency. If the *tag* file is missing, building any of those targets may trigger an image to be created, which can take some time.
|
||||||
|
|
||||||
When you move to a new working directory, if you want to save a few minutes, and you are confident that your **image** is correct, you can do
|
When you move to a new working directory, if you want to save a few minutes, and you are confident that your **image** is correct, you can do
|
||||||
```sh
|
```sh
|
||||||
make container_touch
|
make container_touch
|
||||||
```
|
```
|
||||||
This will create the file `build/container.tag`. However, it will fail if the image does not exist. If it fails, just do a normal `make`, it will create the container when needed.
|
This will create the file `build/container.tag` without rebuilding the image. However, it will fail if the image does not exist. If it fails, just do a normal `make`, it will create the container when needed.
|
||||||
|
|
||||||
## Cleaning Up
|
## Cleaning Up
|
||||||
|
|
||||||
|
@ -147,7 +147,7 @@ podman system reset
|
||||||
```
|
```
|
||||||
will remove **all** images and containers. You still may need to remove `build/container.tag` if you did not do `make container_clean`.
|
will remove **all** images and containers. You still may need to remove `build/container.tag` if you did not do `make container_clean`.
|
||||||
|
|
||||||
**Note:** `make clean` invokes `cargo clean` on various components, and since the build is designed to not require **Cargo** on your host machine, it must run `cargo clean` in a container, and could trigger an image build. Also, note that `make clean` does **not** run `make container_clean` and will **not** remove the contianer image.
|
**Note:** `make clean` could trigger an image build. It invokes `cargo clean` on various components, which it must run in a container, since the build is designed to not require **Cargo** on your host machine. `make clean` does **not** run `make container_clean` and will **not** remove the container image.
|
||||||
|
|
||||||
## Debugging your Build Process
|
## Debugging your Build Process
|
||||||
|
|
||||||
|
@ -158,7 +158,11 @@ make container_shell
|
||||||
|
|
||||||
This will start a `bash` shell in the **Podman** container environment, as a normal user without `sudo` privilege. Within that environment, you can build the Redox components with:
|
This will start a `bash` shell in the **Podman** container environment, as a normal user without `sudo` privilege. Within that environment, you can build the Redox components with:
|
||||||
```sh
|
```sh
|
||||||
make build/repo.tag
|
make repo
|
||||||
|
```
|
||||||
|
or, if you need to change `ARCH` or `CONFIG_NAME`,
|
||||||
|
```sh
|
||||||
|
./build.sh -a ARCH -c CONFIG_NAME repo
|
||||||
```
|
```
|
||||||
|
|
||||||
If you need `root` privileges, while you are **still running** the above `bash` shell, go to a separate **Terminal** or **Console** window on the host and type:
|
If you need `root` privileges, while you are **still running** the above `bash` shell, go to a separate **Terminal** or **Console** window on the host and type:
|
||||||
|
@ -191,9 +195,9 @@ Then, edit `mk/config.mk`, and change the variable **CONTAINERFILE** to point to
|
||||||
CONTAINERFILE?=podman/my-containerfile
|
CONTAINERFILE?=podman/my-containerfile
|
||||||
```
|
```
|
||||||
|
|
||||||
If your Containerfile is newer than the **base image**, a new **base image** will be created.
|
If your Containerfile is newer than `build/container.tag`, a new **image** will be created. You can force the image to be rebuilt with `make container_clean`.
|
||||||
|
|
||||||
If you feel the need to have more than one **base image**, you can change the variable **IMAGE_TAG** in `mk/podman.mk` to give the image a different tag.
|
If you feel the need to have more than one **image**, you can change the variable **IMAGE_TAG** in `mk/podman.mk` to give the image a different name.
|
||||||
|
|
||||||
## Summary of Podman-related Make Targets and Podman Commands
|
## Summary of Podman-related Make Targets and Podman Commands
|
||||||
|
|
||||||
|
@ -223,7 +227,7 @@ The working directory is made available in the container by **mounting** it as a
|
||||||
```
|
```
|
||||||
takes the directory that `make` was started in as the host working directory, and **mounts** it at the location `$CONTAINER_WORKDIR`, normally set to `/mnt/redox`. The `:Z` at the end of the name indicates that the mounted directory should not be shared between simultaneous container instances. It is optional on some Linux distros, and not optional on others.
|
takes the directory that `make` was started in as the host working directory, and **mounts** it at the location `$CONTAINER_WORKDIR`, normally set to `/mnt/redox`. The `:Z` at the end of the name indicates that the mounted directory should not be shared between simultaneous container instances. It is optional on some Linux distros, and not optional on others.
|
||||||
|
|
||||||
For our invocation of Podman, we set the PATH environment variable as an option to `podman run`. This is to avoid the need for our `make` command to run `.bashrc`, which would add extra complexity.
|
For our invocation of Podman, we set the PATH environment variable as an option to `podman run`. This is to avoid the need for our `make` command to run `.bashrc`, which would add extra complexity. The `ARCH`, `CONFIG_NAME` and `FILESYSTEM_CONFIG` variables are passed in the environment to allow you to override the values in `mk/config.mk`, e.g. by setting them on your `make` command line or by using `build.sh`.
|
||||||
|
|
||||||
We also set `PODMAN_BUILD=0` in the environment, to ensure that the instance of `make` running in the container knows not to invoke **Podman**. This overrides the value set in `mk/config.mk`.
|
We also set `PODMAN_BUILD=0` in the environment, to ensure that the instance of `make` running in the container knows not to invoke **Podman**. This overrides the value set in `mk/config.mk`.
|
||||||
|
|
||||||
|
|
|
@ -33,6 +33,7 @@ RUN apt-get update \
|
||||||
ninja-build \
|
ninja-build \
|
||||||
meson \
|
meson \
|
||||||
python3-mako \
|
python3-mako \
|
||||||
|
xxd \
|
||||||
rsync \
|
rsync \
|
||||||
wget
|
wget
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue