Set `CONFIG_FILE=""` as the new default instead of `CONFIG_FILE="./imageconfigs/core-efi.json"`.

For teams that use the Mariner toolkit to build custom packages or images using the Mariner toolkit:
- Previously the toolkit would default to the core-efi.json image definition for all invocations.
  - This would result it building all packages required for that image definition when calling `make build-packages` in the core repo
  - This would mean that `make image` would succeed without explicitly setting a desired image config
- In future versions of the toolkit, CONFIG_FILE will default to “”
  - Package builds will no longer include extraneous packages that may be unneeded
  - Image builds will return an error if a config is not explicitly selected

 

Considerations:
- Packages like the kernel will no longer build during normal package builds unless requested. Set desired packages via PACKAGE_BUILD_LIST=”pkg1 pkg2 …”
- `make image` will no longer succeed without CONFIG_FILE=”/path/to/config.json” being set explicitly
This commit is contained in:
Daniel McIlvaney 2023-09-19 13:45:37 -07:00 коммит произвёл GitHub
Родитель d3fd41653a
Коммит 3deebc19d0
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
4 изменённых файлов: 13 добавлений и 16 удалений

4
.github/workflows/quickstart_1.0.yml поставляемый
Просмотреть файл

@ -63,7 +63,7 @@ jobs:
- name: ISO Quick Start
run: |
pushd toolkit
sudo make iso REBUILD_TOOLS=y REBUILD_PACKAGES=n
sudo make iso REBUILD_TOOLS=y REBUILD_PACKAGES=n CONFIG_FILE=./imageconfigs/full.json
popd
vhdx_quickstart:
@ -90,5 +90,5 @@ jobs:
- name: VHDX Quick Start
run: |
pushd toolkit
sudo make image REBUILD_TOOLS=y REBUILD_PACKAGES=n
sudo make image REBUILD_TOOLS=y REBUILD_PACKAGES=n CONFIG_FILE=./imageconfigs/core-efi.json
popd

4
.github/workflows/quickstart_2.0.yml поставляемый
Просмотреть файл

@ -65,7 +65,7 @@ jobs:
- name: ISO Quick Start
run: |
pushd toolkit
sudo make iso REBUILD_TOOLS=y REBUILD_PACKAGES=n
sudo make iso REBUILD_TOOLS=y REBUILD_PACKAGES=n CONFIG_FILE=./imageconfigs/full.json
popd
vhdx_quickstart:
@ -93,5 +93,5 @@ jobs:
- name: VHDX Quick Start
run: |
pushd toolkit
sudo make image REBUILD_TOOLS=y REBUILD_PACKAGES=n
sudo make image REBUILD_TOOLS=y REBUILD_PACKAGES=n CONFIG_FILE=./imageconfigs/core-efi.json
popd

Просмотреть файл

