Skip to content

Commit

Permalink
更新 buildroot 版本至 2024.02.x
Browse files Browse the repository at this point in the history
  • Loading branch information
wjz304 committed Jan 8, 2025
1 parent a0166f5 commit e41fd1e
Show file tree
Hide file tree
Showing 4 changed files with 83 additions and 50 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/addons.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ jobs:
VERSION="${{ inputs.version }}"
else
LATEST_TAG="$(curl -skLH "Authorization: token ${{ secrets.RRORG }}" "https://api.github.com/repos/RROrg/qr-addons/releases" | jq -r ".[0].tag_name" 2>/dev/null)"
if [ -n "${LATEST_TAG}" -a "$(echo ${LATEST_TAG} | cut -d '.' -f 1,2)" = "$(date +'%y.%-m')" ]; then # format %y.%-m.$i
if [ -n "${LATEST_TAG}" ] && [ "$(echo ${LATEST_TAG} | cut -d '.' -f 1,2)" = "$(date +'%y.%-m')" ]; then # format %y.%-m.$i
VERSION="$(echo ${LATEST_TAG} | awk -F '.' '{$3=$3+1}1' OFS='.')"
else
VERSION="$(date +'%y.%-m').0"
Expand Down
18 changes: 11 additions & 7 deletions .github/workflows/buildroot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ on:
type: boolean
br2ver:
description: "buildroot version"
default: "2023.08.x"
default: "2024.02.x"
type: string
kerver:
description: "kernel version"
Expand Down Expand Up @@ -52,8 +52,12 @@ jobs:
sudo timedatectl set-timezone "Asia/Shanghai"
sudo apt update
sudo apt install -y jq gawk cpio gettext libelf-dev qemu-utils
sudo snap install yq
sudo apt install -y locales busybox dialog gettext sed gawk jq curl
sudo apt install -y python-is-python3 python3-pip libelf-dev qemu-utils cpio xz-utils lz4 lzma bzip2 gzip zstd
# sudo snap install yq
if ! command -v yq &>/dev/null || ! yq --version 2>/dev/null | grep -q "v4."; then
sudo curl -kL https://github.com/mikefarah/yq/releases/latest/download/yq_linux_amd64 -o /usr/bin/yq && sudo chmod a+x /usr/bin/yq
fi
df -h
Expand All @@ -66,7 +70,7 @@ jobs:
VERSION="${{ inputs.version }}"
else
LATEST_TAG="$(curl -skLH "Authorization: token ${{ secrets.RRORG }}" "https://api.github.com/repos/RROrg/qr-buildroot/releases" | jq -r ".[0].tag_name" 2>/dev/null)"
if [ -n "${LATEST_TAG}" -a "$(echo ${LATEST_TAG} | cut -d '.' -f 1,2)" = "$(date +'%y.%-m')" ]; then # format %y.%-m.$i
if [ -n "${LATEST_TAG}" ] && [ "$(echo ${LATEST_TAG} | cut -d '.' -f 1,2)" = "$(date +'%y.%-m')" ]; then # format %y.%-m.$i
VERSION="$(echo ${LATEST_TAG} | awk -F '.' '{$3=$3+1}1' OFS='.')"
else
VERSION="$(date +'%y.%-m').0"
Expand All @@ -91,7 +95,7 @@ jobs:
- name: Zip modules
run: |
cp -f buildroot/.qr-buildroot/output/images/bzImage bzImage-qr || exit 1
cp -f buildroot/.qr-buildroot/output/images/rootfs.cpio.xz initrd-qr || exit 1
cp -f buildroot/.qr-buildroot/output/images/rootfs.cpio.zst initrd-qr || exit 1
VERSION="${{ env.VERSION }}"
VERSION="${VERSION:-"test"}"
Expand All @@ -105,7 +109,7 @@ jobs:
with:
name: buildroot
path: |
buildroot*.zip
buildroot*.zip
retention-days: 5

- name: Release
Expand All @@ -114,7 +118,7 @@ jobs:
with:
tag: ${{ env.VERSION }}
prerelease: ${{ inputs.prerelease }}
artifacts: buildroot*.zip
artifacts: buildroot*.zip
body: |
Buildroot version: ${{ env.BUILDROOT_VERSION }}
Kernel version: ${{ env.KERNEL_VERSION }}
Expand Down
50 changes: 34 additions & 16 deletions .github/workflows/modules.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,13 @@ jobs:
matrix:
include:
- arch: x86_64
kver: 4.14.24
qver: 4.5.4
#- arch: x86_64
# qver: 5.0.0
#- arch: x86_64
# qver: 5.1.0
- arch: x86_64
kver: 5.10.60
qver: 5.2.0

