From 3b52a9ccf9dac450bb2d3291ee73650758ca5b95 Mon Sep 17 00:00:00 2001 From: Build Date: Fri, 23 Oct 2026 23:42:26 +0800 Subject: [PATCH] update: pivot to cix-mainline --- .gitignore | 1 + build.sh | 127 ++++++++++++++++++++++-------------------- config/ms-r1.fragment | 40 +++++-------- 3 files changed, 83 insertions(+), 85 deletions(-) diff --git a/.gitignore b/.gitignore index a2b3d54..388ac42 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ /logs +/drivers /core-* /linux-* diff --git a/build.sh b/build.sh index a263071..f8dc83b 100755 --- a/build.sh +++ b/build.sh @@ -3,13 +3,13 @@ # kernel requires: gcc flex bison make openssl-devel elfutils-libelf-devel bc perl-devel double-conversion-devel qt5-qtbase-devel libXi-devel rpm-build DISTRO_VERSION="44" -BUILD_VERSION=${KERNEL_VERSION:=6.19.10}-300.fc${DISTRO_VERSION}.ms-r1 +BUILD_VERSION=${KERNEL_VERSION:=7.3}-300.fc${DISTRO_VERSION}.ms-r1 HEADERS=/usr/src/kernels/$BUILD_VERSION JOBS=$(nproc) BUILD=$(pwd) -CMDLINE="console=tty0 console=ttyAMA0,115200n8 pcie_aspm=off cma=512M clk_ignore_unused=1 cpufreq.default_governor=schedutil" KERNEL_TREE=$BUILD/linux-${KERNEL_VERSION} -KERNEL_PATCHES=$BUILD/linux-sky1 +KERNEL_PATCHES=$BUILD/linux-cix-main +DRIVERS=$BUILD/drivers LOGS=$BUILD/logs CMDLINE_COMMON="console=tty0 console=ttyAMA0,115200n8 cma=512M clk_ignore_unused=1 cpufreq.default_governor=schedutil" @@ -18,7 +18,7 @@ CMDLINE="pcie_aspm=off $CMDLINE_COMMON" log() { printf '[%s] %s\n' "$(date '+%H:%M:%S')" "$*"; } die() { printf '[%s] ERROR: %s\n' "$(date '+%H:%M:%S')" "$*"; exit 1; } -run() { local l=/tmp/$BUILD_VERSION.build.run.log; "$@" 2>&1 > "$l" || die "failed: $(cat $l | tail -n 1)"; } +run() { local l=/tmp/$BUILD_VERSION.build.run.log; "$@" > "$l" 2>&1 || die "failed: $(cat $l | tail -n 1)"; } sub() { local s=/tmp/$BUILD_VERSION.build.sub.sh; echo "$(declare -p); $(declare -f)" > $s; echo "source $s 2>/dev/null && $1"; } get() { local d=/tmp/$1; [ -f "$d" ] || { run wget -q -O $d "$2/$1"; cat $d; return; }; log "using cached file $d" >&2; cat $d; } @@ -34,58 +34,61 @@ setup() { purge log "copying header files" cp -r "$KERNEL_TREE" "$HEADERS" || die "failed" + log "installing kernel modules" - make -C "$HEADERS" ARCH=arm64 -j"$JOBS" modules_install install clean "$LOGS/install.log" 2>&1 || die "failed (see logs/install.log)" + make -C "$HEADERS" -j"$JOBS" modules_install install >"$LOGS/install.log" 2>&1 || die "failed (see logs/install.log)" + + log "installing drivers" + for drv in "${DRV[@]}"; do + make -C "$HEADERS" -j"$JOBS" M=$drv modules_install install >>"$LOGS/install.log" 2>&1 || die "failed (see logs/install.log)" + done log "updating bootloader configuration" - grubby --update-kernel=/boot/vmlinuz-$BUILD_VERSION --args="$CMDLINE" - local id="$(grubby --info=$(grubby --default-index) | grep 'id=' | awk -F'\"' '{print $2}')" - local conf=/boot/loader/entries/$id.powersave.conf - cp /boot/loader/entries/$id.conf $conf - sed -i "s/$CMDLINE/$CMDLINE_POWERSAVE/" $conf - sed -i "/^title/s/$/ Powersave Mode/" $conf + local c1=/boot/loader/entries/$id.conf + local c2=/boot/loader/entries/$id.powersave.conf + cp $c1 $c2 + sed -i "/^options/s/$/ $CMDLINE/" $c1 + sed -i "/^options/s/$/ $CMDLINE_POWERSAVE/" $c2 + sed -i "/^title/s/$/ Powersave Mode/" $c2 + log "cleaning up" + make -C "$HEADERS" clean >/dev/null } -[ -z "$LOCAL" ] || [[ "$(uname -m)" == "aarch64" ]] || die "LOCAL (=$LOCAL) can only be enabled on aarch64 machines" [ -z "$UNINSTALL" ] || { pkexec bash -c "$(sub purge)" && log "done"; exit 0; } -[ -z "$CLEAN" ] || rm -rf $KERNEL_TREE $KERNEL_PATCHES $LOGS +[ -z "$CLEAN" ] || rm -rf $KERNEL_TREE $KERNEL_PATCHES $DRIVERS $LOGS -mkdir -p "$LOGS" -log "building linux kernel ${KERNEL_VERSION} (arm64) with sky1-${TAG:=latest} patches" - -append() { - local series=$KERNEL_PATCHES/patches/series - echo "$(grep -v -e'^<<<<<<<' -e '^>>>>>>>' -e'=======' $series)" >$series - git add $series >/dev/null 2>&1 - GIT_EDITOR=true git rebase --continue >/dev/null 2>&1 -} +mkdir -p "$DRIVERS" "$LOGS" +log "building linux kernel ${KERNEL_VERSION} (arm64) with CIX mainline patches" rebase() { - run git remote add $1 https://github.com/$1/linux-sky1.git + run git remote add $1 https://github.com/$1/$(basename $(git remote get-url origin)) run git fetch $1 - git rebase $1/$2 >/dev/null 2>&1 || append || die "could not rebase branch $1:$2" + git config user.email "build@ms-r1.local" + git config user.name "Build" + git rebase $1/$2 >/dev/null 2>&1 || die "could not rebase branch $1:$2" } if [ ! -d "$KERNEL_PATCHES" ]; then - log "cloning linux-sky1 repository" - run git clone --depth=1 https://github.com/Sky1-Linux/linux-sky1.git + log "cloning CIX linux mainline" + run git clone --depth=1 https://github.com/cixtech/cix-linux-main.git $KERNEL_PATCHES cd $KERNEL_PATCHES - # see - git config user.email "build@ms-r1.local" - git config user.name "Build" - rebase srcshelton main # patches: fix Kconfig deps and module reachability - rebase peppergrayxyz v6.19.10 # Update patch for 6.19.10 - rebase grkml config/cilium-ipsec-prereqs # config: enable Cilium IPsec prerequisites across all tracks - rebase hotschmoe cdnsp-sky1-reboot-hang # usb: cdnsp-sky1: drop the shutdown hook that hangs reboot on the MS-R1 - rebase hotschmoe sky1-gpt-clock-names # arm64: dts: cix: sky1: name the GPT clocks so the broadcast timer probes - rebase hotschmoe minisforum-ms-r1 # arm64: dts: cix: add the Minisforum MS-R1- #38 - rebase hotschmoe armchina-npu-libnoe # misc: armchina-npu: run CIX libnoe 0.5 jobs; fix cache maintenance and devfreq panic - rebase hotschmoe mvx-devfreq-perf-domain # media: cix: mvx: drive the SCMI perf domain from devfreq - rebase hotschmoe panthor-devfreq-no-clk-poll # drm/panthor: don't poll the SCMI core clock for devfreq status - rebase hotschmoe scmi-cpufreq-boost-param # cpufreq: scmi: add a boost parameter that holds from policy creation - rebase lpennisi73-tech usb-cdns3-null-guards # patches: add cdns3 NULL guards for the early role switch and runtime … - rebase lpennisi73-tech amvx-mmu-flexible-array-vb2-lock # patches: add amvx MMU flexible-array and vb2 queue lock fixes (6.18) + log "head: $(git show -s --oneline)" +fi + +if [ ! -d "$DRIVERS/npu" ]; then + log "cloning NPU driver" + run git clone --depth=1 --branch=cix_mainline_dev https://github.com/cixtech/cix_opensource__npu_driver.git $DRIVERS/npu + cd $DRIVERS/npu + log "head: $(git show -s --oneline)" +fi + +if [ ! -d "$DRIVERS/vpu" ]; then + log "cloning VPU driver" + run git clone --depth=1 --branch=cix_mainline_dev https://github.com/cixtech/cix_opensource__vpu_driver.git $DRIVERS/vpu + cd $DRIVERS/vpu + rebase EvilOlaf fix-strncpy # v4l2: replace strncpy with strscpy + log "head: $(git show -s --oneline)" fi if [ ! -d "$KERNEL_TREE" ]; then @@ -94,44 +97,50 @@ if [ ! -d "$KERNEL_TREE" ]; then | tar -xf - --xz -C $BUILD fi -if [ ! -f "$KERNEL_TREE/.config-fedora" ] && [ -z "$LOCAL" ]; then - log "downloading fedora kernel core" - get "kernel-core-${KERNEL_VERSION}-300.fc${DISTRO_VERSION}.aarch64.rpm" "https://download.fedoraproject.org/pub/fedora/linux/releases/${DISTRO_VERSION}/Everything/aarch64/os/Packages/k/" \ - | rpm2cpio - \ - | cpio -i --quiet --to-stdout "./lib/modules/*/config" \ - > $KERNEL_TREE/.config-fedora -fi - -if [ ! -f "$KERNEL_TREE/.config-local" ] && [ -n "$LOCAL" ]; then +if [ ! -f "$KERNEL_TREE/.config-stock" ] && [ -z "$CONFIG" ]; then log "loading local kernel config" yes "" | make -C "$KERNEL_TREE" localmodconfig >/dev/null 2>&1 - mv $KERNEL_TREE/.config $KERNEL_TREE/.config-local + cp $KERNEL_TREE/.config $KERNEL_TREE/.config-stock fi -if [ ! -f "$KERNEL_TREE/.patches-sky1" ]; then +if [ ! -f "$KERNEL_TREE/.patches-cix" ]; then log "applying patches" - output="$LOGS/patches.log"; echo "" >$output - for p in "$KERNEL_PATCHES/patches-${TAG}"/*.patch; do - patch -d "$KERNEL_TREE" -p1 --forward --batch -s <"$p" >>$output || die "could not apply patch: $p (see logs/patches.log)" + err=0; output="$LOGS/patches.log"; echo "" >$output + for p in "$KERNEL_PATCHES/patches-${KERNEL_VERSION:0:3}"/*.patch; do + if ! patch -d "$KERNEL_TREE" -p1 --forward --batch -s <"$p" >>$output 2>&1 + then log "warning: patch failed: $p"; err=$((err+1)); fi done + log $(if (( err == 0 )); then echo "all patches applied"; else echo "warning: $err error(s) reported (see logs/patches.log)"; fi) find "$KERNEL_TREE" \( -name '*.orig' -o -name '*.rej' \) -delete - touch "$KERNEL_TREE/.patches-sky1" + touch "$KERNEL_TREE/.patches-cix" fi if [ ! -f "$KERNEL_TREE/.config.ms-r1" ] || [ -n "$REBUILD" ]; then log "configuring kernel" cd $KERNEL_TREE make mrproper >/dev/null - cp $KERNEL_PATCHES/config/config.sky1-${TAG} ".config-sky1" - run ./scripts/kconfig/merge_config.sh -m -O . .config-sky1 .config-$(if [ -n "$LOCAL" ]; then echo "local"; else echo "fedora"; fi) + cp $KERNEL_PATCHES/config/config-${KERNEL_VERSION:0:3}.defconfig .config-cix + cp $CONFIG .config-stock 2>/dev/null + run ./scripts/kconfig/merge_config.sh -m -O . .config-cix .config-stock run ./scripts/kconfig/merge_config.sh -m -O . .config "$BUILD/config/ms-r1.fragment" - CROSS=$(if [ -z "$LOCAL" ]; then echo "aarch64-linux-gnu-"; fi) + CROSS=$(if [[ "$(uname -m)" != "aarch64" ]]; then echo "aarch64-linux-gnu-"; fi) make ARCH=arm64 CROSS_COMPILE=$CROSS olddefconfig >/dev/null 2>&1 cp .config .config.ms-r1 fi log "compiling kernel" make -C "$KERNEL_TREE" ARCH=arm64 CROSS_COMPILE=$CROSS -j"$JOBS" "$LOGS/build.log" 2>&1 || die "failed (see logs/build.log)" + +log "compiling drivers" +for m in $(find $DRIVERS -name "dkms.conf" -print); do + cd "$(dirname $m)"; log "in: $PWD" + options=$(bash -c "source $m && echo \$MAKE" | cut -d' ' -f4- -) + IFS=' ' read -ra array <<< "$options" + make clean >/dev/null 2>&1 + make -C "$KERNEL_TREE" -j"$JOBS" M=$PWD "${array[@]}" >>"$LOGS/build.log" 2>&1 || die "failed (see logs/build.log)" + DRV+=($PWD) +done + [ -z "$INSTALL" ] || { pkexec bash -c "$(sub setup)" && log "done"; exit 0; } log "done" log "note: run this script with INSTALL=1 to trigger kernel install (requires root privileges)" diff --git a/config/ms-r1.fragment b/config/ms-r1.fragment index 38f6d24..9cf60c4 100644 --- a/config/ms-r1.fragment +++ b/config/ms-r1.fragment @@ -1,10 +1,7 @@ -# options for CIX Sky1-Linux kernel on MS-R1 +# kernel config for MS-R1 # see CONFIG_LOCALVERSION="-300.fc44.ms-r1" -CONFIG_DEBUG_INFO_REDUCED=n -CONFIG_DEBUG_INFO_BTF=y -CONFIG_DEBUG_INFO_BTF_MODULES=y -CONFIG_PROBE_EVENTS_BTF_ARGS=y +# CONFIG_WERROR is not set # CONFIG_DRM_WERROR is not set # CONFIG_ARM64_MPAM is not set CONFIG_DEVFREQ_GOV_SIMPLE_ONDEMAND=m @@ -21,29 +18,15 @@ CONFIG_SENSORS_ARM_SCMI=m CONFIG_IMX_SCMI_MISC_DRV=m CONFIG_IMX_SCMI_MISC_EXT=m CONFIG_ARM_SCMI_CPUFREQ=m -# CONFIG_ARM_SCMI_TRANSPORT_VIRTIO is not set -# CONFIG_ARM_SCMI_POWER_CONTROL is not set -# CONFIG_I2C_SCMI is not set -# CONFIG_PINCTRL_SCMI is not set -# CONFIG_PINCTRL_IMX_SCMI is not set -# CONFIG_IIO_SCMI is not set -# CONFIG_ARM_SCMI_POWERCAP is not set -CONFIG_EXTRA_FIRMWARE="" -CONFIG_EXTRA_FIRMWARE_DIR="" +CONFIG_I2C_CADENCE=y +CONFIG_I2C_GPIO=m +CONFIG_I2C_IMX=m # # Essential platform support # CONFIG_ARCH_CIX=y CONFIG_PCI_SKY1=y CONFIG_PCIE_CADENCE_HOST=y -# CONFIG_PCIE_CADENCE_PLAT_HOST is not set -# CONFIG_PCIE_CADENCE_PLAT_EP is not set -# CONFIG_MTD_NAND_CADENCE is not set -# CONFIG_SPI_CADENCE is not set -# CONFIG_SPI_CADENCE_XSPI is not set -# CONFIG_CADENCE_WATCHDOG is not set -# CONFIG_VIDEO_CADENCE_CSI2TX is not set -# CONFIG_RTC_DRV_CADENCE is not set CONFIG_PINCTRL_SKY1_BASE=y CONFIG_PINCTRL_SKY1=y CONFIG_RESET_SKY1=y @@ -64,12 +47,11 @@ CONFIG_CIX_ACPI_USB_SCAN=y CONFIG_USB_GADGET=y CONFIG_USB_CDNS_SUPPORT=y CONFIG_USB_CDNS3=y +CONFIG_USB_CDNS3_TI=m +CONFIG_USB_CDNS3_IMX=m CONFIG_USB_CDNSP=y -# CONFIG_USB_CDNSP_PCI is not set -# CONFIG_USB_CDNS2_UDC is not set CONFIG_USB_CDNSP_HOST=y CONFIG_USB_CDNSP_GADGET=y -CONFIG_USB_CDNSP_SKY1=y CONFIG_USB_UAS=m CONFIG_TYPEC=y CONFIG_TYPEC_RTS5453=y @@ -80,10 +62,16 @@ CONFIG_PHY_CIX_PCIE=y CONFIG_PHY_CIX_USB2=y CONFIG_PHY_CIX_USB3=y CONFIG_PHY_CIX_USBDP=y +CONFIG_PHY_CADENCE_TORRENT=m +CONFIG_PHY_CADENCE_DPHY=m +CONFIG_PHY_CADENCE_DPHY_RX=m +CONFIG_PHY_CADENCE_SIERRA=m +CONFIG_PHY_CADENCE_SALVO=m # # Display # CONFIG_DRM_CIX=m +CONFIG_DRM_CDNS_MHDP8546=m CONFIG_DRM_LINLONDP=m CONFIG_DRM_TRILIN_DPSUB=m CONFIG_DRM_TRILIN_DP_CIX=m @@ -142,6 +130,6 @@ CONFIG_DMABUF_HEAPS_DSP=m # # Device specific # -CONFIG_BLK_DEV_NVME=m +CONFIG_BLK_DEV_NVME=y CONFIG_RTW89=m CONFIG_RTW89_8852BE=m