From 9aceeb5f7e7f8816f8223965d63cc2c6aa444083 Mon Sep 17 00:00:00 2001 From: Noel Georgi Date: Fri, 1 Mar 2024 22:56:00 +0530 Subject: [PATCH] feat: rpi generic overlay Adds the `rpi_generic` overlay. Signed-off-by: Noel Georgi --- .dockerignore | 7 + .github/workflows/ci.yaml | 4 +- .gitignore | 6 + .kres.yaml | 19 ++ Makefile | 162 +++++++++++ Pkgfile | 16 ++ README.md | 9 +- artifacts/raspberrypi-firmware/pkg.yaml | 21 ++ .../0002-rpi-add-NVMe-to-boot-order.patch | 44 +++ ...ect-the-prps-per-page-calculation-me.patch | 43 +++ ...ke-driver-compatible-with-downstream.patch | 33 +++ ...prove-readability-of-nvme_setup_prps.patch | 49 ++++ ...se-pointer-for-CPU-addressed-buffers.patch | 264 ++++++++++++++++++ ...irtual-addresses-into-the-bus-s-addr.patch | 176 ++++++++++++ .../0008-enable-nvme-and-fixup-efi-boot.patch | 24 ++ artifacts/u-boot/pkg.yaml | 48 ++++ go.work | 3 + hack/release.sh | 66 +++++ hack/release.toml | 11 + installers/rpi_generic/pkg.yaml | 29 ++ installers/rpi_generic/src/config.txt | 19 ++ installers/rpi_generic/src/go.mod | 10 + installers/rpi_generic/src/go.sum | 8 + installers/rpi_generic/src/main.go | 57 ++++ internal/base/pkg.yaml | 10 + profiles/pkg.yaml | 5 + profiles/rpi_generic/rpi_generic.yaml | 9 + 27 files changed, 1149 insertions(+), 3 deletions(-) create mode 100644 .dockerignore create mode 100644 .gitignore create mode 100644 .kres.yaml create mode 100644 Makefile create mode 100644 Pkgfile create mode 100644 artifacts/raspberrypi-firmware/pkg.yaml create mode 100644 artifacts/u-boot/patches/0002-rpi-add-NVMe-to-boot-order.patch create mode 100644 artifacts/u-boot/patches/0003-Revert-nvme-Correct-the-prps-per-page-calculation-me.patch create mode 100644 artifacts/u-boot/patches/0004-usb-xhci-brcm-Make-driver-compatible-with-downstream.patch create mode 100644 artifacts/u-boot/patches/0005-nvme-improve-readability-of-nvme_setup_prps.patch create mode 100644 artifacts/u-boot/patches/0006-nvme-Use-pointer-for-CPU-addressed-buffers.patch create mode 100644 artifacts/u-boot/patches/0007-nvme-translate-virtual-addresses-into-the-bus-s-addr.patch create mode 100644 artifacts/u-boot/patches/0008-enable-nvme-and-fixup-efi-boot.patch create mode 100644 artifacts/u-boot/pkg.yaml create mode 100644 go.work create mode 100755 hack/release.sh create mode 100644 hack/release.toml create mode 100644 installers/rpi_generic/pkg.yaml create mode 100644 installers/rpi_generic/src/config.txt create mode 100644 installers/rpi_generic/src/go.mod create mode 100644 installers/rpi_generic/src/go.sum create mode 100644 installers/rpi_generic/src/main.go create mode 100644 internal/base/pkg.yaml create mode 100644 profiles/pkg.yaml create mode 100644 profiles/rpi_generic/rpi_generic.yaml diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..3d50102 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,7 @@ +# THIS FILE WAS AUTOMATICALLY GENERATED, PLEASE DO NOT EDIT. +# +# Generated on 2024-03-01T17:51:50Z by kres 1f8340d. + +* +!README.md +!pkg.yaml diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 6519bfe..fb6b5a0 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -1,6 +1,6 @@ # THIS FILE WAS AUTOMATICALLY GENERATED, PLEASE DO NOT EDIT. # -# Generated on 2024-03-01T15:00:03Z by kres b661666. +# Generated on 2024-03-12T16:46:47Z by kres latest. name: default concurrency: @@ -51,7 +51,7 @@ jobs: - endpoint: tcp://buildkit-arm64.ci.svc.cluster.local:1234 platforms: linux/arm64 driver: remote - endpoint: tcp://localhost:1234 + endpoint: tcp://127.0.0.1:1234 - name: Build run: | make diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..f20d1a2 --- /dev/null +++ b/.gitignore @@ -0,0 +1,6 @@ +# THIS FILE WAS AUTOMATICALLY GENERATED, PLEASE DO NOT EDIT. +# +# Generated on 2024-03-01T15:00:03Z by kres b661666. + +_out +go.work.sum diff --git a/.kres.yaml b/.kres.yaml new file mode 100644 index 0000000..3cf25b7 --- /dev/null +++ b/.kres.yaml @@ -0,0 +1,19 @@ +--- +kind: pkgfile.Build +spec: + targets: + - rpi_generic + extraBuildArgs: + - PKGS_PREFIX + - PKGS + makefile: + extraVariables: + - name: PKGS_PREFIX + defaultValue: ghcr.io/siderolabs + - name: PKGS + defaultValue: v1.7.0-alpha.0-33-g3aacf03 +--- +kind: common.Build +spec: + ignoredPaths: + - go.work.sum diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..abbe0dd --- /dev/null +++ b/Makefile @@ -0,0 +1,162 @@ +# THIS FILE WAS AUTOMATICALLY GENERATED, PLEASE DO NOT EDIT. +# +# Generated on 2024-03-12T16:46:47Z by kres latest. + +# common variables + +SHA := $(shell git describe --match=none --always --abbrev=8 --dirty) +TAG := $(shell git describe --tag --always --dirty --match v[0-9]\*) +ABBREV_TAG := $(shell git describe --tags >/dev/null 2>/dev/null && git describe --tag --always --match v[0-9]\* --abbrev=0 || echo 'undefined') +BRANCH := $(shell git rev-parse --abbrev-ref HEAD) +ARTIFACTS := _out +OPERATING_SYSTEM := $(shell uname -s | tr '[:upper:]' '[:lower:]') +GOARCH := $(shell uname -m | tr '[:upper:]' '[:lower:]') + +ifeq ($(GOARCH),x86_64) + GOARCH := amd64 +endif +REGISTRY ?= ghcr.io +USERNAME ?= siderolabs +REGISTRY_AND_USERNAME ?= $(REGISTRY)/$(USERNAME) +KRES_IMAGE ?= ghcr.io/siderolabs/kres:latest +CONFORMANCE_IMAGE ?= ghcr.io/siderolabs/conform:latest + +# source date epoch of first commit + +INITIAL_COMMIT_SHA := $(shell git rev-list --max-parents=0 HEAD) +SOURCE_DATE_EPOCH := $(shell git log $(INITIAL_COMMIT_SHA) --pretty=%ct) + +# sync bldr image with pkgfile + +BLDR_RELEASE := v0.3.0 +BLDR_IMAGE := ghcr.io/siderolabs/bldr:$(BLDR_RELEASE) +BLDR := docker run --rm --user $(shell id -u):$(shell id -g) --volume $(PWD):/src --entrypoint=/bldr $(BLDR_IMAGE) --root=/src + +# docker build settings + +BUILD := docker buildx build +PLATFORM ?= linux/amd64,linux/arm64 +PROGRESS ?= auto +PUSH ?= false +CI_ARGS ?= +COMMON_ARGS = --file=Pkgfile +COMMON_ARGS += --provenance=false +COMMON_ARGS += --progress=$(PROGRESS) +COMMON_ARGS += --platform=$(PLATFORM) +COMMON_ARGS += --build-arg=SOURCE_DATE_EPOCH=$(SOURCE_DATE_EPOCH) +COMMON_ARGS += --build-arg=PKGS_PREFIX="$(PKGS_PREFIX)" +COMMON_ARGS += --build-arg=PKGS="$(PKGS)" + +# extra variables + +PKGS_PREFIX ?= ghcr.io/siderolabs +PKGS ?= v1.7.0-alpha.0-33-g3aacf03 + +# targets defines all the available targets + +TARGETS = rpi_generic + +# help menu + +export define HELP_MENU_HEADER +# Getting Started + +To build this project, you must have the following installed: + +- git +- make +- docker (19.03 or higher) + +## Creating a Builder Instance + +The build process makes use of experimental Docker features (buildx). +To enable experimental features, add 'experimental: "true"' to '/etc/docker/daemon.json' on +Linux or enable experimental features in Docker GUI for Windows or Mac. + +To create a builder instance, run: + + docker buildx create --name local --use + +If running builds that needs to be cached aggresively create a builder instance with the following: + + docker buildx create --name local --use --config=config.toml + +config.toml contents: + +[worker.oci] + gc = true + gckeepstorage = 50000 + + [[worker.oci.gcpolicy]] + keepBytes = 10737418240 + keepDuration = 604800 + filters = [ "type==source.local", "type==exec.cachemount", "type==source.git.checkout"] + [[worker.oci.gcpolicy]] + all = true + keepBytes = 53687091200 + +If you already have a compatible builder instance, you may use that instead. + +## Artifacts + +All artifacts will be output to ./$(ARTIFACTS). Images will be tagged with the +registry "$(REGISTRY)", username "$(USERNAME)", and a dynamic tag (e.g. $(IMAGE):$(TAG)). +The registry and username can be overridden by exporting REGISTRY, and USERNAME +respectively. + +endef + +all: $(TARGETS) ## Builds all targets defined. + +.PHONY: clean +clean: ## Cleans up all artifacts. + @rm -rf $(ARTIFACTS) + +$(ARTIFACTS): ## Creates artifacts directory. + @mkdir -p $(ARTIFACTS) + +target-%: ## Builds the specified target defined in the Pkgfile. The build result will only remain in the build cache. + @$(BUILD) --target=$* $(COMMON_ARGS) $(TARGET_ARGS) $(CI_ARGS) . + +local-%: ## Builds the specified target defined in the Pkgfile using the local output type. The build result will be output to the specified local destination. + @$(MAKE) target-$* TARGET_ARGS="--output=type=local,dest=$(DEST) $(TARGET_ARGS)" + +docker-%: ## Builds the specified target defined in the Pkgfile using the docker output type. The build result will be loaded into Docker. + @$(MAKE) target-$* TARGET_ARGS="$(TARGET_ARGS)" + +reproducibility-test-local-%: ## Builds the specified target defined in the Pkgfile using the local output type with and without cahce. The build result will be output to the specified local destination + @rm -rf $(ARTIFACTS)/build-a $(ARTIFACTS)/build-b + @$(MAKE) local-$* DEST=$(ARTIFACTS)/build-a + @$(MAKE) local-$* DEST=$(ARTIFACTS)/build-b TARGET_ARGS="--no-cache" + @touch -ch -t $$(date -d @$(SOURCE_DATE_EPOCH) +%Y%m%d0000) $(ARTIFACTS)/build-a $(ARTIFACTS)/build-b + @diffoscope $(ARTIFACTS)/build-a $(ARTIFACTS)/build-b + @rm -rf $(ARTIFACTS)/build-a $(ARTIFACTS)/build-b + +.PHONY: $(TARGETS) +$(TARGETS): + @$(MAKE) docker-$@ TARGET_ARGS="--tag=$(REGISTRY_AND_USERNAME)/$@:$(TAG) --push=$(PUSH)" + +.PHONY: deps.png +deps.png: ## Generates a dependency graph of the Pkgfile. + @$(BLDR) graph | dot -Tpng -o deps.png + +.PHONY: rekres +rekres: + @docker pull $(KRES_IMAGE) + @docker run --rm --net=host --user $(shell id -u):$(shell id -g) -v $(PWD):/src -w /src -e GITHUB_TOKEN $(KRES_IMAGE) + +.PHONY: help +help: ## This help menu. + @echo "$$HELP_MENU_HEADER" + @grep -E '^[a-zA-Z%_-]+:.*?## .*$$' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}' + +.PHONY: release-notes +release-notes: + mkdir -p $(ARTIFACTS) + @ARTIFACTS=$(ARTIFACTS) ./hack/release.sh $@ $(ARTIFACTS)/RELEASE_NOTES.md $(TAG) + +.PHONY: conformance +conformance: + @docker pull $(CONFORMANCE_IMAGE) + @docker run --rm -it -v $(PWD):/src -w /src $(CONFORMANCE_IMAGE) enforce + diff --git a/Pkgfile b/Pkgfile new file mode 100644 index 0000000..7fb0d6f --- /dev/null +++ b/Pkgfile @@ -0,0 +1,16 @@ +# syntax = ghcr.io/siderolabs/bldr:v0.3.0 + +format: v1alpha2 + +vars: + # renovate: datasource=git-refs versioning=git depName=https://github.com/raspberrypi/firmware.git + raspberrypi_firmware_ref: dc94391863445ab867782d25ca6ae1e88579df5d + raspberrypi_firmware_sha256: a37041044b4d46e324dc03f64455a7c79a38aaf77d0bfc03e6ad7052fc217cd1 + raspberrypi_firmware_sha512: cf5ed2ce16ee059c9c185ef53d079fb4a59720f1729c270480f2ffb46e5d990936ad58233486143f71d60116fd14e78edb81cd13feec1a787a47650d7eaaf56f + + # renovate: datasource=github-tags extractVersion=^v(?.*)$ depName=u-boot/u-boot + uboot_version: 2023.01 + uboot_sha256: 69423bad380f89a0916636e89e6dcbd2e4512d584308d922d1039d1e4331950f + uboot_sha512: 417a28267eb7875820d08fafc7316f164663609378637539e71648b0b9b7d28796b6c381717f31b0ab6472805fefd32628ef7d1b2e7b9f3c51c8ad122993f679 +labels: + org.opencontainers.image.source: https://github.com/siderolabs/sbc-raspberrypi diff --git a/README.md b/README.md index afa3a83..a194509 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,10 @@ # sbc-raspberrypi -THis repo provides the overlay for Raspberry Pi generic Talos image. +This repo provides the overlay for Raspberry Pi generic Talos image. + +## Overlay Options + +| Option | Description | +| ----------------- | ------------------------------------------------------------------- | +| `configTxt` | Completely replace the `config.txt` file with the contents provided | +| `configTxtAppend` | Append the contents provided to the `config.txt` file | diff --git a/artifacts/raspberrypi-firmware/pkg.yaml b/artifacts/raspberrypi-firmware/pkg.yaml new file mode 100644 index 0000000..0f8566b --- /dev/null +++ b/artifacts/raspberrypi-firmware/pkg.yaml @@ -0,0 +1,21 @@ +name: raspberrypi-firmware +variant: scratch +shell: /toolchain/bin/bash +dependencies: + - stage: base +steps: + - sources: + - url: https://github.com/raspberrypi/firmware/archive/{{ .raspberrypi_firmware_ref }}.tar.gz + destination: raspberrypi-firmware.tar.gz + sha256: "{{ .raspberrypi_firmware_sha256 }}" + sha512: "{{ .raspberrypi_firmware_sha512 }}" + prepare: + - | + tar -xzf raspberrypi-firmware.tar.gz --strip-components=1 + install: + - | + mkdir -p /rootfs/artifacts/arm64/firmware/boot + cp -av boot/* /rootfs/artifacts/arm64/firmware/boot +finalize: + - from: /rootfs + to: /rootfs diff --git a/artifacts/u-boot/patches/0002-rpi-add-NVMe-to-boot-order.patch b/artifacts/u-boot/patches/0002-rpi-add-NVMe-to-boot-order.patch new file mode 100644 index 0000000..b532405 --- /dev/null +++ b/artifacts/u-boot/patches/0002-rpi-add-NVMe-to-boot-order.patch @@ -0,0 +1,44 @@ +From 191b5f4e0408e40f35379fdaab6b37a7ad93e298 Mon Sep 17 00:00:00 2001 +Message-Id: <191b5f4e0408e40f35379fdaab6b37a7ad93e298.1668448794.git.stefan@agner.ch> +In-Reply-To: <135d886b4e5077c8fa96a5449a70d81ae9c1c3d0.1668448794.git.stefan@agner.ch> +References: <135d886b4e5077c8fa96a5449a70d81ae9c1c3d0.1668448794.git.stefan@agner.ch> +From: Stefan Agner +Date: Tue, 29 Dec 2020 23:34:52 +0100 +Subject: [PATCH] rpi: add NVMe to boot order + +The Compute Module 4 I/O Board can support a NVMe. Add NVMe to the boot +order. + +Signed-off-by: Stefan Agner +--- + include/configs/rpi.h | 7 +++++++ + 1 file changed, 7 insertions(+) + +diff --git a/include/configs/rpi.h b/include/configs/rpi.h +index cd8fe8b518..7257659932 100644 +--- a/include/configs/rpi.h ++++ b/include/configs/rpi.h +@@ -131,6 +131,12 @@ + #define BOOT_TARGET_MMC(func) + #endif + ++#if CONFIG_IS_ENABLED(CMD_NVME) ++ #define BOOT_TARGET_NVME(func) func(NVME, nvme, 0) ++#else ++ #define BOOT_TARGET_NVME(func) ++#endif ++ + #if CONFIG_IS_ENABLED(CMD_USB) + #define BOOT_TARGET_USB(func) func(USB, usb, 0) + #else +@@ -151,6 +157,7 @@ + + #define BOOT_TARGET_DEVICES(func) \ + BOOT_TARGET_MMC(func) \ ++ BOOT_TARGET_NVME(func) \ + BOOT_TARGET_USB(func) \ + BOOT_TARGET_PXE(func) \ + BOOT_TARGET_DHCP(func) +-- +2.38.1 + diff --git a/artifacts/u-boot/patches/0003-Revert-nvme-Correct-the-prps-per-page-calculation-me.patch b/artifacts/u-boot/patches/0003-Revert-nvme-Correct-the-prps-per-page-calculation-me.patch new file mode 100644 index 0000000..941d2de --- /dev/null +++ b/artifacts/u-boot/patches/0003-Revert-nvme-Correct-the-prps-per-page-calculation-me.patch @@ -0,0 +1,43 @@ +From 644bd3743aa8771ef7ecb7b7239308d6da2a5b35 Mon Sep 17 00:00:00 2001 +Message-Id: <644bd3743aa8771ef7ecb7b7239308d6da2a5b35.1668448794.git.stefan@agner.ch> +In-Reply-To: <135d886b4e5077c8fa96a5449a70d81ae9c1c3d0.1668448794.git.stefan@agner.ch> +References: <135d886b4e5077c8fa96a5449a70d81ae9c1c3d0.1668448794.git.stefan@agner.ch> +From: Stefan Agner +Date: Thu, 23 Sep 2021 23:43:31 +0200 +Subject: [PATCH] Revert "nvme: Correct the prps per page calculation method" + +This reverts commit 859b33c948945f7904f60a2c12a3792d356d51ad. + +If there is more than one PRP List the last entry is a pointer to +the next list. From the NVM Express specification: + +"The last entry within a memory page, as indicated by the memory page +size in the CC.MPS field, shall be a PRP List pointer if there is more +than a single memory page of data to be transferred." + +For the purpose of calculating the number of pages required for PRP +lists we should always assume that the last entry is required for +the next PRP list. + +Signed-off-by: Stefan Agner +Cc: Wesley Sheng +--- + drivers/nvme/nvme.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/drivers/nvme/nvme.c b/drivers/nvme/nvme.c +index 6d0d3f3ca2..73db80a294 100644 +--- a/drivers/nvme/nvme.c ++++ b/drivers/nvme/nvme.c +@@ -52,7 +52,7 @@ static int nvme_setup_prps(struct nvme_dev *dev, u64 *prp2, + u64 *prp_pool; + int length = total_len; + int i, nprps; +- u32 prps_per_page = page_size >> 3; ++ u32 prps_per_page = (page_size >> 3) - 1; + u32 num_pages; + + length -= (page_size - offset); +-- +2.38.1 + diff --git a/artifacts/u-boot/patches/0004-usb-xhci-brcm-Make-driver-compatible-with-downstream.patch b/artifacts/u-boot/patches/0004-usb-xhci-brcm-Make-driver-compatible-with-downstream.patch new file mode 100644 index 0000000..8a91721 --- /dev/null +++ b/artifacts/u-boot/patches/0004-usb-xhci-brcm-Make-driver-compatible-with-downstream.patch @@ -0,0 +1,33 @@ +From de29ca70117fb2bfafa8b5699b34e9e94560b785 Mon Sep 17 00:00:00 2001 +Message-Id: +In-Reply-To: <135d886b4e5077c8fa96a5449a70d81ae9c1c3d0.1668448794.git.stefan@agner.ch> +References: <135d886b4e5077c8fa96a5449a70d81ae9c1c3d0.1668448794.git.stefan@agner.ch> +From: Stefan Agner +Date: Thu, 7 Oct 2021 12:02:39 +0200 +Subject: [PATCH] usb: xhci-brcm: Make driver compatible with downstream device + tree + +The downstream device tree uses just "generic-xhci" as compatible +string. Use this string to make U-Boot work with the downstream Kernel. + +Signed-off-by: Stefan Agner +--- + drivers/usb/host/xhci-brcm.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/drivers/usb/host/xhci-brcm.c b/drivers/usb/host/xhci-brcm.c +index fe17924028..0c6938187b 100644 +--- a/drivers/usb/host/xhci-brcm.c ++++ b/drivers/usb/host/xhci-brcm.c +@@ -82,7 +82,7 @@ static int xhci_brcm_deregister(struct udevice *dev) + } + + static const struct udevice_id xhci_brcm_ids[] = { +- { .compatible = "brcm,generic-xhci" }, ++ { .compatible = "generic-xhci" }, + { } + }; + +-- +2.38.1 + diff --git a/artifacts/u-boot/patches/0005-nvme-improve-readability-of-nvme_setup_prps.patch b/artifacts/u-boot/patches/0005-nvme-improve-readability-of-nvme_setup_prps.patch new file mode 100644 index 0000000..e6aca5b --- /dev/null +++ b/artifacts/u-boot/patches/0005-nvme-improve-readability-of-nvme_setup_prps.patch @@ -0,0 +1,49 @@ +From ab2790f8ff78790ea8a9cb0b05cafc55648ebbc4 Mon Sep 17 00:00:00 2001 +Message-Id: +In-Reply-To: <135d886b4e5077c8fa96a5449a70d81ae9c1c3d0.1668448794.git.stefan@agner.ch> +References: <135d886b4e5077c8fa96a5449a70d81ae9c1c3d0.1668448794.git.stefan@agner.ch> +From: Stefan Agner +Date: Thu, 23 Sep 2021 23:52:44 +0200 +Subject: [PATCH] nvme: improve readability of nvme_setup_prps() + +Improve readability by introducing consts, reuse consts where +appropriate and adding variables with discriptive name. + +Signed-off-by: Stefan Agner +--- + drivers/nvme/nvme.c | 8 ++++---- + 1 file changed, 4 insertions(+), 4 deletions(-) + +diff --git a/drivers/nvme/nvme.c b/drivers/nvme/nvme.c +index 73db80a294..751abc3cd5 100644 +--- a/drivers/nvme/nvme.c ++++ b/drivers/nvme/nvme.c +@@ -47,12 +47,12 @@ static int nvme_wait_csts(struct nvme_dev *dev, u32 mask, u32 val) + static int nvme_setup_prps(struct nvme_dev *dev, u64 *prp2, + int total_len, u64 dma_addr) + { +- u32 page_size = dev->page_size; ++ const u32 page_size = dev->page_size; ++ const u32 prps_per_page = (page_size >> 3) - 1; + int offset = dma_addr & (page_size - 1); + u64 *prp_pool; + int length = total_len; + int i, nprps; +- u32 prps_per_page = (page_size >> 3) - 1; + u32 num_pages; + + length -= (page_size - offset); +@@ -91,8 +91,8 @@ static int nvme_setup_prps(struct nvme_dev *dev, u64 *prp2, + i = 0; + while (nprps) { + if ((i == (prps_per_page - 1)) && nprps > 1) { +- *(prp_pool + i) = cpu_to_le64((ulong)prp_pool + +- page_size); ++ u64 next_prp_list = (u64)prp_pool + page_size; ++ *(prp_pool + i) = cpu_to_le64(next_prp_list); + i = 0; + prp_pool += page_size; + } +-- +2.38.1 + diff --git a/artifacts/u-boot/patches/0006-nvme-Use-pointer-for-CPU-addressed-buffers.patch b/artifacts/u-boot/patches/0006-nvme-Use-pointer-for-CPU-addressed-buffers.patch new file mode 100644 index 0000000..513e7d6 --- /dev/null +++ b/artifacts/u-boot/patches/0006-nvme-Use-pointer-for-CPU-addressed-buffers.patch @@ -0,0 +1,264 @@ +From 2b508d92673738d837576301866dc234d8b008c4 Mon Sep 17 00:00:00 2001 +Message-Id: <2b508d92673738d837576301866dc234d8b008c4.1668448794.git.stefan@agner.ch> +In-Reply-To: <135d886b4e5077c8fa96a5449a70d81ae9c1c3d0.1668448794.git.stefan@agner.ch> +References: <135d886b4e5077c8fa96a5449a70d81ae9c1c3d0.1668448794.git.stefan@agner.ch> +From: Stefan Agner +Date: Thu, 23 Sep 2021 23:58:35 +0200 +Subject: [PATCH] nvme: Use pointer for CPU addressed buffers + +Pass buffers which use CPU addressing as void pointers. This aligns with +DMA APIs which use void pointers as argument. It will avoid unnecessary +type casts when adding support bus address translations. + +Signed-off-by: Stefan Agner +--- + drivers/nvme/nvme.c | 50 ++++++++++++++++++++-------------------- + drivers/nvme/nvme_show.c | 4 ++-- + include/nvme.h | 12 +++++----- + 3 files changed, 33 insertions(+), 33 deletions(-) + +diff --git a/drivers/nvme/nvme.c b/drivers/nvme/nvme.c +index 751abc3cd5..352c94ea91 100644 +--- a/drivers/nvme/nvme.c ++++ b/drivers/nvme/nvme.c +@@ -45,11 +45,11 @@ static int nvme_wait_csts(struct nvme_dev *dev, u32 mask, u32 val) + } + + static int nvme_setup_prps(struct nvme_dev *dev, u64 *prp2, +- int total_len, u64 dma_addr) ++ int total_len, void *buffer) + { + const u32 page_size = dev->page_size; + const u32 prps_per_page = (page_size >> 3) - 1; +- int offset = dma_addr & (page_size - 1); ++ int offset = (uintptr_t)buffer & (page_size - 1); + u64 *prp_pool; + int length = total_len; + int i, nprps; +@@ -63,10 +63,10 @@ static int nvme_setup_prps(struct nvme_dev *dev, u64 *prp2, + } + + if (length) +- dma_addr += (page_size - offset); ++ buffer += (page_size - offset); + + if (length <= page_size) { +- *prp2 = dma_addr; ++ *prp2 = (u64)buffer; + return 0; + } + +@@ -96,11 +96,11 @@ static int nvme_setup_prps(struct nvme_dev *dev, u64 *prp2, + i = 0; + prp_pool += page_size; + } +- *(prp_pool + i++) = cpu_to_le64(dma_addr); +- dma_addr += page_size; ++ *(prp_pool + i++) = cpu_to_le64((u64)buffer); ++ buffer += page_size; + nprps--; + } +- *prp2 = (ulong)dev->prp_pool; ++ *prp2 = (u64)dev->prp_pool; + + flush_dcache_range((ulong)dev->prp_pool, (ulong)dev->prp_pool + + num_pages * page_size); +@@ -447,42 +447,42 @@ static int nvme_alloc_sq(struct nvme_dev *dev, u16 qid, + } + + int nvme_identify(struct nvme_dev *dev, unsigned nsid, +- unsigned cns, dma_addr_t dma_addr) ++ unsigned int cns, void *buffer) + { + struct nvme_command c; + u32 page_size = dev->page_size; +- int offset = dma_addr & (page_size - 1); ++ int offset = (uintptr_t)buffer & (page_size - 1); + int length = sizeof(struct nvme_id_ctrl); + int ret; + + memset(&c, 0, sizeof(c)); + c.identify.opcode = nvme_admin_identify; + c.identify.nsid = cpu_to_le32(nsid); +- c.identify.prp1 = cpu_to_le64(dma_addr); ++ c.identify.prp1 = cpu_to_le64((u64)buffer); + + length -= (page_size - offset); + if (length <= 0) { + c.identify.prp2 = 0; + } else { +- dma_addr += (page_size - offset); +- c.identify.prp2 = cpu_to_le64(dma_addr); ++ buffer += (page_size - offset); ++ c.identify.prp2 = cpu_to_le64((u64)buffer); + } + + c.identify.cns = cpu_to_le32(cns); + +- invalidate_dcache_range(dma_addr, +- dma_addr + sizeof(struct nvme_id_ctrl)); ++ invalidate_dcache_range((uintptr_t)buffer, ++ (uintptr_t)buffer + sizeof(struct nvme_id_ctrl)); + + ret = nvme_submit_admin_cmd(dev, &c, NULL); + if (!ret) +- invalidate_dcache_range(dma_addr, +- dma_addr + sizeof(struct nvme_id_ctrl)); ++ invalidate_dcache_range((uintptr_t)buffer, ++ (uintptr_t)buffer + sizeof(struct nvme_id_ctrl)); + + return ret; + } + + int nvme_get_features(struct nvme_dev *dev, unsigned fid, unsigned nsid, +- dma_addr_t dma_addr, u32 *result) ++ void *buffer, u32 *result) + { + struct nvme_command c; + int ret; +@@ -490,7 +490,7 @@ int nvme_get_features(struct nvme_dev *dev, unsigned fid, unsigned nsid, + memset(&c, 0, sizeof(c)); + c.features.opcode = nvme_admin_get_features; + c.features.nsid = cpu_to_le32(nsid); +- c.features.prp1 = cpu_to_le64(dma_addr); ++ c.features.prp1 = cpu_to_le64((u64)buffer); + c.features.fid = cpu_to_le32(fid); + + ret = nvme_submit_admin_cmd(dev, &c, result); +@@ -510,13 +510,13 @@ int nvme_get_features(struct nvme_dev *dev, unsigned fid, unsigned nsid, + } + + int nvme_set_features(struct nvme_dev *dev, unsigned fid, unsigned dword11, +- dma_addr_t dma_addr, u32 *result) ++ void *buffer, u32 *result) + { + struct nvme_command c; + + memset(&c, 0, sizeof(c)); + c.features.opcode = nvme_admin_set_features; +- c.features.prp1 = cpu_to_le64(dma_addr); ++ c.features.prp1 = cpu_to_le64((u64)buffer); + c.features.fid = cpu_to_le32(fid); + c.features.dword11 = cpu_to_le32(dword11); + +@@ -567,7 +567,7 @@ static int nvme_set_queue_count(struct nvme_dev *dev, int count) + u32 q_count = (count - 1) | ((count - 1) << 16); + + status = nvme_set_features(dev, NVME_FEAT_NUM_QUEUES, +- q_count, 0, &result); ++ q_count, NULL, &result); + + if (status < 0) + return status; +@@ -619,7 +619,7 @@ static int nvme_get_info_from_identify(struct nvme_dev *dev) + if (!ctrl) + return -ENOMEM; + +- ret = nvme_identify(dev, 0, 1, (dma_addr_t)(long)ctrl); ++ ret = nvme_identify(dev, 0, 1, ctrl); + if (ret) { + free(ctrl); + return -EIO; +@@ -704,7 +704,7 @@ static int nvme_blk_probe(struct udevice *udev) + ns->dev = ndev; + /* extract the namespace id from the block device name */ + ns->ns_id = trailing_strtol(udev->name); +- if (nvme_identify(ndev, ns->ns_id, 0, (dma_addr_t)(long)id)) { ++ if (nvme_identify(ndev, ns->ns_id, 0, id)) { + free(id); + return -EIO; + } +@@ -738,7 +738,7 @@ static ulong nvme_blk_rw(struct udevice *udev, lbaint_t blknr, + u64 prp2; + u64 total_len = blkcnt << desc->log2blksz; + u64 temp_len = total_len; +- uintptr_t temp_buffer = (uintptr_t)buffer; ++ void *temp_buffer = buffer; + + u64 slba = blknr; + u16 lbas = 1 << (dev->max_transfer_shift - ns->lba_shift); +@@ -872,7 +872,7 @@ int nvme_init(struct udevice *udev) + char name[20]; + + memset(id, 0, sizeof(*id)); +- if (nvme_identify(ndev, i, 0, (dma_addr_t)(long)id)) { ++ if (nvme_identify(ndev, i, 0, id)) { + ret = -EIO; + goto free_id; + } +diff --git a/drivers/nvme/nvme_show.c b/drivers/nvme/nvme_show.c +index 72cbac82bc..ac9b5cc9bd 100644 +--- a/drivers/nvme/nvme_show.c ++++ b/drivers/nvme/nvme_show.c +@@ -114,7 +114,7 @@ int nvme_print_info(struct udevice *udev) + if (!ctrl) + return -ENOMEM; + +- if (nvme_identify(dev, 0, 1, (dma_addr_t)(long)ctrl)) { ++ if (nvme_identify(dev, 0, 1, ctrl)) { + ret = -EIO; + goto free_ctrl; + } +@@ -129,7 +129,7 @@ int nvme_print_info(struct udevice *udev) + goto free_ctrl; + } + +- if (nvme_identify(dev, ns->ns_id, 0, (dma_addr_t)(long)id)) { ++ if (nvme_identify(dev, ns->ns_id, 0, id)) { + ret = -EIO; + goto free_id; + } +diff --git a/include/nvme.h b/include/nvme.h +index 2cdf8ce320..8ff823cd81 100644 +--- a/include/nvme.h ++++ b/include/nvme.h +@@ -18,12 +18,12 @@ struct nvme_dev; + * @dev: NVMe controller device + * @nsid: 0 for controller, namespace id for namespace to identify + * @cns: 1 for controller, 0 for namespace +- * @dma_addr: dma buffer address to store the identify result ++ * @buffer: dma buffer address to store the identify result + * @return: 0 on success, -ETIMEDOUT on command execution timeout, + * -EIO on command execution fails + */ + int nvme_identify(struct nvme_dev *dev, unsigned nsid, +- unsigned cns, dma_addr_t dma_addr); ++ unsigned int cns, void *buffer); + + /** + * nvme_get_features - retrieve the attributes of the feature specified +@@ -33,13 +33,13 @@ int nvme_identify(struct nvme_dev *dev, unsigned nsid, + * @dev: NVMe controller device + * @fid: feature id to provide data + * @nsid: namespace id the command applies to +- * @dma_addr: data structure used as part of the specified feature ++ * @buffer: data structure used as part of the specified feature + * @result: command-specific result in the completion queue entry + * @return: 0 on success, -ETIMEDOUT on command execution timeout, + * -EIO on command execution fails + */ + int nvme_get_features(struct nvme_dev *dev, unsigned fid, unsigned nsid, +- dma_addr_t dma_addr, u32 *result); ++ void *buffer, u32 *result); + + /** + * nvme_set_features - specify the attributes of the feature indicated +@@ -49,13 +49,13 @@ int nvme_get_features(struct nvme_dev *dev, unsigned fid, unsigned nsid, + * @dev: NVMe controller device + * @fid: feature id to provide data + * @dword11: command-specific input parameter +- * @dma_addr: data structure used as part of the specified feature ++ * @buffer: data structure used as part of the specified feature + * @result: command-specific result in the completion queue entry + * @return: 0 on success, -ETIMEDOUT on command execution timeout, + * -EIO on command execution fails + */ + int nvme_set_features(struct nvme_dev *dev, unsigned fid, unsigned dword11, +- dma_addr_t dma_addr, u32 *result); ++ void *buffer, u32 *result); + + /** + * nvme_scan_namespace - scan all namespaces attached to NVMe controllers +-- +2.38.1 + diff --git a/artifacts/u-boot/patches/0007-nvme-translate-virtual-addresses-into-the-bus-s-addr.patch b/artifacts/u-boot/patches/0007-nvme-translate-virtual-addresses-into-the-bus-s-addr.patch new file mode 100644 index 0000000..126988e --- /dev/null +++ b/artifacts/u-boot/patches/0007-nvme-translate-virtual-addresses-into-the-bus-s-addr.patch @@ -0,0 +1,176 @@ +From c70926d8b8ad11b8e489e92a8ca9ca93fb201595 Mon Sep 17 00:00:00 2001 +Message-Id: +In-Reply-To: <135d886b4e5077c8fa96a5449a70d81ae9c1c3d0.1668448794.git.stefan@agner.ch> +References: <135d886b4e5077c8fa96a5449a70d81ae9c1c3d0.1668448794.git.stefan@agner.ch> +From: Stefan Agner +Date: Fri, 24 Sep 2021 00:27:39 +0200 +Subject: [PATCH] nvme: translate virtual addresses into the bus's address + space + +So far we've been content with passing physical/CPU addresses when +configuring memory addresses into NVMe controllers, but not all +platforms have buses with transparent mappings. Specifically the +Raspberry Pi 4 might introduce an offset to memory accesses incoming +from its PCIe port. + +Introduce nvme_virt_to_bus() and nvme_bus_to_virt() to cater with these +limitations, and make sure we don't break non DM users. +For devices where PCIe's view of host memory doesn't match the memory +as seen by the CPU. + +A similar change has been introduced for XHCI controller with +commit 1a474559d90a ("xhci: translate virtual addresses into the bus's +address space"). + +Signed-off-by: Stefan Agner +--- + drivers/nvme/nvme.c | 31 +++++++++++++++++-------------- + drivers/nvme/nvme.h | 8 ++++++++ + 2 files changed, 25 insertions(+), 14 deletions(-) + +diff --git a/drivers/nvme/nvme.c b/drivers/nvme/nvme.c +index 352c94ea91..fdfc49677b 100644 +--- a/drivers/nvme/nvme.c ++++ b/drivers/nvme/nvme.c +@@ -66,7 +66,7 @@ static int nvme_setup_prps(struct nvme_dev *dev, u64 *prp2, + buffer += (page_size - offset); + + if (length <= page_size) { +- *prp2 = (u64)buffer; ++ *prp2 = nvme_virt_to_bus(dev, buffer); + return 0; + } + +@@ -91,16 +91,16 @@ static int nvme_setup_prps(struct nvme_dev *dev, u64 *prp2, + i = 0; + while (nprps) { + if ((i == (prps_per_page - 1)) && nprps > 1) { +- u64 next_prp_list = (u64)prp_pool + page_size; +- *(prp_pool + i) = cpu_to_le64(next_prp_list); ++ u64 next = nvme_virt_to_bus(dev, prp_pool + page_size); ++ *(prp_pool + i) = cpu_to_le64(next); + i = 0; + prp_pool += page_size; + } +- *(prp_pool + i++) = cpu_to_le64((u64)buffer); ++ *(prp_pool + i++) = cpu_to_le64(nvme_virt_to_bus(dev, buffer)); + buffer += page_size; + nprps--; + } +- *prp2 = (u64)dev->prp_pool; ++ *prp2 = nvme_virt_to_bus(dev, dev->prp_pool); + + flush_dcache_range((ulong)dev->prp_pool, (ulong)dev->prp_pool + + num_pages * page_size); +@@ -353,6 +353,7 @@ static int nvme_configure_admin_queue(struct nvme_dev *dev) + int result; + u32 aqa; + u64 cap = dev->cap; ++ u64 dma_addr; + struct nvme_queue *nvmeq; + /* most architectures use 4KB as the page size */ + unsigned page_shift = 12; +@@ -393,8 +394,10 @@ static int nvme_configure_admin_queue(struct nvme_dev *dev) + dev->ctrl_config |= NVME_CC_IOSQES | NVME_CC_IOCQES; + + writel(aqa, &dev->bar->aqa); +- nvme_writeq((ulong)nvmeq->sq_cmds, &dev->bar->asq); +- nvme_writeq((ulong)nvmeq->cqes, &dev->bar->acq); ++ dma_addr = nvme_virt_to_bus(dev, nvmeq->sq_cmds); ++ nvme_writeq(dma_addr, &dev->bar->asq); ++ dma_addr = nvme_virt_to_bus(dev, nvmeq->cqes); ++ nvme_writeq(dma_addr, &dev->bar->acq); + + result = nvme_enable_ctrl(dev); + if (result) +@@ -420,7 +423,7 @@ static int nvme_alloc_cq(struct nvme_dev *dev, u16 qid, + + memset(&c, 0, sizeof(c)); + c.create_cq.opcode = nvme_admin_create_cq; +- c.create_cq.prp1 = cpu_to_le64((ulong)nvmeq->cqes); ++ c.create_cq.prp1 = cpu_to_le64(nvme_virt_to_bus(dev, nvmeq->cqes)); + c.create_cq.cqid = cpu_to_le16(qid); + c.create_cq.qsize = cpu_to_le16(nvmeq->q_depth - 1); + c.create_cq.cq_flags = cpu_to_le16(flags); +@@ -437,7 +440,7 @@ static int nvme_alloc_sq(struct nvme_dev *dev, u16 qid, + + memset(&c, 0, sizeof(c)); + c.create_sq.opcode = nvme_admin_create_sq; +- c.create_sq.prp1 = cpu_to_le64((ulong)nvmeq->sq_cmds); ++ c.create_sq.prp1 = cpu_to_le64(nvme_virt_to_bus(dev, nvmeq->sq_cmds)); + c.create_sq.sqid = cpu_to_le16(qid); + c.create_sq.qsize = cpu_to_le16(nvmeq->q_depth - 1); + c.create_sq.sq_flags = cpu_to_le16(flags); +@@ -458,14 +461,14 @@ int nvme_identify(struct nvme_dev *dev, unsigned nsid, + memset(&c, 0, sizeof(c)); + c.identify.opcode = nvme_admin_identify; + c.identify.nsid = cpu_to_le32(nsid); +- c.identify.prp1 = cpu_to_le64((u64)buffer); ++ c.identify.prp1 = cpu_to_le64(nvme_virt_to_bus(dev, buffer)); + + length -= (page_size - offset); + if (length <= 0) { + c.identify.prp2 = 0; + } else { + buffer += (page_size - offset); +- c.identify.prp2 = cpu_to_le64((u64)buffer); ++ c.identify.prp2 = cpu_to_le64(nvme_virt_to_bus(dev, buffer)); + } + + c.identify.cns = cpu_to_le32(cns); +@@ -490,7 +493,7 @@ int nvme_get_features(struct nvme_dev *dev, unsigned fid, unsigned nsid, + memset(&c, 0, sizeof(c)); + c.features.opcode = nvme_admin_get_features; + c.features.nsid = cpu_to_le32(nsid); +- c.features.prp1 = cpu_to_le64((u64)buffer); ++ c.features.prp1 = cpu_to_le64(nvme_virt_to_bus(dev, buffer)); + c.features.fid = cpu_to_le32(fid); + + ret = nvme_submit_admin_cmd(dev, &c, result); +@@ -516,7 +519,7 @@ int nvme_set_features(struct nvme_dev *dev, unsigned fid, unsigned dword11, + + memset(&c, 0, sizeof(c)); + c.features.opcode = nvme_admin_set_features; +- c.features.prp1 = cpu_to_le64((u64)buffer); ++ c.features.prp1 = cpu_to_le64(nvme_virt_to_bus(dev, buffer)); + c.features.fid = cpu_to_le32(fid); + c.features.dword11 = cpu_to_le32(dword11); + +@@ -771,7 +774,7 @@ static ulong nvme_blk_rw(struct udevice *udev, lbaint_t blknr, + c.rw.slba = cpu_to_le64(slba); + slba += lbas; + c.rw.length = cpu_to_le16(lbas - 1); +- c.rw.prp1 = cpu_to_le64(temp_buffer); ++ c.rw.prp1 = cpu_to_le64(nvme_virt_to_bus(dev, temp_buffer)); + c.rw.prp2 = cpu_to_le64(prp2); + status = nvme_submit_sync_cmd(dev->queues[NVME_IO_Q], + &c, NULL, IO_TIMEOUT); +diff --git a/drivers/nvme/nvme.h b/drivers/nvme/nvme.h +index bc1d612dde..f52103c009 100644 +--- a/drivers/nvme/nvme.h ++++ b/drivers/nvme/nvme.h +@@ -7,8 +7,11 @@ + #ifndef __DRIVER_NVME_H__ + #define __DRIVER_NVME_H__ + ++#include + #include + ++#define nvme_to_dev(_dev) _dev->udev ++ + struct nvme_id_power_state { + __le16 max_power; /* centiwatts */ + __u8 rsvd2; +@@ -705,4 +708,9 @@ int nvme_init(struct udevice *udev); + */ + int nvme_shutdown(struct udevice *udev); + ++static inline dma_addr_t nvme_virt_to_bus(struct nvme_dev *dev, void *addr) ++{ ++ return dev_phys_to_bus(nvme_to_dev(dev)->parent, virt_to_phys(addr)); ++} ++ + #endif /* __DRIVER_NVME_H__ */ +-- +2.38.1 + diff --git a/artifacts/u-boot/patches/0008-enable-nvme-and-fixup-efi-boot.patch b/artifacts/u-boot/patches/0008-enable-nvme-and-fixup-efi-boot.patch new file mode 100644 index 0000000..cb16127 --- /dev/null +++ b/artifacts/u-boot/patches/0008-enable-nvme-and-fixup-efi-boot.patch @@ -0,0 +1,24 @@ +diff --git a/configs/rpi_arm64_defconfig b/configs/rpi_arm64_defconfig +index 031ed69ff0..f41d367238 100644 +--- a/configs/rpi_arm64_defconfig ++++ b/configs/rpi_arm64_defconfig +@@ -57,3 +57,19 @@ CONFIG_VIDEO_BCM2835=y + CONFIG_CONSOLE_SCROLL_LINES=10 + CONFIG_PHYS_TO_BUS=y + CONFIG_OF_LIBFDT_OVERLAY=y ++# Enable NVME ++CONFIG_NVME_PCI=y ++CONFIG_CMD_NVME=y ++CONFIG_NVME=y ++# USB mass storage support ++CONFIG_CMD_USB_MASS_STORAGE=y ++# Boot config ++CONFIG_BOOTSTD=y ++CONFIG_BOOTMETH_DISTRO=n ++CONFIG_BOOTMETH_DISTRO_PXE=n ++CONFIG_BOOTMETH_EFILOADER=y ++CONFIG_BOOTMETH_GLOBAL=n ++CONFIG_BOOTMETH_SCRIPT=n ++CONFIG_PXE_UTILS=n ++# Disable EFI bootmanager (reserves memory on 0x00080000 -> prevents continuing after being successful) ++CONFIG_CMD_BOOTEFI_BOOTMGR=n diff --git a/artifacts/u-boot/pkg.yaml b/artifacts/u-boot/pkg.yaml new file mode 100644 index 0000000..1f7fa08 --- /dev/null +++ b/artifacts/u-boot/pkg.yaml @@ -0,0 +1,48 @@ +# References: +# U-Boot: +# - https://u-boot.readthedocs.io/en/latest +# Broadcom/RaspberryPi +# - https://github.com/u-boot/u-boot/blob/master/doc/board/broadcom/raspberrypi.rst +name: u-boot +variant: scratch +shell: /toolchain/bin/bash +dependencies: + - stage: base +steps: + - sources: + - url: https://ftp.denx.de/pub/u-boot/u-boot-{{ .uboot_version }}.tar.bz2 + destination: u-boot.tar.bz2 + sha256: "{{ .uboot_sha256 }}" + sha512: "{{ .uboot_sha512 }}" + env: + SOURCE_DATE_EPOCH: {{ .BUILD_ARG_SOURCE_DATE_EPOCH }} + prepare: + - | + mkdir -p /usr/bin \ + && ln -sf /toolchain/bin/env /usr/bin/env + + tar xf u-boot.tar.bz2 --strip-components=1 + # rpi_generic (built with rpi_arm64_defconfig, which "uses the device-tree provided by the firmware") + - | + patch -p1 < /pkg/patches/0002-rpi-add-NVMe-to-boot-order.patch + patch -p1 < /pkg/patches/0003-Revert-nvme-Correct-the-prps-per-page-calculation-me.patch + patch -p1 < /pkg/patches/0004-usb-xhci-brcm-Make-driver-compatible-with-downstream.patch + patch -p1 < /pkg/patches/0005-nvme-improve-readability-of-nvme_setup_prps.patch + patch -p1 < /pkg/patches/0006-nvme-Use-pointer-for-CPU-addressed-buffers.patch + patch -p1 < /pkg/patches/0007-nvme-translate-virtual-addresses-into-the-bus-s-addr.patch + patch -p1 < /pkg/patches/0008-enable-nvme-and-fixup-efi-boot.patch + + make rpi_arm64_defconfig + sed -i "s/CONFIG_TOOLS_LIBCRYPTO=y/# CONFIG_TOOLS_LIBCRYPTO is not set/" .config + build: + # rpi_generic + - | + make -j $(nproc) HOSTLDLIBS_mkimage="-lssl -lcrypto" + install: + # rpi_generic + - | + mkdir -p /rootfs/artifacts/arm64/u-boot/rpi_generic + cp -v u-boot.bin /rootfs/artifacts/arm64/u-boot/rpi_generic +finalize: + - from: /rootfs + to: /rootfs diff --git a/go.work b/go.work new file mode 100644 index 0000000..660c21c --- /dev/null +++ b/go.work @@ -0,0 +1,3 @@ +go 1.22.1 + +use ./installers/rpi_generic/src diff --git a/hack/release.sh b/hack/release.sh new file mode 100755 index 0000000..0a2da38 --- /dev/null +++ b/hack/release.sh @@ -0,0 +1,66 @@ +#!/bin/bash + +# THIS FILE WAS AUTOMATICALLY GENERATED, PLEASE DO NOT EDIT. +# +# Generated on 2024-03-01T15:00:03Z by kres b661666. + +set -e + +RELEASE_TOOL_IMAGE="ghcr.io/siderolabs/release-tool:latest" + +function release-tool { + docker pull "${RELEASE_TOOL_IMAGE}" >/dev/null + docker run --rm -w /src -v "${PWD}":/src:ro "${RELEASE_TOOL_IMAGE}" -l -d -n -t "${1}" ./hack/release.toml +} + +function changelog { + if [ "$#" -eq 1 ]; then + (release-tool ${1}; echo; cat CHANGELOG.md) > CHANGELOG.md- && mv CHANGELOG.md- CHANGELOG.md + else + echo 1>&2 "Usage: $0 changelog [tag]" + exit 1 + fi +} + +function release-notes { + release-tool "${2}" > "${1}" +} + +function cherry-pick { + if [ $# -ne 2 ]; then + echo 1>&2 "Usage: $0 cherry-pick " + exit 1 + fi + + git checkout $2 + git fetch + git rebase upstream/$2 + git cherry-pick -x $1 +} + +function commit { + if [ $# -ne 1 ]; then + echo 1>&2 "Usage: $0 commit " + exit 1 + fi + + git commit -s -m "release($1): prepare release" -m "This is the official $1 release." +} + +if declare -f "$1" > /dev/null +then + cmd="$1" + shift + $cmd "$@" +else + cat <