runs-on: ubuntu-latest
steps:
Expand All @@ -53,42 +57,56 @@ jobs:
- name: Make modules
run: |
sudo -s # use root to compile
KVER=${{ matrix.kver }}
ROOT_PATH=${{ github.workspace }}
ARCH=${{ matrix.arch }}
QVER=${{ matrix.qver }}
DEVICE="TS-X89"
. qr-modules/compile.sh
echo "makeEnvDeploy"
makeEnvDeploy ${{ matrix.arch }} "${KVER%.*}"
makeEnvDeploy "${ROOT_PATH}" "${ARCH}" "${QVER}" "${DEVICE}"
echo "makemodules"
makemodules "qr-modules/src/${KVER}" "output/modules/${KVER}-qnap"
KVER=$(getKver "${ROOT_PATH}" "${ARCH}" "${QVER}" "${DEVICE}")
mkdir -p "output/modules/${KVER}-qnap"
makemodules "${ROOT_PATH}" "${ARCH}" "${QVER}" "${DEVICE}" "qr-modules/src/${KVER}" "output/modules/${KVER}-qnap"
- name: firmware
run: |
KVER=${{ matrix.kver }}
sudo -s # use root to compile
ROOT_PATH=${{ github.workspace }}
ARCH=${{ matrix.arch }}
QVER=${{ matrix.qver }}
DEVICE="TS-X89"
mkdir -p output/firmware
. qr-modules/compile.sh
KVER=$(getKver "${ROOT_PATH}" "${ARCH}" "${QVER}" "${DEVICE}")
mkdir -p "output/firmware"
echo "get firmware"
SOURCE=/tmp/linux-firmware
git clone --depth=1 https://git.kernel.org/pub/scm/linux/kernel/git/firmware/linux-firmware.git ${SOURCE}
while read L; do
[ -z "${L}" ] && continue
if [ -e "${SOURCE}/${L}" ]; then
mkdir -p "$(dirname output/firmware/${L})"
cp "${SOURCE}/${L}" "output/firmware/${L}"
cp -f "${SOURCE}/${L}" "output/firmware/${L}"
else
[ ! -e "output/firmware/${L}" ] && echo "Missing ${L}"
fi
done < <(find output/modules/${KVER}-qnap -name \*.ko -exec sh -c '/sbin/modinfo {} | grep ^firmware' \; | awk '{print $2}')
done <<<$(find output/modules/${KVER}-qnap -name \*.ko -exec sh -c 'modinfo {} | grep ^firmware' \; | awk '{print $2}')
- name: Tar to Artifacts
run: |
tar -zcf ${{ matrix.arch }}-${{ matrix.kver }}.tgz -C output .
tar -zcf ${ARCH}-${KVER}.tgz -C output .
- name: Upload to Artifacts
uses: actions/upload-artifact@v4
with:
name: modules-${{ matrix.arch }}-${{ matrix.kver }}
name: modules-${{ matrix.arch }}-${{ matrix.qver }}
path: |
${{ matrix.arch }}-${{ matrix.kver }}.tgz
${{ matrix.arch }}-*.tgz
release:
runs-on: ubuntu-latest
Expand All @@ -112,7 +130,7 @@ jobs:
VERSION="${{ inputs.version }}"
else
LATEST_TAG="$(curl -skLH "Authorization: token ${{ secrets.RRORG }}" "https://api.github.com/repos/RROrg/qr-modules/releases" | jq -r ".[0].tag_name" 2>/dev/null)"
if [ -n "${LATEST_TAG}" -a "$(echo ${LATEST_TAG} | cut -d '.' -f 1,2)" = "$(date +'%y.%-m')" ]; then # format %y.%-m.$i
if [ -n "${LATEST_TAG}" ] && [ "$(echo ${LATEST_TAG} | cut -d '.' -f 1,2)" = "$(date +'%y.%-m')" ]; then # format %y.%-m.$i
VERSION="$(echo ${LATEST_TAG} | awk -F '.' '{$3=$3+1}1' OFS='.')"
else
VERSION="$(date +'%y.%-m').0"
Expand Down
63 changes: 37 additions & 26 deletions .github/workflows/qr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,12 @@ jobs:
sudo timedatectl set-timezone "Asia/Shanghai"
sudo apt update
sudo apt install -y jq cpio gettext
sudo snap install yq
sudo apt install -y locales busybox dialog gettext sed gawk jq curl
sudo apt install -y python-is-python3 python3-pip libelf-dev qemu-utils cpio xz-utils lz4 lzma bzip2 gzip zstd
# sudo snap install yq
if ! command -v yq &>/dev/null || ! yq --version 2>/dev/null | grep -q "v4."; then
sudo curl -kL https://github.com/mikefarah/yq/releases/latest/download/yq_linux_amd64 -o /usr/bin/yq && sudo chmod a+x /usr/bin/yq
fi
# calculates the version number and push
- name: Calculate version
Expand All @@ -58,7 +62,7 @@ jobs:
VERSION="${{ inputs.version }}"
else
LATEST_TAG="$(curl -skLH "Authorization: token ${{ secrets.RRORG }}" "https://api.github.com/repos/RROrg/qr/releases" | jq -r ".[0].tag_name" 2>/dev/null)"
if [ -n "${LATEST_TAG}" -a "$(echo ${LATEST_TAG} | cut -d '.' -f 1,2)" = "$(date +'%y.%-m')" ]; then # format %y.%-m.$i
if [ -n "${LATEST_TAG}" ] && [ "$(echo ${LATEST_TAG} | cut -d '.' -f 1,2)" = "$(date +'%y.%-m')" ]; then # format %y.%-m.$i
VERSION="$(echo ${LATEST_TAG} | awk -F '.' '{$3=$3+1}1' OFS='.')"
else
VERSION="$(date +'%y.%-m').0"
Expand All @@ -73,9 +77,8 @@ jobs:
echo "TAGDATE=${TAGDATE}" >>$GITHUB_ENV
echo "VERSION=${VERSION}" >>$GITHUB_ENV
cd qr
if [ -n "${VERSION}" ]; then
cd qr
# Modify Source File
echo "${VERSION}" >VERSION
echo "${VERSION}" > files/mnt/p1/QR_VERSION
Expand All @@ -90,10 +93,9 @@ jobs:
git push -f
fi
else
cd qr
sed -i "s/^QR_VERSION=.*/QR_VERSION=\"${TAGDATE}\"/" files/initrd/opt/qr/include/consts.sh
fi
cd -
# Convert po2mo, Get exts
- name: Convert po2mo, addons and Modules
Expand All @@ -106,7 +108,7 @@ jobs:
getModules "files/mnt/p8/modules" "${PRE}"
getBuildroot "files/mnt/p8" "${PRE}"
echo "Repack initrd"
[ "${{ inputs.prerelease }}" = "true" ] && RELEASE="pre" || RELEASE=""
sed -i "s/^QR_RELEASE=.*$/RR_RELEASE=\"${RELEASE}\"/" files/initrd/opt/qr/include/consts.sh
Expand All @@ -128,24 +130,32 @@ jobs:
LOOPX=$(sudo losetup -f)
sudo losetup -P "${LOOPX}" "qr.img"
echo "Mounting image file"
mkdir -p "/tmp/p1"
mkdir -p "/tmp/p8"
sudo mount ${LOOPX}p1 "/tmp/p1"
sudo mount ${LOOPX}p8 "/tmp/p8"
for i in 1 2 3 5 8; do
[ ! -d "files/mnt/p${i}" ] && continue
rm -rf "/tmp/mnt/p${i}"
mkdir -p "/tmp/mnt/p${i}"
echo "Mounting ${LOOPX}p${i}"
sudo mount "${LOOPX}p${i}" "/tmp/mnt/p${i}" || {
echo "Can't mount ${LOOPX}p${i}."
break
}
echo "Copying files to ${LOOPX}p${i}"
[ ${i} -eq 1 ] && sudo cp -af "files/mnt/p${i}/"{.locale,.timezone} "/tmp/mnt/p${i}/" 2>/dev/null || true
sudo cp -rf "files/mnt/p${i}/"* "/tmp/mnt/p${i}" || true
echo "Copying files"
sudo cp -Rf "files/mnt/p1/"* "/tmp/p1"
sudo cp -Rf "files/mnt/p8/"* "/tmp/p8"
sync
sudo sync
echo "Unmount image file"
sudo umount "/tmp/p1"
sudo umount "/tmp/p8"
rmdir "/tmp/p1"
rmdir "/tmp/p8"
echo "Unmounting ${LOOPX}p${i}"
sudo umount "/tmp/mnt/p${i}" || {
echo "Can't umount ${LOOPX}p${i}."
break
}
rm -rf "/tmp/mnt/p${i}"
done
sudo losetup --detach ${LOOPX}
sudo losetup --detach "${LOOPX}"
# Zip image and generate checksum
- name: Pack
Expand All @@ -172,7 +182,7 @@ jobs:
(cd $(dirname "${F}") && sha256sum $(basename "${F}")) >>sha256sum
zip -9j "update-${VERSION}.zip" "${F}"
fi
done < <(yq '.replace | explode(.) | to_entries | map([.key])[] | .[]' update-list.yml)
done <<<$(yq '.replace | explode(.) | to_entries | map([.key])[] | .[]' update-list.yml)
zip -9j "update-${VERSION}.zip" sha256sum
# updateall.zip
Expand All @@ -192,7 +202,7 @@ jobs:
(cd $(dirname "${F}") && sha256sum $(basename "${F}")) >>sha256sum
zip -9j "updateall-${VERSION}.zip" "${F}"
fi
done < <(yq '.replace | explode(.) | to_entries | map([.key])[] | .[]' update-list.yml)
done <<<$(yq '.replace | explode(.) | to_entries | map([.key])[] | .[]' update-list.yml)
zip -9j "updateall-${VERSION}.zip" sha256sum
# sha256sum
Expand Down Expand Up @@ -237,7 +247,8 @@ jobs:
qr/update*.zip
qr/sha256sum
body: |
- Editing ...
- Please do not upgrade this version now (In release testing...),
- Please upgrade after updating the Changelog ...
owner: RROrg
repo: qr
token: ${{ secrets.RRORG }}

0 comments on commit e41fd1e

Please sign in to comment.