| -rw-r--r-- | Jenkinsfile | 52 | ||||
| -rw-r--r-- | README.md | 7 | ||||
| -rw-r--r-- | config/base-aarch64.config | 23 | ||||
| -rw-r--r-- | config/foreign-socs.config | 68 | ||||
| -rw-r--r-- | kernel-surface.spec | 34 | ||||
| -rwxr-xr-x | make-sources.sh | 4 | ||||
| -rw-r--r-- | patches/camera/0027-media-i2c-ov13858-fix-bayer-order-when-mirrored.patch | 71 |
7 files changed, 192 insertions, 67 deletions
diff --git a/Jenkinsfile b/Jenkinsfile index 63e7c34..1ab3e47 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -118,22 +118,31 @@ spec: rpmdev-setuptree - # The published file name is whatever the spec + # The published file names are whatever the spec # resolves to under the tag's versions, so the two - # cannot drift. A kernel build is expensive; if this - # exact NEVRA is already in the bucket, skip - # straight to the metadata. - rpm_file=$(rpmspec -q \\ + # cannot drift. Note the plural: kernel-surface-dtb + # is a separate package because the main one is + # installonly and cannot own a path that carries no + # kernel version. Publishing only the first would + # leave the kernel unresolvable. + prefix="s3://${RPM_BUCKET}/fedora/${fedora_version}/aarch64" + rpm_files=$(rpmspec -q \\ --define "upstream_ver ${UPSTREAM_VER}" \\ --define "patchset_ver ${PATCHSET_VER}" \\ --queryformat '%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}.rpm\\n' \\ - kernel-surface.spec | head -n1) - dest="s3://${RPM_BUCKET}/fedora/${fedora_version}/aarch64/${rpm_file}" + kernel-surface.spec) - skip_build=false - if aws s3 ls --endpoint-url "${B2_ENDPOINT}" "${dest}"; then - echo "${rpm_file} already published, skipping build" - skip_build=true + # A kernel build is expensive; skip it only when + # every one of those is already in the bucket. + skip_build=true + for rpm_name in ${rpm_files}; do + if ! aws s3 ls --endpoint-url "${B2_ENDPOINT}" \\ + "${prefix}/${rpm_name}"; then + skip_build=false + fi + done + if [ "${skip_build}" = true ]; then + echo "${TAG_NAME} is already published in full, skipping build" fi if [ "${skip_build}" = false ]; then @@ -146,29 +155,34 @@ spec: --define '_smp_mflags -j4' \\ kernel-surface.spec - built="${HOME}/rpmbuild/RPMS/aarch64/${rpm_file}" - test -f "${built}" + # kernel-surface-dtb is noarch, so it lands + # in RPMS/noarch rather than RPMS/aarch64; ask + # where each one actually is. + for rpm_name in ${rpm_files}; do + built=$(find "${HOME}/rpmbuild/RPMS" -type f \\ + -name "${rpm_name}" -print -quit) + test -n "${built}" - aws s3 cp --endpoint-url "${B2_ENDPOINT}" \\ - "${built}" "${dest}" + aws s3 cp --endpoint-url "${B2_ENDPOINT}" \\ + "${built}" "${prefix}/${rpm_name}" + done fi - repo_url="s3://${RPM_BUCKET}/fedora/${fedora_version}/aarch64" repo="${WORKSPACE}/repo" mkdir -p "${repo}" aws s3 sync --endpoint-url "${B2_ENDPOINT}" \\ --exclude '*' --include '*.rpm' \\ - "${repo_url}/" "${repo}/" + "${prefix}/" "${repo}/" createrepo_c --update "${repo}" aws s3 sync --endpoint-url "${B2_ENDPOINT}" \\ --exclude 'repomd.xml*' \\ - "${repo}/repodata/" "${repo_url}/repodata/" + "${repo}/repodata/" "${prefix}/repodata/" aws s3 cp --endpoint-url "${B2_ENDPOINT}" \\ "${repo}/repodata/repomd.xml" \\ - "${repo_url}/repodata/repomd.xml" + "${prefix}/repodata/repomd.xml" # Served next to the repository so that consumers # can `dnf config-manager --add-repo` the URL. @@ -51,7 +51,7 @@ rpm2archive -n - < kernel-core-*.aarch64.rpm | If the extraction comes up empty, `rpm -qlp kernel-core-*.aarch64.rpm | grep config` says whether the package still carries the file at all. -Three fragments are merged on top with `scripts/kconfig/merge_config.sh`: +Four fragments are merged on top with `scripts/kconfig/merge_config.sh`: * `config/surface.config` – the drivers the patch set enables (SAM stack and its new RTC, CAMSS and the CSI-2 D-PHY, fastrpc, ath12k, AudioReach). @@ -59,6 +59,9 @@ Three fragments are merged on top with `scripts/kconfig/merge_config.sh`: and dm-snapshot/overlayfs built in for `dracut`'s `dmsquash-live`, the EFI stub because GRUB's aarch64 `linux` command loads the kernel as an EFI application, and xz module compression. +* `config/foreign-socs.config` – the ARM64 platforms this machine is not. + Fedora's config enables every platform it supports because a distribution + kernel has to boot on all of them; this one boots on `qcom,x1p42100` alone. * `config/no-debug-info.config` – DWARF and BTF off. The package produces no `-debuginfo` subpackage (`%global debug_package %{nil}`) and strips modules at install time, so the DWARF was compiled only to be discarded, and it is @@ -82,7 +85,7 @@ matches the ISO (the project README notes Secure Boot is not available for it). ```bash dnf config-manager addrepo --from-repofile=\ - https://f003.backblazeb2.com/file/dist-sayagit-fedora-rpm/fedora/45/kernel-sp12in.repo + https://rpm.sayag.it/kernel-sp12in/fedora/45/kernel-sp12in.repo ``` ## Building diff --git a/config/base-aarch64.config b/config/base-aarch64.config index 8ccb3a9..ed863d0 100644 --- a/config/base-aarch64.config +++ b/config/base-aarch64.config @@ -1,10 +1,11 @@ # Fedora's own aarch64 kernel configuration, used as the starting point for # this package. Taken verbatim from the config shipped inside -# kernel-core-7.2.0-61.fc45.aarch64.rpm: +# kernel-core-7.2.4-300.fc45.aarch64.rpm: # # dnf download kernel-core --arch aarch64 -# rpm2cpio kernel-core-*.aarch64.rpm | -# cpio -idm './usr/lib/modules/*/config' +# rpm2archive -n - < kernel-core-*.aarch64.rpm | +# tar -xO --wildcards '*/modules/*/config' | +# wl-copy # # It is vendored rather than downloaded so the build has no dependency on a # third-party host, and so the base config is reviewable in a diff when it is @@ -12,11 +13,11 @@ # top of it in %prep; do not edit this file by hand. # # Automatically generated file; DO NOT EDIT. -# Linux/arm64 7.2.0-61.fc45.aarch64 Kernel Configuration +# Linux/arm64 7.2.4-300.fc45.aarch64 Kernel Configuration # -CONFIG_CC_VERSION_TEXT="gcc (GCC) 16.1.1 20260703 (Red Hat 16.1.1-4)" +CONFIG_CC_VERSION_TEXT="gcc (GCC) 16.2.1 20260819 (Red Hat 16.2.1-2)" CONFIG_CC_IS_GCC=y -CONFIG_GCC_VERSION=160101 +CONFIG_GCC_VERSION=160201 CONFIG_CLANG_VERSION=0 CONFIG_AS_IS_GNU=y CONFIG_AS_VERSION=20285426 @@ -56,7 +57,7 @@ CONFIG_INIT_ENV_ARG_LIMIT=32 CONFIG_UAPI_HEADER_TEST=y CONFIG_LOCALVERSION="" # CONFIG_LOCALVERSION_AUTO is not set -CONFIG_BUILD_SALT="7.2.0-61.fc45.aarch64" +CONFIG_BUILD_SALT="7.2.4-300.fc45.aarch64" CONFIG_HAVE_KERNEL_GZIP=y CONFIG_HAVE_KERNEL_ZSTD=y # CONFIG_KERNEL_GZIP is not set @@ -13229,11 +13230,9 @@ CONFIG_CRYPTO_DEV_SUN4I_SS=m CONFIG_CRYPTO_DEV_SUN8I_CE=m # CONFIG_CRYPTO_DEV_SUN8I_CE_DEBUG is not set CONFIG_CRYPTO_DEV_SUN8I_CE_HASH=y -CONFIG_CRYPTO_DEV_SUN8I_CE_PRNG=y CONFIG_CRYPTO_DEV_SUN8I_CE_TRNG=y CONFIG_CRYPTO_DEV_SUN8I_SS=m # CONFIG_CRYPTO_DEV_SUN8I_SS_DEBUG is not set -CONFIG_CRYPTO_DEV_SUN8I_SS_PRNG=y CONFIG_CRYPTO_DEV_SUN8I_SS_HASH=y CONFIG_CRYPTO_DEV_FSL_CAAM_COMMON=m CONFIG_CRYPTO_DEV_FSL_CAAM_CRYPTO_API_DESC=m @@ -14083,9 +14082,3 @@ CONFIG_RUST_OVERFLOW_CHECKS=y CONFIG_IO_URING_ZCRX=y CONFIG_IO_URING_BPF=y CONFIG_IO_URING_BPF_OPS=y - -# -# Red Hat options -# -# CONFIG_RHEL_DIFFERENCES is not set -# end of Red Hat options diff --git a/config/foreign-socs.config b/config/foreign-socs.config new file mode 100644 index 0000000..5926d06 --- /dev/null +++ b/config/foreign-socs.config @@ -0,0 +1,68 @@ +# Config fragment turning off the ARM64 platforms this machine is not. +# +# Two platforms are deliberately kept: +# +# ARCH_QCOM what this machine is. +# ARCH_VEXPRESS cheap, and it is the ARM reference/model platform that pulls +# in the AMBA PrimeCell parts a QEMU `virt` guest expects, +# which is how an image built from this kernel can be smoke +# tested without the hardware in hand. + +# Allwinner +# CONFIG_ARCH_SUNXI is not set + +# Apple M-series +# CONFIG_ARCH_APPLE is not set + +# Broadcom, including Raspberry Pi +# CONFIG_ARCH_BCM is not set +# CONFIG_ARCH_BCM2835 is not set + +# Black Sesame +# CONFIG_ARCH_BST is not set + +# CIX +# CONFIG_ARCH_CIX is not set + +# Texas Instruments K3 +# CONFIG_ARCH_K3 is not set + +# HiSilicon +# CONFIG_ARCH_HISI is not set + +# Amlogic +# CONFIG_ARCH_MESON is not set + +# Marvell EBU +# CONFIG_ARCH_MVEBU is not set + +# NXP: i.MX, Layerscape and S32 +# CONFIG_ARCH_NXP is not set +# CONFIG_ARCH_LAYERSCAPE is not set +# CONFIG_ARCH_MXC is not set +# CONFIG_ARCH_S32 is not set + +# Renesas +# CONFIG_ARCH_RENESAS is not set + +# Rockchip +# CONFIG_ARCH_ROCKCHIP is not set + +# AMD Seattle +# CONFIG_ARCH_SEATTLE is not set + +# Socionext SynQuacer +# CONFIG_ARCH_SYNQUACER is not set + +# NVIDIA Tegra +# CONFIG_ARCH_TEGRA is not set + +# Cavium ThunderX and ThunderX2 servers +# CONFIG_ARCH_THUNDER is not set +# CONFIG_ARCH_THUNDER2 is not set + +# AppliedMicro X-Gene +# CONFIG_ARCH_XGENE is not set + +# Xilinx ZynqMP +# CONFIG_ARCH_ZYNQMP is not set diff --git a/kernel-surface.spec b/kernel-surface.spec index e238be7..ee6e132 100644 --- a/kernel-surface.spec +++ b/kernel-surface.spec @@ -12,12 +12,12 @@ # passes them in with --define, which takes precedence -- so keep the plain # `%%global <name> <value>` shape, which make-sources.sh reads with awk. %if %{undefined upstream_ver} -%global upstream_ver 7.2.3 +%global upstream_ver 7.2.4 %endif # Bumped whenever the patch tarball changes without the upstream version moving. %if %{undefined patchset_ver} -%global patchset_ver 2 +%global patchset_ver 1 %endif # rpm gives - to the version-release separator, so it cannot appear in Version @@ -56,6 +56,7 @@ Source2: base-aarch64.config Source3: surface.config Source4: live-image.config Source5: no-debug-info.config +Source6: foreign-socs.config BuildRequires: bc BuildRequires: binutils @@ -170,7 +171,7 @@ CONFIG_BUILD_SALT="%{kverrel}" EOF ARCH=arm64 scripts/kconfig/merge_config.sh -m -O . \ - .config .release.config %{SOURCE3} %{SOURCE4} %{SOURCE5} + .config .release.config %{SOURCE3} %{SOURCE4} %{SOURCE5} %{SOURCE6} make ARCH=arm64 olddefconfig # merge_config.sh is only advisory about symbols it could not set, so check the @@ -192,6 +193,7 @@ test "${kernelrelease}" = "%{kverrel}" || { } %build +export KCFLAGS="-mcpu=oryon-1+nopauth" %make_build ARCH=arm64 Image modules dtbs %install @@ -217,7 +219,7 @@ install -Dm644 System.map \ install -Dm644 .config \ %{buildroot}/usr/lib/modules/%{kverrel}/config install -Dm644 arch/arm64/boot/dts/qcom/x1p42100-microsoft-sp12in.dtb \ - %{buildroot}/usr/lib/surface-dtb/x1p42100-microsoft-sp12in.dtb + %{buildroot}/usr/lib/surface-dtb/%{kverrel}/x1p42100-microsoft-sp12in.dtb %post /usr/sbin/depmod -a %{kverrel} || : @@ -239,16 +241,34 @@ fi %files %license COPYING /usr/lib/modules/%{kverrel}/ -/usr/lib/surface-dtb/x1p42100-microsoft-sp12in.dtb +/usr/lib/surface-dtb/%{kverrel}/ %ghost %attr(0644,root,root) /boot/config-%{kverrel} %ghost %attr(0644,root,root) /boot/initramfs-%{kverrel}.img %ghost %attr(0600,root,root) /boot/System.map-%{kverrel} %ghost %attr(0644,root,root) /boot/vmlinuz-%{kverrel} %changelog +* Wed Sep 09 2026 Saya Andy 7.2.4-2 +- Compile kernel specifically for Oryon v1 instruction set (Snapdragon X1 cpu) + +* Tue Sep 08 2026 Saya Andy 7.2.4-1 +- Update Linux kernel from 7.2.3 to 7.2.4 + +* Mon Sep 07 2026 Saya Andy 7.2.3-4 +- Turn off all the ARM64 platform kernel modules besides qcom and vexpress + (used in qemu) +- Fix Bayer order in rear camera resulting in color space shift + +* Mon Sep 07 2026 Saya Andy 7.2.3-3 +- Key the /usr/lib/surface-dtb copy of the device tree by kernel version. This + package is installonly, so an unqualified path there conflicts between two + installed releases as soon as the device tree they build differs. + * Sun Sep 06 2026 Saya Andy 7.2.3-2 -- Local camera patch: report the right bayer order when mirrored (fixes the black-green monochrome output issue) -- Local surface patch: point iris at the OEM video firmware (fixes error -22 for video encoding/decoding) +- Local camera patch: report the right bayer order when mirrored (fixes the + black-green monochrome output issue) +- Local surface patch: point iris at the OEM video firmware (fixes error -22 + for video encoding/decoding) * Sun Sep 06 2026 Saya Andy 7.2.3-1 - Initial package: vanilla 7.2.3 with the overlay's Surface Pro 12" patch set diff --git a/make-sources.sh b/make-sources.sh index 7271bf8..5c11ee2 100755 --- a/make-sources.sh +++ b/make-sources.sh @@ -139,10 +139,10 @@ echo "${tarball} (${index} directories, ${total} patches)" #-------------------------------------- # Base config and fragments #-------------------------------------- -for cfg in base-aarch64 surface live-image no-debug-info; do +for cfg in base-aarch64 surface live-image no-debug-info foreign-socs; do cp "${script_dir}/config/${cfg}.config" "${output_dir}/${cfg}.config" done -echo "${output_dir}/{base-aarch64,surface,live-image,no-debug-info}.config" +echo "${output_dir}/{base-aarch64,surface,live-image,no-debug-info,foreign-socs}.config" if [[ ${skip_download} == true ]]; then exit 0 diff --git a/patches/camera/0027-media-i2c-ov13858-fix-bayer-order-when-mirrored.patch b/patches/camera/0027-media-i2c-ov13858-fix-bayer-order-when-mirrored.patch index 06b8495..d465f8d 100644 --- a/patches/camera/0027-media-i2c-ov13858-fix-bayer-order-when-mirrored.patch +++ b/patches/camera/0027-media-i2c-ov13858-fix-bayer-order-when-mirrored.patch @@ -1,26 +1,53 @@ -media: i2c: ov13858: report the right bayer order when mirrored +media: i2c: ov13858: report the right bayer order -The driver always advertises MEDIA_BUS_FMT_SGRBG10_1X10, but the horizontal -mirror moves the Bayer phase by one column, so the sensor actually delivers -RGGB while HFLIP is set. The Surface Pro 12in has the rear ov13858 mounted -upside down (rotation = <180> in DT), so both flips end up enabled and every -frame is debayered with the wrong pattern: the two greens land in the red and -blue output channels and the picture comes out desaturated, close to -monochrome. +The driver advertises MEDIA_BUS_FMT_SGRBG10_1X10 unconditionally, but that is +not what the sensor delivers in any flip state on the Surface Pro 12in. The +horizontal mirror moves the Bayer phase by one column, and the native order is +GBRG rather than GRBG, so the two correct codes are GBRG unmirrored and BGGR +mirrored. -Measured on a Surface Pro 12in by capturing raw frames off the CAMSS RDI node -and comparing the mean absolute difference of the two diagonal pairs of each -2x2 quad (the two green samples correlate far better than red against blue): +The rear ov13858 is mounted upside down (rotation = <180> in DT), so userspace +enables both flips to compensate and every frame is then debayered as RGGB +while the sensor emits BGGR. Red and blue are exchanged: an orange object comes +out cyan, warm wood comes out blue, while neutrals are unaffected, which is +what makes it easy to mistake for a white balance problem. - hflip=0 vflip=0 diagonal 4.29 antidiagonal 6.84 -> greens diagonal - hflip=1 vflip=0 diagonal 7.03 antidiagonal 4.31 -> greens antidiagonal - hflip=0 vflip=1 diagonal 4.35 antidiagonal 6.84 -> greens diagonal - hflip=1 vflip=1 diagonal 6.93 antidiagonal 4.34 -> greens antidiagonal +Two measurements on a Surface Pro 12in, from raw frames captured off the CAMSS +RDI video node. The first locates the green pair by comparing the mean absolute +difference of the diagonal against the antidiagonal samples of each 2x2 quad, +the two greens correlating far better than red against blue: + + hflip=0 vflip=0 diagonal 8.65 antidiagonal 56.82 -> greens diagonal + hflip=1 vflip=0 diagonal 56.25 antidiagonal 8.34 -> greens antidiagonal + hflip=0 vflip=1 diagonal 13.21 antidiagonal 55.94 -> greens diagonal + hflip=1 vflip=1 diagonal 56.04 antidiagonal 13.16 -> greens antidiagonal So only the horizontal mirror moves the phase; the ISP Y window offset written -for VFLIP compensates the vertical one. Derive the media bus code from HFLIP -and tag the control with V4L2_CTRL_FLAG_MODIFY_LAYOUT so userspace knows to -renegotiate the format after toggling it. +for VFLIP compensates the vertical one. + +That test cannot tell red from blue, because GBRG and GRBG share a green +diagonal just as BGGR and RGGB share a green antidiagonal. Resolving the +remaining ambiguity needs colour: a scene of objects with known colour was +captured in all four states, and the red channel identified as the one whose +ratio to blue matches the scene. The rejected assignment is the reciprocal, so +the margin is large: + + hflip=0 vflip=0 R/B 1.651 (reciprocal 0.606) -> GBRG + hflip=0 vflip=1 R/B 1.622 (reciprocal 0.616) -> GBRG + hflip=1 vflip=0 R/B 1.651 (reciprocal 0.606) -> BGGR + hflip=1 vflip=1 R/B 1.625 (reciprocal 0.615) -> BGGR + +Derive the media bus code from HFLIP and tag the control with +V4L2_CTRL_FLAG_MODIFY_LAYOUT so userspace knows to renegotiate the format after +toggling it. + +The native order disagreeing with upstream is suspicious in itself. The removal +of the per-mode {0x3811, 0x04} and {0x3813, 0x05} ISP window offsets in +"media: i2c: ov13858: add rotate control support", which now writes 1 or 2 into +those registers from the flip handlers, changes the X parity, and that patch +also sets BIT(3) of ROTATE_CONTROL when HFLIP is clear while VFLIP sets BIT(4) +when set. Whether the phase should instead be corrected there is left alone +here: this patch only reports what the sensor is measured to emit. --- a/drivers/media/i2c/ov13858.c +++ b/drivers/media/i2c/ov13858.c @@ -51,14 +78,14 @@ renegotiate the format after toggling it. -static void ov13858_update_pad_format(const struct ov13858_mode *mode, +/* -+ * Mirroring shifts the Bayer phase by one column, so the native GRBG order -+ * becomes RGGB. The vertical flip is compensated by the ISP Y window offset ++ * Mirroring shifts the Bayer phase by one column, so the native GBRG order ++ * becomes BGGR. The vertical flip is compensated by the ISP Y window offset + * and leaves the order alone. + */ +static u32 ov13858_get_format_code(struct ov13858 *ov13858) +{ -+ return ov13858->hflip->val ? MEDIA_BUS_FMT_SRGGB10_1X10 -+ : MEDIA_BUS_FMT_SGRBG10_1X10; ++ return ov13858->hflip->val ? MEDIA_BUS_FMT_SBGGR10_1X10 ++ : MEDIA_BUS_FMT_SGBRG10_1X10; +} + +static void ov13858_update_pad_format(struct ov13858 *ov13858, |