Skip to content

Instantly share code, notes, and snippets.

View wangjiezhe's full-sized avatar
🏠
Working from home

Jiezhe Wang wangjiezhe

🏠
Working from home
View GitHub Profile
@wangjiezhe
wangjiezhe / gentoo-crossdev.md
Created March 13, 2025 12:58 — forked from thesamesam/gentoo-crossdev.md
Gentoo cross compilation instructions (crossdev -> stage3)

Cross instructions

These instructions cover:

  1. building a cross toolchain
  2. populating the new ROOT
  3. making it chrootable using qemu-user to easily run "native" builds or tests (this is like a stage3 at the end)

You do not need to follow through to the end if you don't need a stage3-like root.

Set up the toolchain

diff --git a/src/bootstrap/src/core/builder/cargo.rs b/src/bootstrap/src/core/builder/cargo.rs
index 0688a1d6892..8ec9747af5c 100644
--- a/src/bootstrap/src/core/builder/cargo.rs
+++ b/src/bootstrap/src/core/builder/cargo.rs
@@ -643,24 +643,10 @@ fn cargo(
match mode {
Mode::Std | Mode::ToolBootstrap | Mode::ToolStd => {}
Mode::Rustc | Mode::Codegen | Mode::ToolRustc => {
- // Build proc macros both for the host and the target unless proc-macros are not
- // supported by the target.
From 0740d1682a043c41fb7154414535e83767f60a32 Mon Sep 17 00:00:00 2001
From: wangjiezhe <[email protected]>
Date: Sun, 8 Dec 2024 23:55:55 +0800
Subject: [PATCH] Revert "Disable -Zdual-proc-macros if the target doesn't
support proc-macros"
This reverts commit 68034f837a39387e49fc7d7c5b088f5372a1127e.
---
src/bootstrap/src/core/builder.rs | 20 +++-----------------
1 file changed, 3 insertions(+), 17 deletions(-)
@wangjiezhe
wangjiezhe / tool.bat
Created November 21, 2024 11:04
使用脚本关闭VBS,可设成计划任务每次关机时自动执行(创建基本任务,触发器:特定事件,日志:系统,源:User32,事件ID:1074,勾选“使用最高权限运行”)
@echo off
REM ===========================================
mountvol X: /s
rem copy %WINDIR%\System32\SecConfig.efi X:\EFI\Microsoft\Boot\SecConfig.efi /Y
rem bcdedit /create {0cb3b571-2f2e-4343-a879-d86a476d7215} /d "DebugTool" /application osloader
bcdedit /set {0cb3b571-2f2e-4343-a879-d86a476d7215} path "\EFI\Microsoft\Boot\SecConfig.efi"
bcdedit /set {bootmgr} bootsequence {0cb3b571-2f2e-4343-a879-d86a476d7215}
bcdedit /set {0cb3b571-2f2e-4343-a879-d86a476d7215} loadoptions DISABLE-LSA-ISO,DISABLE-VBS
@wangjiezhe
wangjiezhe / Wifi_Logo.py
Last active November 18, 2024 11:01
使用 Python 在 Fusion 360 中创建 Wifi 标志
import math
import traceback
import adsk.cam
import adsk.core
import adsk.fusion
heightDefault = "100 mm"
thickDefault = "5 mm"
@wangjiezhe
wangjiezhe / build.sh
Created October 17, 2024 12:53
Crossbuild Rust application for Windows on Gentoo Linux
crossdev -t x86_64-w64-mingw32
# https://wiki.gentoo.org/wiki/Mingw#POSIX_threads_for_Windows
crossdev --genv 'EXTRA_ECONF="--enable-threads=posix"' --init-target --target cross-x86_64-w64-mingw32
echo "cross-x86_64-w64-mingw32/mingw64-runtime libraries idl tools" >> /etc/portage/package.use/cross-x86_64-w64-mingw32
emerge -1 cross-x86_64-w64-mingw32/mingw64-runtime
emerge -1 cross-x86_64-w64-mingw32/gcc
# https://bugs.gentoo.org/679878
ln -s /var/db/repos/gentoo/sys-devel/rust-std /var/db/repos/crossdev/cross-x86_64-w64-mingw32/
@wangjiezhe
wangjiezhe / AdGuardHome.yaml
Last active September 19, 2024 09:07
搭建 DNS 服务器,在车机上安装软件
dns:
rewrites:
- domain: dzsms.gwm.com.cn
answer: **.**.**.**
diff --git a/compiler/rustc_target/src/spec/targets/mips64el_unknown_linux_gnuabi64.rs b/compiler/rustc_target/src/spec/targets/mips64el_unknown_linux_gnuabi64.rs
index 515473fbabc..fa3c6875964 100644
--- a/compiler/rustc_target/src/spec/targets/mips64el_unknown_linux_gnuabi64.rs
+++ b/compiler/rustc_target/src/spec/targets/mips64el_unknown_linux_gnuabi64.rs
@@ -15,8 +15,8 @@ pub fn target() -> Target {
options: TargetOptions {
abi: "abi64".into(),
// NOTE(mips64r2) matches C toolchain
- cpu: "mips64r2".into(),
- features: "+mips64r2,+xgot".into(),
timeout 5
default 0
showmenu 1
title Gentoo
kernel /dev/fs/ext2@wd0/vmlinuz-6.6.37-gentoo
args console=tty root=/dev/sda3
# /etc/fstab: static file system information.
#
# See the manpage fstab(5) for more information.
#
# NOTE: The root filesystem should have a pass number of either 0 or 1.
# All other filesystems should have a pass number of 0 or greater than 1.
#
# NOTE: Even though we list ext4 as the type here, it will work with ext2/ext3
# filesystems. This just tells the kernel to use the ext4 driver.
#