Skip to content

Commit

Permalink
Merge branch 'eve-kernel-amd64-v6.1.38-generic' into eve-kernel-amd64…
Browse files Browse the repository at this point in the history
…-v6.1.38-generic
  • Loading branch information
rucoder authored Nov 2, 2023
2 parents c273a79 + c37a7dc commit 065cf1c
Show file tree
Hide file tree
Showing 3 changed files with 74 additions and 26 deletions.
20 changes: 13 additions & 7 deletions Dockerfile.gcc
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ ARG KERNEL_BIN=arch/x86/boot/bzImage
# set from a Makefile.eve
ARG SOURCE_DATE_EPOCH
ARG KBUILD_BUILD_TIMESTAMP
ARG LOCALVERSION

FROM --platform=${BUILDPLATFORM} alpine:${ALPINE_VERSION} as builder-native-base
RUN apk add make flex bison elfutils-dev openssl-dev findutils diffutils perl ccache gcc libgcc musl-dev \
Expand Down Expand Up @@ -75,6 +76,7 @@ ARG SOURCE_DATE_EPOCH
ARG KBUILD_BUILD_TIMESTAMP
ARG KERNEL_CONFIG
ARG KERNEL_BIN
ARG LOCALVERSION
# ARCH and CROSS_COMPILE are inherited from builder-${TARGETARCH}-${BUILDARCH}
# ARCH is always set to the target arch
# CROSS_COMPILE is set to empty string for native builds
Expand All @@ -95,12 +97,12 @@ RUN --mount=type=cache,target=/root/.cache/ccache,id=kernel-ccache-${TARGETARCH}
echo "Building kernel for ${TARGETARCH} with ARCH=${ARCH} and CROSS_COMPILE=${CROSS_COMPILE}" && \
make -j$(nproc) mrproper \
&& make O=/kernel-out ${KERNEL_CONFIG} \
&& make O=/kernel-out -j$(nproc) prepare \
&& make O=/kernel-out -j$(nproc) \
&& make O=/kernel-out -j$(nproc) modules \
&& make O=/kernel-out -j$(nproc) modules_install INSTALL_MOD_STRIP=1 \
INSTALL_MOD_PATH=/tmp/kernel-modules && \
ccache -s
&& make O=/kernel-out LOCALVERSION="-${LOCALVERSION}" -j$(nproc) prepare \
&& make O=/kernel-out LOCALVERSION="-${LOCALVERSION}" -j$(nproc) \
&& make O=/kernel-out LOCALVERSION="-${LOCALVERSION}" -j$(nproc) modules \
&& make O=/kernel-out LOCALVERSION="-${LOCALVERSION}" -j$(nproc) modules_install INSTALL_MOD_STRIP=1 \
INSTALL_MOD_PATH=/tmp/kernel-modules \
&& ccache -s

