Skip to content

Commit b193c39

Browse files
authored
Remove patch for riscv (#9310)
* Delete .github/workflows/update-riscv-depand.yml * Update package-rhel-riscv.sh * Update package-debian-riscv.sh * Create package-debian-loong.sh * Update build-linux.yml * Update build-linux.yml * Update package-debian-loong.sh * Update build-linux.yml * Update Directory.Packages.props
1 parent e68842b commit b193c39

6 files changed

Lines changed: 929 additions & 416 deletions

File tree

.github/workflows/build-linux.yml

Lines changed: 175 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -325,3 +325,178 @@ jobs:
325325
--data-binary @"$f" \
326326
"${upload_url}?name=${f##*/}"
327327
done
328+
329+
deb-loong64:
330+
name: build and release deb loong64
331+
if: |
332+
(github.event_name == 'workflow_dispatch' && inputs.release_tag != '') ||
333+
(github.event_name == 'push' && startsWith(github.ref, 'refs/tags/'))
334+
runs-on: ubuntu-24.04
335+
336+
env:
337+
RELEASE_TAG: ${{ case(inputs.release_tag != '', inputs.release_tag, github.ref_name) }}
338+
QCOW2_URL: https://github.com/xujiegb/debian-loong64-qcow2/releases/download/13.4/debian13-loong64.qcow2
339+
EFI_CODE_URL: https://github.com/xujiegb/debian-loong64-qcow2/releases/download/13.4/edk2-loongarch64-code.fd
340+
EFI_VARS_URL: https://github.com/xujiegb/debian-loong64-qcow2/releases/download/13.4/edk2-loongarch64-vars.fd
341+
QCOW2_IMAGE: debian13-loong64.qcow2
342+
EFI_CODE: edk2-loongarch64-code.fd
343+
EFI_VARS: edk2-loongarch64-vars.fd
344+
QEMU_VERSION: 10.2.2
345+
346+
steps:
347+
- name: Prepare host tools
348+
shell: bash
349+
run: |
350+
set -euo pipefail
351+
352+
sudo apt-get update
353+
sudo apt-get install -y rsync qemu-utils expect wget curl ca-certificates libfdt1 libglib2.0-0 libpixman-1-0 libslirp0
354+
355+
- name: Checkout repo
356+
uses: actions/checkout@v6
357+
with:
358+
submodules: recursive
359+
fetch-depth: 0
360+
361+
- name: Download QEMU prebuild
362+
run: |
363+
set -euo pipefail
364+
365+
wget -O qemu-linux-x64.tar.gz \
366+
"https://github.com/xujiegb/qemu-linux-prebuild/releases/download/${QEMU_VERSION}/qemu-linux-x64.tar.gz"
367+
368+
tar -xzf qemu-linux-x64.tar.gz
369+
370+
mkdir -p "$HOME/qemu-install"
371+
372+
rsync -a qemu-linux-x64/ "$HOME/qemu-install/"
373+
374+
"$HOME/qemu-install/bin/qemu-system-loongarch64" --version
375+
376+
- name: Download loong64 qcow2 and EFI firmware
377+
shell: bash
378+
run: |
379+
set -euo pipefail
380+
381+
wget -O "$QCOW2_IMAGE" "$QCOW2_URL"
382+
wget -O "$EFI_CODE" "$EFI_CODE_URL"
383+
wget -O "$EFI_VARS" "$EFI_VARS_URL"
384+
385+
qemu-img info "$QCOW2_IMAGE"
386+
387+
- name: Build loong64 DEB in VM through serial console
388+
shell: bash
389+
timeout-minutes: 180
390+
env:
391+
RELEASE_TAG: ${{ env.RELEASE_TAG }}
392+
run: |
393+
set -euo pipefail
394+
395+
mkdir -p "$GITHUB_WORKSPACE/dist/deb-loong64"
396+
397+
expect <<'EOF'
398+
log_user 1
399+
set timeout -1
400+
401+
set release_tag $env(RELEASE_TAG)
402+
set qemu_bin "$env(HOME)/qemu-install/bin/qemu-system-loongarch64"
403+
set qemu_rom_dir "$env(HOME)/qemu-install/share/qemu"
404+
405+
set workspace $env(GITHUB_WORKSPACE)
406+
set repo $env(GITHUB_REPOSITORY)
407+
set sha $env(GITHUB_SHA)
408+
409+
set qcow2 $env(QCOW2_IMAGE)
410+
set efi_code $env(EFI_CODE)
411+
set efi_vars $env(EFI_VARS)
412+
413+
proc wait_prompt {} {
414+
expect {
415+
-re "__CI_PROMPT__# " {}
416+
timeout { exit 1 }
417+
eof { exit 1 }
418+
}
419+
}
420+
421+
proc run_cmd {cmd} {
422+
send -- "$cmd\r"
423+
wait_prompt
424+
}
425+
426+
spawn $qemu_bin \
427+
-L $qemu_rom_dir \
428+
-machine virt \
429+
-accel tcg,thread=multi,tb-size=2048 \
430+
-cpu la464 \
431+
-m 9216 \
432+
-smp 4 \
433+
-drive if=pflash,format=raw,unit=0,file=$efi_code,readonly=on \
434+
-drive if=pflash,format=raw,unit=1,file=$efi_vars \
435+
-device virtio-blk-pci,drive=hd0,bootindex=1 \
436+
-drive if=none,media=disk,id=hd0,file=$qcow2,format=qcow2 \
437+
-netdev user,id=net0 \
438+
-device virtio-net-pci,netdev=net0 \
439+
-virtfs local,path=$workspace,mount_tag=workspace,security_model=none,id=workspace \
440+
-display none \
441+
-serial stdio \
442+
-monitor none
443+
444+
expect -re "login:|debian login:"
445+
send -- "root\r"
446+
447+
expect -re "Password:|密码:|密码:"
448+
send -- "password\r"
449+
450+
expect {
451+
-re "# " {}
452+
timeout { exit 1 }
453+
eof { exit 1 }
454+
}
455+
456+
send -- "export TERM=dumb; export PS1='__CI_PROMPT__# '\r"
457+
wait_prompt
458+
459+
run_cmd "mkdir -p /workspace"
460+
run_cmd "mount -t 9p -o trans=virtio,version=9p2000.L workspace /workspace || mount -t 9p -o trans=virtio workspace /workspace"
461+
run_cmd "IFACE=\$(ip -o link show | awk -F': ' '\$2 != \"lo\" {print \$2; exit}') ; ip link set \$IFACE up || true"
462+
run_cmd "dhclient \$IFACE || true"
463+
run_cmd "printf 'nameserver 10.0.2.3\nnameserver 1.1.1.1\n' >/etc/resolv.conf"
464+
run_cmd "apt-get update || apt-get update || apt-get update"
465+
run_cmd "DEBIAN_FRONTEND=noninteractive apt-get install -y sudo git rsync findutils tar gzip unzip which curl jq wget file ca-certificates desktop-file-utils xdg-utils fakeroot dpkg-dev gcc make libc6-dev libgcc-s1 libstdc++6 zlib1g libatomic1"
466+
run_cmd "rm -rf /root/v2rayN-src"
467+
run_cmd "git clone --recursive https://github.com/$repo.git /root/v2rayN-src"
468+
run_cmd "cd /root/v2rayN-src && git fetch --depth=1 origin $sha && git checkout FETCH_HEAD && git submodule update --init --recursive"
469+
run_cmd "cd /root/v2rayN-src && chmod 755 package-debian-loong.sh"
470+
471+
send -- "cd /root/v2rayN-src; cat >/tmp/run-loong-build.sh <<'SCRIPT'\nset +e\nset -o pipefail\nbash -x ./package-debian-loong.sh \"\$RELEASE_TAG\" 2>&1 | tee /tmp/build.log\nrc=\$?\nmkdir -p /workspace/dist/deb-loong64\ncp -av /root/debbuild/*.deb /workspace/dist/deb-loong64/ 2>/dev/null || true\necho __BUILD_DONE__\$rc\nSCRIPT\nRELEASE_TAG=\"$release_tag\" bash /tmp/run-loong-build.sh\r"
472+
473+
expect {
474+
-re "__BUILD_DONE__0" {
475+
send -- "poweroff\r"
476+
}
477+
default {
478+
exit 1
479+
}
480+
}
481+
EOF
482+
483+
- name: Collect DEBs
484+
shell: bash
485+
run: |
486+
set -euo pipefail
487+
488+
mkdir -p "$GITHUB_WORKSPACE/dist/deb-loong64"
489+
490+
find "$GITHUB_WORKSPACE/dist/deb-loong64" -name "*.deb" \
491+
-exec mv {} "$GITHUB_WORKSPACE/dist/deb-loong64/v2rayN-linux-loong64.deb" \; || true
492+
493+
echo "==== Dist tree ===="
494+
ls -R "$GITHUB_WORKSPACE/dist/deb-loong64"
495+
496+
- name: Upload DEBs to release
497+
uses: svenstaro/upload-release-action@v2
498+
with:
499+
file: dist/deb-loong64/**/*.deb
500+
tag: ${{ env.RELEASE_TAG }}
501+
file_glob: true
502+
prerelease: true

0 commit comments

Comments
 (0)