@ -12,10 +12,7 @@ toolkit_root := $(abspath $(dir $(lastword $(MAKEFILE_LIST))))
SCRIPTS_DIR ?= $(toolkit_root)/scripts
# Build targets
ifeq ($(origin CONFIG_FILE), undefined)
CONFIG_FILE = $(toolkit_root)/imageconfigs/core-efi.json
$(warning CONFIG_FILE is undefined, defaulting to toolkit's core-efi.json.)
endif
CONFIG_FILE ?= ""
CONFIG_BASE_DIR ?= $(dir $(CONFIG_FILE))
PACKAGE_BUILD_LIST ?=
PACKAGE_REBUILD_LIST ?=

Просмотреть файл

@ -155,7 +155,7 @@ sudo make toolchain REBUILD_TOOLS=y REBUILD_TOOLCHAIN=y
After the toolchain is built or populated, package building is possible. The CBL-Mariner ecosystem provides a significant number of packages, but most of those packages are not used in an image. When rebuilding packages, you can choose to build everything, or you can choose to build just what you need for a specific image. This can save significant time because only the subset of the CBL-Mariner packages needed for an image are built.
The CONFIG_FILE argument provides a quick way to declare what to build. To manually build **all** packages you can clear the configuration with `CONFIG_FILE=` and invoke the package build target. To build packages needed for a specific image, you must set the CONFIG_FILE= parameter to an image configuration file of your choice. The standard image configuration files are in the toolkit/imageconfigs folder.
The CONFIG_FILE argument provides a quick way to declare what to build. To manually build **all** packages you can use the default configuration (`CONFIG_FILE=""`) and invoke the package build target. To build packages needed for a specific image, you must set the CONFIG_FILE= parameter to an image configuration file of your choice. The standard image configuration files are in the toolkit/imageconfigs folder.
Large parts of the package build stage are parallelized. Enable this by setting the `-j` flag for `make` to the number of parallel jobs to allow. (Recommend setting this value to the number of logical cores available on your system, or less)
@ -255,10 +255,10 @@ Build all local packages needed for the default `core-efi.json`:
sudo make build-packages -j$(nproc)
```
Build only two packages along with their prerequisites (note `CONFIG_FILE` is explicitly cleared, not specifying it will use the default `core-efi.json` config):
Build only two packages along with their prerequisites:
```bash
sudo make build-packages PACKAGE_BUILD_LIST="vim nano" CONFIG_FILE= -j$(nproc)
sudo make build-packages PACKAGE_BUILD_LIST="vim nano" -j$(nproc)
```
Build packages from a custom SPECS dir:
@ -281,11 +281,11 @@ Adding `PACKAGE_REBUILD_LIST="nano"` will tell the build system to always rebuil
#### Ignoring Packages
In the event the ncurses package is currently having issues, `PACKAGE_IGNORE_LIST="ncurses"` will tell the build system to pretend the `ncurses.spec` file was already successfully built regardless of the actual local state. As before, explicitly clear the `CONFIG_FILE` variable to skip adding `core-efi.json`'s packages.
In the event the ncurses package is currently having issues, `PACKAGE_IGNORE_LIST="ncurses"` will tell the build system to pretend the `ncurses.spec` file was already successfully built regardless of the actual local state.
```bash
# Work on the nano package while ignoring the state of the ncurses package
sudo make build-packages PACKAGE_BUILD_LIST="nano" PACKAGE_REBUILD_LIST="nano" PACKAGE_IGNORE_LIST="ncurses" CONFIG_FILE=
sudo make build-packages PACKAGE_BUILD_LIST="nano" PACKAGE_REBUILD_LIST="nano" PACKAGE_IGNORE_LIST="ncurses"
```
Any build which requires the ignored packages will still attempt to use them during a build, so ensure they are available in the `../out/RPMS` folder.
@ -358,7 +358,7 @@ If `DISABLE_UPSTREAM_REPOS=y` is set, any repo that is accessed through the netw
If supplying custom endpoints for source/SRPM/package servers, accessing these resources may require keys and certificates. The keys and certificates can be set using:
```bash
sudo make image CA_CERT=/path/to/rootca.crt TLS_CERT=/path/to/user.crt TLS_KEY=/path/to/user.key
sudo make image CONFIG_FILE="./imageconfigs/core-efi.json" CA_CERT=/path/to/rootca.crt TLS_CERT=/path/to/user.crt TLS_KEY=/path/to/user.key
```
## Building Everything From Scratch
@ -413,7 +413,7 @@ sudo make toolchain PACKAGE_URL_LIST="" REPO_LIST="" DISABLE_UPSTREAM_REPOS=y RE
# - DOWNLOAD_SRPMS=y (will download pre-packages sources from SRPM_URL_LIST=...)
# - manually placing the correct sources in each /SPECS/* package folder
# (SRPM_FILE_SIGNATURE_HANDLING=update must be used if the new sources files to not match the existing hashes)
sudo make image PACKAGE_URL_LIST="" REPO_LIST="" DISABLE_UPSTREAM_REPOS=y REBUILD_TOOLCHAIN=y REBUILD_PACKAGES=y REBUILD_TOOLS=y
sudo make image CONFIG_FILE="./imageconfigs/core-efi.json" PACKAGE_URL_LIST="" REPO_LIST="" DISABLE_UPSTREAM_REPOS=y REBUILD_TOOLCHAIN=y REBUILD_PACKAGES=y REBUILD_TOOLS=y
```
### Local Build Variables
@ -758,7 +758,7 @@ To reproduce an ISO build, run the same make invocation as before, but set:
| Variable | Default | Description
|:------------------------------|:-------------------------------------------------------------------------------------------------------|:---
| CONFIG_FILE | `$(RESOURCES_DIR)`/imageconfigs/core-efi/core-efi.json | [Image config file](https://github.com/microsoft/CBL-MarinerTutorials#image-config-file) to build.
| CONFIG_FILE | `""` | [Image config file](https://github.com/microsoft/CBL-MarinerTutorials#image-config-file) to build.
| CONFIG_BASE_DIR | `$(dir $(CONFIG_FILE))` | Base directory on the **build machine** to search for any **relative** file paths mentioned inside the [image config file](https://github.com/microsoft/CBL-MarinerTutorials#image-config-file). This has no effect on **absolute** file paths or file paths on the **built image**.
| UNATTENDED_INSTALLER | | Create unattended ISO installer if set. Overrides all other installer options.
| PACKAGE_BUILD_LIST | | Explicit list of packages to build. The package will be skipped if the build system thinks it is already up-to-date. The argument accepts both spec and package names. Example: for `python-werkzeug.spec`, which builds the `python3-werkzeug` package both `python-werkzeug` and `python3-werkzeug` are correct.