ADD https://github.com/mikem-zed/zfs.git#eve-zfs-2.1.12 /tmp/zfs
WORKDIR /tmp/zfs
Expand Down Expand Up @@ -167,8 +169,12 @@ RUN DVER=$(basename $(find /tmp/kernel-modules/lib/modules/ -mindepth 1 -maxdept
tar cf - -T - | (cd $dir; tar xf -) && \
( cd /tmp && tar cf /out/kernel-dev.tar usr/src )

# copy SBOM files
RUN cp /kernel-src/kernel-sbom-docker.spdx.json /out/ && \
cp /kernel-src/kernel-sbom-gh.spdx.json /out/

FROM scratch
ENTRYPOINT []
CMD []
WORKDIR /
COPY --from=artifacts /out/* /
COPY --from=artifacts /out/* /
51 changes: 47 additions & 4 deletions Makefile.eve
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Title: Dockerfile for building the EVE kernel
VERSION=$(shell git rev-parse --short HEAD)
VERSION=$(shell git rev-parse --short=12 HEAD)
DIRTY=$(shell git diff --quiet || echo '-dirty')
EVE_FLAVOR=generic
ARCHITECTURE=amd64
Expand Down Expand Up @@ -28,18 +28,61 @@ help: Makefile
@echo " kernel-clang: build kernel with clang"
@echo " docker-tag-gcc: print docker tag for gcc kernel"
@echo " docker-tag-clang: print docker tag for clang kernel"
@echo " push-gcc: push gcc kernel to docker.io"
@echo " push-clang: push clang kernel to docker.io"
@echo " clean: remove generated files"
@echo

kernel-%: Dockerfile.%
pull-eve-build-tools:
docker pull lfedge/eve-build-tools:main
.PHONY: pull-eve-build-tools

# do not build sbom target directly, it depends on DOCKERFILE varuable set by kernel-gcc or kernel-clang
SBOM_TARGETS=kernel-sbom-gh.spdx.json kernel-sbom-docker.spdx.json
sbom: $(SBOM_TARGETS)

kernel-sbom-gh.spdx.json: pull-eve-build-tools
docker run -v $(PWD):/in lfedge/eve-build-tools:main github-sbom-generator \
generate --format spdx-json /in/ | jq . > ./kernel-sbom-gh.spdx.json

#if DOCKERFILE is not set, this target will fail
kernel-sbom-docker.spdx.json: pull-eve-build-tools $(DOCKERFILE)
@if [ -z "$(DOCKERFILE)" ]; then \
echo "DOCKERFILE not set. Do not build 'sbom' target directly"; \
exit 1; \
fi
@echo "Generating SBOM for $(DOCKERFILE)"
docker run -v $(PWD):/in lfedge/eve-build-tools:main dockerfile-add-scanner scan /in/$(DOCKERFILE) \
--format spdx-json | jq . > ./kernel-sbom-docker.spdx.json

kernel-gcc: DOCKERFILE:=Dockerfile.gcc
kernel-clang: DOCKERFILE:=Dockerfile.clang

kernel-build-%: sbom Makefile.eve
@echo "Building kernel version $(BRANCH):$(VERSION)-$* with compiler $*"
docker buildx build \
--build-arg="SOURCE_DATE_EPOCH=$(SOURCE_DATE_EPOCH)" \
--build-arg="KBUILD_BUILD_TIMESTAMP=$(KBUILD_BUILD_TIMESTAMP)" \
--build-arg="LOCALVERSION=$(VERSION)$(DIRTY)" \
--platform $(PLATFORM) -t lfedge/eve-kernel:$(BRANCH)-$(VERSION)$(DIRTY)-$* --load -f Dockerfile.$* .

docker-tag-%:
# we need these intermediate targets to make .PHONY work for pattern rules
kernel-gcc: kernel-build-gcc
kernel-clang: kernel-build-clang
docker-tag-gcc: docker-tag-generate-gcc
docker-tag-clang: docker-tag-generate-clang
push-gcc: push-image-gcc
push-clang: push-image-clang

.PHONY: kernel-gcc kernel-clang docker-tag-gcc docker-tag-clang push-gcc push-clang

docker-tag-generate-%:
@echo "docker.io/lfedge/eve-kernel:$(BRANCH)-$(VERSION)$(DIRTY)-$*"

push-%:
push-image-%:
$(if $(DIRTY), $(error "Not pushing since the repo is dirty"))
docker push lfedge/eve-kernel:$(BRANCH)-$(VERSION)-$*

.PHONY: clean
clean:
rm -f $(SBOM_TARGETS)
29 changes: 14 additions & 15 deletions drivers/pci/quirks.c
Original file line number Diff line number Diff line change
Expand Up @@ -267,28 +267,27 @@ static int pcie_acs_overrides(struct pci_dev *dev, u16 acs_flags)
{
int i;

/* Never override ACS for legacy devices or devices with ACS caps */
if (!pci_is_pcie(dev) ||
pci_find_ext_capability(dev, PCI_EXT_CAP_ID_ACS))
/* Never override ACS for legacy devices */
if (!pci_is_pcie(dev))
return -ENOTTY;

for (i = 0; i < max_acs_id; i++)
if (acs_on_ids[i].vendor == dev->vendor &&
acs_on_ids[i].device == dev->device)
return 1;

switch (pci_pcie_type(dev)) {
case PCI_EXP_TYPE_DOWNSTREAM:
case PCI_EXP_TYPE_ROOT_PORT:
if (acs_on_downstream)
return 1;
break;
case PCI_EXP_TYPE_ENDPOINT:
case PCI_EXP_TYPE_UPSTREAM:
case PCI_EXP_TYPE_LEG_END:
case PCI_EXP_TYPE_RC_END:
if (acs_on_multifunction && dev->multifunction)
return 1;
switch (pci_pcie_type(dev)) {
case PCI_EXP_TYPE_DOWNSTREAM:
case PCI_EXP_TYPE_ROOT_PORT:
if (acs_on_downstream)
return 1;
break;
case PCI_EXP_TYPE_ENDPOINT:
case PCI_EXP_TYPE_UPSTREAM:
case PCI_EXP_TYPE_LEG_END:
case PCI_EXP_TYPE_RC_END:
if (acs_on_multifunction && dev->multifunction)
return 1;
}

return -ENOTTY;
Expand Down

0 comments on commit 065cf1c

Please sign in to comment.