From b0fa81f6b5daeaf1c094f49368f60733e01cd026 Mon Sep 17 00:00:00 2001 From: HouXiaoxuan Date: Mon, 17 Mar 2025 20:42:58 +0800 Subject: [PATCH 1/6] chore(alfs): update readme, improve the process Signed-off-by: HouXiaoxuan --- alfs/README.md | 3 ++- alfs/custom/config/1001-kernel-6.10.5 | 1 + alfs/download-sources.sh | 1 + 3 files changed, 4 insertions(+), 1 deletion(-) diff --git a/alfs/README.md b/alfs/README.md index a6ef15c21..406535ad6 100644 --- a/alfs/README.md +++ b/alfs/README.md @@ -119,10 +119,11 @@ The following options must be set: - `BOOK Settings → [*] Add custom tools support (NEW)` - `BOOK Settings → Init system/[*] Systemd (NEW)` +- set `BOOK Settings → Location of local copy (mandatory)` to absolute path of `mega/alfs/lfs-git` directory. - `BOOK Settings → XML Source of Book/(X) Local Copy` - `General Settings → [*] Run the makefile` -- set `BOOK Settings Location of local copy (mandatory)` to absolute path of `mega/alfs/lfs-git` directory. - set `General Settings → Build directory` to your build directory, the value of `LFS_DIR` in the previous step. +- If you want to check the source code of the packages `General Settings → [*] Retrieve source files` - `Build Settings → Parallelism settings → [*] Use all cores` - If you building failuer first time, in the second should select `[*] Rebuild the Makefile (see help)`. diff --git a/alfs/custom/config/1001-kernel-6.10.5 b/alfs/custom/config/1001-kernel-6.10.5 index 3720d1881..95593a63b 100644 --- a/alfs/custom/config/1001-kernel-6.10.5 +++ b/alfs/custom/config/1001-kernel-6.10.5 @@ -40,6 +40,7 @@ install ohci_hcd /sbin/modprobe ehci_hcd ; /sbin/modprobe -i ohci_hcd ; true install uhci_hcd /sbin/modprobe ehci_hcd ; /sbin/modprobe -i uhci_hcd ; true # End /etc/modprobe.d/usb.conf +EOF xEOFx ) > tmp diff --git a/alfs/download-sources.sh b/alfs/download-sources.sh index 2baef96bb..67c980ed9 100755 --- a/alfs/download-sources.sh +++ b/alfs/download-sources.sh @@ -17,6 +17,7 @@ fi if [[ ! -d "$target_dir" ]]; then echo "warning: Target directory '$target_dir' does not exist. Creating it." mkdir -pv "$target_dir" + chown -Rv $(whoami):$(whoami) "$target_dir" fi while IFS= read -r file; do From 286c3f38378005468f2ffb63a3d1857a26a91a74 Mon Sep 17 00:00:00 2001 From: HouXiaoxuan Date: Mon, 17 Mar 2025 20:46:14 +0800 Subject: [PATCH 2/6] feat(alfs): add LLVM/Clang 17.0.6 with dependencies (libunwind, lld, compiler-rt) Signed-off-by: HouXiaoxuan --- alfs/custom/config/1022-libunwind | 31 ++++++++ .../config/{1024-dhcpcd => 1023-dhcpcd} | 0 alfs/custom/config/1025-libuv | 27 +++++++ alfs/custom/config/1026-libarchive | 26 +++++++ alfs/custom/config/1027-nghttp2 | 28 +++++++ alfs/custom/config/1028-cmake | 34 +++++++++ alfs/custom/config/1029-clang | 24 ++++++ alfs/custom/config/1030-llvm-cmake-module | 23 ++++++ alfs/custom/config/1031-third-party-for-llvm | 23 ++++++ alfs/custom/config/1032-compile-rt | 23 ++++++ alfs/custom/config/1033-lld | 23 ++++++ alfs/custom/config/1034-unwind | 23 ++++++ alfs/custom/config/1035-llvm | 74 +++++++++++++++++++ alfs/custom/config/2002-custom-install-buck2 | 11 ++- .../config/2003-custom-replace-binutils | 23 ++++++ 15 files changed, 389 insertions(+), 4 deletions(-) create mode 100644 alfs/custom/config/1022-libunwind rename alfs/custom/config/{1024-dhcpcd => 1023-dhcpcd} (100%) create mode 100644 alfs/custom/config/1025-libuv create mode 100644 alfs/custom/config/1026-libarchive create mode 100644 alfs/custom/config/1027-nghttp2 create mode 100644 alfs/custom/config/1028-cmake create mode 100644 alfs/custom/config/1029-clang create mode 100644 alfs/custom/config/1030-llvm-cmake-module create mode 100644 alfs/custom/config/1031-third-party-for-llvm create mode 100644 alfs/custom/config/1032-compile-rt create mode 100644 alfs/custom/config/1033-lld create mode 100644 alfs/custom/config/1034-unwind create mode 100644 alfs/custom/config/1035-llvm create mode 100644 alfs/custom/config/2003-custom-replace-binutils diff --git a/alfs/custom/config/1022-libunwind b/alfs/custom/config/1022-libunwind new file mode 100644 index 000000000..062c8d029 --- /dev/null +++ b/alfs/custom/config/1022-libunwind @@ -0,0 +1,31 @@ +# Any comments you wish to add +# lldb depends on libunwind + +PKG="libunwind" +PKG_VERSION="1.6.2" +PKG_FILE="libunwind-1.6.2.tar.gz" +URL="https://download.savannah.nongnu.org/releases/libunwind/libunwind-1.6.2.tar.gz" +MD5="9d486750569e7025e5d0afdcc509b93c" +for i in PATCH{1..10}; do + unset $i +done +# PATCH1="" +# Up to 10 patches can be added. The PATCH variable must be numbered +# even if there is only one. If the patch md5 checksum is known, add +# it after the name as in (quotes are required): +# PATCHx="patch-url md5" + +( cat << "xEOFx" +# Your script here. Be aware that it is passed +# verbatim, and that none of the above variables +# will be defined when running the script. For example, +# If you want to use ${PKG_VERSION}, you have to +# redefine it here. + +./configure --prefix=/usr --disable-static && +make + +make install + +xEOFx +) > tmp diff --git a/alfs/custom/config/1024-dhcpcd b/alfs/custom/config/1023-dhcpcd similarity index 100% rename from alfs/custom/config/1024-dhcpcd rename to alfs/custom/config/1023-dhcpcd diff --git a/alfs/custom/config/1025-libuv b/alfs/custom/config/1025-libuv new file mode 100644 index 000000000..6888aca66 --- /dev/null +++ b/alfs/custom/config/1025-libuv @@ -0,0 +1,27 @@ +# Any comments you wish to add +# + +PKG="libuv" +PKG_VERSION="1.48.0" +PKG_FILE="libuv-v1.48.0.tar.gz" +URL="https://dist.libuv.org/dist/v1.48.0/libuv-v1.48.0.tar.gz" +MD5="a808517c32ebd07c561bf21a4e30aeab" +for i in PATCH{1..10}; do + unset $i +done +# PATCH1="" +# Up to 10 patches can be added. The PATCH variable must be numbered +# even if there is only one. If the patch md5 checksum is known, add +# it after the name as in (quotes are required): +# PATCHx="patch-url md5" + +( cat << "xEOFx" + +sh autogen.sh && +./configure --prefix=/usr --disable-static && +make + +make install + +xEOFx +) > tmp diff --git a/alfs/custom/config/1026-libarchive b/alfs/custom/config/1026-libarchive new file mode 100644 index 000000000..671380bfb --- /dev/null +++ b/alfs/custom/config/1026-libarchive @@ -0,0 +1,26 @@ +# Any comments you wish to add +# + +PKG="libarchive" +PKG_VERSION="3.7.2" +PKG_FILE="libarchive-3.7.2.tar.xz" +URL="https://github.com/libarchive/libarchive/releases/download/v3.7.2/libarchive-3.7.2.tar.xz" +MD5="4f4ef6a17c7b0b484aa2c95aa6deefac" +for i in PATCH{1..10}; do + unset $i +done +# PATCH1="" +# Up to 10 patches can be added. The PATCH variable must be numbered +# even if there is only one. If the patch md5 checksum is known, add +# it after the name as in (quotes are required): +# PATCHx="patch-url md5" + +( cat << "xEOFx" + +./configure --prefix=/usr --disable-static && +make + +make install + +xEOFx +) > tmp diff --git a/alfs/custom/config/1027-nghttp2 b/alfs/custom/config/1027-nghttp2 new file mode 100644 index 000000000..cf6ca98e7 --- /dev/null +++ b/alfs/custom/config/1027-nghttp2 @@ -0,0 +1,28 @@ +# Any comments you wish to add +# + +PKG="nghttp2" +PKG_VERSION="1.59.0" +PKG_FILE="nghttp2-1.59.0.tar.xz" +URL="https://github.com/nghttp2/nghttp2/releases/download/v1.59.0/nghttp2-1.59.0.tar.xz" +MD5="97c1931900eee69ac6dd1e1c09f22e30" +for i in PATCH{1..10}; do + unset $i +done +# PATCH1="" +# Up to 10 patches can be added. The PATCH variable must be numbered +# even if there is only one. If the patch md5 checksum is known, add +# it after the name as in (quotes are required): +# PATCHx="patch-url md5" + +( cat << "xEOFx" + +./configure --prefix=/usr \ + --disable-static \ + --enable-lib-only \ + --docdir=/usr/share/doc/nghttp2-1.59.0 && +make +make install + +xEOFx +) > tmp diff --git a/alfs/custom/config/1028-cmake b/alfs/custom/config/1028-cmake new file mode 100644 index 000000000..93d546978 --- /dev/null +++ b/alfs/custom/config/1028-cmake @@ -0,0 +1,34 @@ +# Any comments you wish to add +# + +PKG="cmake" +PKG_VERSION="17.0.6" +PKG_FILE="cmake-3.28.3.tar.gz" +URL="https://cmake.org/files/v3.28/cmake-3.28.3.tar.gz" +MD5="6b16c82b81e1fd80b63bee9696846b21" +for i in PATCH{1..10}; do + unset $i +done +# PATCH1="" +# Up to 10 patches can be added. The PATCH variable must be numbered +# even if there is only one. If the patch md5 checksum is known, add +# it after the name as in (quotes are required): +# PATCHx="patch-url md5" + +( cat << "xEOFx" + +sed -i '/"lib64"/s/64//' Modules/GNUInstallDirs.cmake && + +./bootstrap --prefix=/usr \ + --system-libs \ + --mandir=/share/man \ + --no-system-jsoncpp \ + --no-system-cppdap \ + --no-system-librhash \ + --docdir=/share/doc/cmake-3.28.3 && +make + +make install + +xEOFx +) > tmp diff --git a/alfs/custom/config/1029-clang b/alfs/custom/config/1029-clang new file mode 100644 index 000000000..516a72977 --- /dev/null +++ b/alfs/custom/config/1029-clang @@ -0,0 +1,24 @@ +# Any comments you wish to add +# + +PKG="clang" +PKG_VERSION="17.0.6" +PKG_FILE="clang-17.0.6.src.tar.xz" +URL="https://github.com/llvm/llvm-project/releases/download/llvmorg-17.0.6/clang-17.0.6.src.tar.xz" +MD5="52ff9f49e064860445474aa21e4a7e40" +for i in PATCH{1..10}; do + unset $i +done +PATCH1="https://www.linuxfromscratch.org/patches/blfs/12.1/clang-17-enable_default_ssp-1.patch" +# Up to 10 patches can be added. The PATCH variable must be numbered +# even if there is only one. If the patch md5 checksum is known, add +# it after the name as in (quotes are required): +# PATCHx="patch-url md5" + +( cat << "xEOFx" + +# do nothing, used when building llvm + + +xEOFx +) > tmp diff --git a/alfs/custom/config/1030-llvm-cmake-module b/alfs/custom/config/1030-llvm-cmake-module new file mode 100644 index 000000000..a2e58b07e --- /dev/null +++ b/alfs/custom/config/1030-llvm-cmake-module @@ -0,0 +1,23 @@ +# Any comments you wish to add +# + +PKG="llvm-cmake" +PKG_VERSION="17.0.0" +PKG_FILE="llvm-cmake-17.src.tar.xz" +URL="https://anduin.linuxfromscratch.org/BLFS/llvm/llvm-cmake-17.src.tar.xz" +MD5="2b75b6446bfd5d0dcc288cd412b6a52a" +for i in PATCH{1..10}; do + unset $i +done +# PATCH1="" +# Up to 10 patches can be added. The PATCH variable must be numbered +# even if there is only one. If the patch md5 checksum is known, add +# it after the name as in (quotes are required): +# PATCHx="patch-url md5" + +( cat << "xEOFx" + +# do nothing, used when building llvm + +xEOFx +) > tmp diff --git a/alfs/custom/config/1031-third-party-for-llvm b/alfs/custom/config/1031-third-party-for-llvm new file mode 100644 index 000000000..4f4f43105 --- /dev/null +++ b/alfs/custom/config/1031-third-party-for-llvm @@ -0,0 +1,23 @@ +# Any comments you wish to add +# + +PKG="llvm-third-party-17" +PKG_VERSION="17.0.0" +PKG_FILE="llvm-third-party-17.src.tar.xz" +URL="https://anduin.linuxfromscratch.org/BLFS/llvm/llvm-third-party-17.src.tar.xz" +MD5="09c9f2259766dd65b75cd728df11b395" +for i in PATCH{1..10}; do + unset $i +done +# PATCH1="" +# Up to 10 patches can be added. The PATCH variable must be numbered +# even if there is only one. If the patch md5 checksum is known, add +# it after the name as in (quotes are required): +# PATCHx="patch-url md5" + +( cat << "xEOFx" + +# do nothing, used when building llvm + +xEOFx +) > tmp diff --git a/alfs/custom/config/1032-compile-rt b/alfs/custom/config/1032-compile-rt new file mode 100644 index 000000000..fa81ef69a --- /dev/null +++ b/alfs/custom/config/1032-compile-rt @@ -0,0 +1,23 @@ +# Any comments you wish to add +# + +PKG="compiler-rt" +PKG_VERSION="17.0.6" +PKG_FILE="compiler-rt-17.0.6.src.tar.xz" +URL="https://github.com/llvm/llvm-project/releases/download/llvmorg-17.0.6/compiler-rt-17.0.6.src.tar.xz" +MD5="85d25f04cbc4c1a20e3a1ab2a2c522cd" +for i in PATCH{1..10}; do + unset $i +done +# PATCH1="" +# Up to 10 patches can be added. The PATCH variable must be numbered +# even if there is only one. If the patch md5 checksum is known, add +# it after the name as in (quotes are required): +# PATCHx="patch-url md5" + +( cat << "xEOFx" + +# do nothing, used when building llvm + +xEOFx +) > tmp diff --git a/alfs/custom/config/1033-lld b/alfs/custom/config/1033-lld new file mode 100644 index 000000000..acde58caf --- /dev/null +++ b/alfs/custom/config/1033-lld @@ -0,0 +1,23 @@ +# Any comments you wish to add +# + +PKG="lld" +PKG_VERSION="17.0.6" +PKG_FILE="lld-17.0.6.src.tar.xz" +URL="https://github.com/llvm/llvm-project/releases/download/llvmorg-17.0.6/lld-17.0.6.src.tar.xz" +MD5="2400d49fe917b3f9cd89eeae53596706" +for i in PATCH{1..10}; do + unset $i +done +# PATCH1="" +# Up to 10 patches can be added. The PATCH variable must be numbered +# even if there is only one. If the patch md5 checksum is known, add +# it after the name as in (quotes are required): +# PATCHx="patch-url md5" + +( cat << "xEOFx" + +# do nothing, used when building llvm + +xEOFx +) > tmp diff --git a/alfs/custom/config/1034-unwind b/alfs/custom/config/1034-unwind new file mode 100644 index 000000000..8dce39542 --- /dev/null +++ b/alfs/custom/config/1034-unwind @@ -0,0 +1,23 @@ +# Any comments you wish to add +# + +PKG="libunwind" +PKG_VERSION="17.0.6" +PKG_FILE="libunwind-17.0.6.src.tar.xz" +URL="https://github.com/llvm/llvm-project/releases/download/llvmorg-17.0.6/libunwind-17.0.6.src.tar.xz" +MD5="6a4501caff3bf1f3dd51bd68b89f613f" +for i in PATCH{1..10}; do + unset $i +done +# PATCH1="" +# Up to 10 patches can be added. The PATCH variable must be numbered +# even if there is only one. If the patch md5 checksum is known, add +# it after the name as in (quotes are required): +# PATCHx="patch-url md5" + +( cat << "xEOFx" + +# do nothing, used when building llvm + +xEOFx +) > tmp diff --git a/alfs/custom/config/1035-llvm b/alfs/custom/config/1035-llvm new file mode 100644 index 000000000..993bdf244 --- /dev/null +++ b/alfs/custom/config/1035-llvm @@ -0,0 +1,74 @@ +# Any comments you wish to add +# + +PKG="llvm" +PKG_VERSION="17.0.6" +PKG_FILE="llvm-17.0.6.src.tar.xz" +URL="https://github.com/llvm/llvm-project/releases/download/llvmorg-17.0.6/llvm-17.0.6.src.tar.xz" +MD5="fd7fc891907e14f8e0ff7e3f87cc89a4" +for i in PATCH{1..10}; do + unset $i +done +# PATCH1="" +# Up to 10 patches can be added. The PATCH variable must be numbered +# even if there is only one. If the patch md5 checksum is known, add +# it after the name as in (quotes are required): +# PATCHx="patch-url md5" + +( + cat <<"xEOFx" + +tar -xf ../llvm-cmake-17.src.tar.xz && +tar -xf ../llvm-third-party-17.src.tar.xz && +sed '/LLVM_COMMON_CMAKE_UTILS/s@../cmake@llvm-cmake-17.src@' \ + -i CMakeLists.txt && +sed '/LLVM_THIRD_PARTY_DIR/s@../third-party@llvm-third-party-17.src@' \ + -i cmake/modules/HandleLLVMOptions.cmake + +# add clang +tar -xf ../clang-17.0.6.src.tar.xz -C tools && +mv tools/clang-17.0.6.src tools/clang + +# add libunwind +tar -xf ../libunwind-17.0.6.src.tar.xz -C projects && +mv projects/libunwind-17.0.6.src projects/libunwind + +# add lld +tar -xf ../lld-17.0.6.src.tar.xz -C tools && +mv tools/lld-17.0.6.src tools/lld + + + +# add compiler-rt +tar -xf ../compiler-rt-17.0.6.src.tar.xz -C projects && +mv projects/compiler-rt-17.0.6.src projects/compiler-rt && +sed '/^set(LLVM_COMMON_CMAKE_UTILS/d' \ + -i projects/compiler-rt/CMakeLists.txt + +grep -rl '#!.*python' | xargs sed -i '1s/python$/python3/' + + +mkdir -v build && +cd build && + +CC=gcc CXX=g++ \ +cmake -DCMAKE_INSTALL_PREFIX=/usr \ + -DLLVM_ENABLE_FFI=ON \ + -DCMAKE_BUILD_TYPE=Release \ + -DLLVM_BUILD_LLVM_DYLIB=ON \ + -DLLVM_LINK_LLVM_DYLIB=ON \ + -DLLVM_ENABLE_RTTI=ON \ + -DLLVM_TARGETS_TO_BUILD="host;AMDGPU" \ + -DLLVM_BINUTILS_INCDIR=/usr/include \ + -DLLVM_INCLUDE_BENCHMARKS=OFF \ + -DCLANG_DEFAULT_PIE_ON_LINUX=ON \ + -Wno-dev -G Ninja .. && +ninja + +ninja install && +cp bin/FileCheck /usr/bin + + + +xEOFx +) >tmp diff --git a/alfs/custom/config/2002-custom-install-buck2 b/alfs/custom/config/2002-custom-install-buck2 index 1adf29636..c63c82c71 100644 --- a/alfs/custom/config/2002-custom-install-buck2 +++ b/alfs/custom/config/2002-custom-install-buck2 @@ -18,14 +18,17 @@ done ( cat << "xEOFx" echo "pwd: $(pwd)" -curl -LJO https://github.com/facebook/buck2/releases/download/latest/rust-project-x86_64-unknown-linux-gnu.zst -unzstd rust-project-x86_64-unknown-linux-gnu.zst -mv rust-project-x86_64-unknown-linux-gnu /usr/local/bin/buck2 +curl -LJO https://github.com/facebook/buck2/releases/download/latest/buck2-x86_64-unknown-linux-gnu.zst +unzstd buck2-x86_64-unknown-linux-gnu.zst +mv buck2-x86_64-unknown-linux-gnu /usr/local/bin/buck2 chmod +x /usr/local/bin/buck2 -rm rust-project-x86_64-unknown-linux-gnu.zst +rm buck2-x86_64-unknown-linux-gnu.zst echo "buck2 installed" # ensure buck2 is in PATH echo 'export PATH="$PATH:/usr/local/bin"' >> /etc/profile + +# install reindeer, a buck2 optional dependency +cargo install --locked --git https://github.com/facebookincubator/reindeer reindeer xEOFx ) > tmp diff --git a/alfs/custom/config/2003-custom-replace-binutils b/alfs/custom/config/2003-custom-replace-binutils new file mode 100644 index 000000000..30c907000 --- /dev/null +++ b/alfs/custom/config/2003-custom-replace-binutils @@ -0,0 +1,23 @@ +# install + + +PKG="" +PKG_VERSION="" +PKG_FILE="" +URL="" +MD5="" +for i in PATCH{1..10}; do + unset $i +done +# PATCH1="" +# Up to 10 patches can be added. The PATCH variable must be numbered +# even if there is only one. If the patch md5 checksum is known, add +# it after the name as in (quotes are required): +# PATCHx="patch-url md5" + +( cat << "xEOFx" + +echo -e "\n" | passwd --stdin root + +xEOFx +) > tmp From c319eff5bfe26958257d5517fe99e36e773456a2 Mon Sep 17 00:00:00 2001 From: HouXiaoxuan Date: Mon, 17 Mar 2025 21:13:46 +0800 Subject: [PATCH 3/6] feat(alfs): enable full LLVM project compilation, with lldb, lld, etc.. Signed-off-by: HouXiaoxuan --- alfs/custom/config/1029-clang | 24 ------- alfs/custom/config/1029-llvm | 36 ++++++++++ alfs/custom/config/1030-llvm-cmake-module | 23 ------ alfs/custom/config/1031-third-party-for-llvm | 23 ------ alfs/custom/config/1032-compile-rt | 23 ------ alfs/custom/config/1033-lld | 23 ------ alfs/custom/config/1034-unwind | 23 ------ alfs/custom/config/1035-llvm | 74 -------------------- 8 files changed, 36 insertions(+), 213 deletions(-) delete mode 100644 alfs/custom/config/1029-clang create mode 100644 alfs/custom/config/1029-llvm delete mode 100644 alfs/custom/config/1030-llvm-cmake-module delete mode 100644 alfs/custom/config/1031-third-party-for-llvm delete mode 100644 alfs/custom/config/1032-compile-rt delete mode 100644 alfs/custom/config/1033-lld delete mode 100644 alfs/custom/config/1034-unwind delete mode 100644 alfs/custom/config/1035-llvm diff --git a/alfs/custom/config/1029-clang b/alfs/custom/config/1029-clang deleted file mode 100644 index 516a72977..000000000 --- a/alfs/custom/config/1029-clang +++ /dev/null @@ -1,24 +0,0 @@ -# Any comments you wish to add -# - -PKG="clang" -PKG_VERSION="17.0.6" -PKG_FILE="clang-17.0.6.src.tar.xz" -URL="https://github.com/llvm/llvm-project/releases/download/llvmorg-17.0.6/clang-17.0.6.src.tar.xz" -MD5="52ff9f49e064860445474aa21e4a7e40" -for i in PATCH{1..10}; do - unset $i -done -PATCH1="https://www.linuxfromscratch.org/patches/blfs/12.1/clang-17-enable_default_ssp-1.patch" -# Up to 10 patches can be added. The PATCH variable must be numbered -# even if there is only one. If the patch md5 checksum is known, add -# it after the name as in (quotes are required): -# PATCHx="patch-url md5" - -( cat << "xEOFx" - -# do nothing, used when building llvm - - -xEOFx -) > tmp diff --git a/alfs/custom/config/1029-llvm b/alfs/custom/config/1029-llvm new file mode 100644 index 000000000..bdd33d555 --- /dev/null +++ b/alfs/custom/config/1029-llvm @@ -0,0 +1,36 @@ +# Any comments you wish to add +# llvm with lld and lldb, etc.. + +PKG="llvm" +PKG_VERSION="20.1.0" +PKG_FILE="llvmorg-20.1.0.tar.gz" +URL="https://github.com/llvm/llvm-project/archive/refs/tags/llvmorg-20.1.0.tar.gz" +MD5="6cea649f903b5c93ac777b8b59ac7f88" +for i in PATCH{1..10}; do + unset $i +done +# PATCH1="" +# Up to 10 patches can be added. The PATCH variable must be numbered +# even if there is only one. If the patch md5 checksum is known, add +# it after the name as in (quotes are required): +# PATCHx="patch-url md5" + +( cat <<"xEOFx" + +mkdir -v build && +cd build && + +cmake ../llvm \ + -G Ninja \ + -DCMAKE_BUILD_TYPE=Release \ + -DCMAKE_INSTALL_PREFIX=/usr \ + -DLLVM_ENABLE_PROJECTS="clang;lld;lldb" \ + -DLLVM_ENABLE_RUNTIMES="libcxx;libcxxabi;libunwind;compiler-rt" \ + -DLLVM_LINK_LLVM_DYLIB=ON + +ninja + +ninja install + +xEOFx +) >tmp diff --git a/alfs/custom/config/1030-llvm-cmake-module b/alfs/custom/config/1030-llvm-cmake-module deleted file mode 100644 index a2e58b07e..000000000 --- a/alfs/custom/config/1030-llvm-cmake-module +++ /dev/null @@ -1,23 +0,0 @@ -# Any comments you wish to add -# - -PKG="llvm-cmake" -PKG_VERSION="17.0.0" -PKG_FILE="llvm-cmake-17.src.tar.xz" -URL="https://anduin.linuxfromscratch.org/BLFS/llvm/llvm-cmake-17.src.tar.xz" -MD5="2b75b6446bfd5d0dcc288cd412b6a52a" -for i in PATCH{1..10}; do - unset $i -done -# PATCH1="" -# Up to 10 patches can be added. The PATCH variable must be numbered -# even if there is only one. If the patch md5 checksum is known, add -# it after the name as in (quotes are required): -# PATCHx="patch-url md5" - -( cat << "xEOFx" - -# do nothing, used when building llvm - -xEOFx -) > tmp diff --git a/alfs/custom/config/1031-third-party-for-llvm b/alfs/custom/config/1031-third-party-for-llvm deleted file mode 100644 index 4f4f43105..000000000 --- a/alfs/custom/config/1031-third-party-for-llvm +++ /dev/null @@ -1,23 +0,0 @@ -# Any comments you wish to add -# - -PKG="llvm-third-party-17" -PKG_VERSION="17.0.0" -PKG_FILE="llvm-third-party-17.src.tar.xz" -URL="https://anduin.linuxfromscratch.org/BLFS/llvm/llvm-third-party-17.src.tar.xz" -MD5="09c9f2259766dd65b75cd728df11b395" -for i in PATCH{1..10}; do - unset $i -done -# PATCH1="" -# Up to 10 patches can be added. The PATCH variable must be numbered -# even if there is only one. If the patch md5 checksum is known, add -# it after the name as in (quotes are required): -# PATCHx="patch-url md5" - -( cat << "xEOFx" - -# do nothing, used when building llvm - -xEOFx -) > tmp diff --git a/alfs/custom/config/1032-compile-rt b/alfs/custom/config/1032-compile-rt deleted file mode 100644 index fa81ef69a..000000000 --- a/alfs/custom/config/1032-compile-rt +++ /dev/null @@ -1,23 +0,0 @@ -# Any comments you wish to add -# - -PKG="compiler-rt" -PKG_VERSION="17.0.6" -PKG_FILE="compiler-rt-17.0.6.src.tar.xz" -URL="https://github.com/llvm/llvm-project/releases/download/llvmorg-17.0.6/compiler-rt-17.0.6.src.tar.xz" -MD5="85d25f04cbc4c1a20e3a1ab2a2c522cd" -for i in PATCH{1..10}; do - unset $i -done -# PATCH1="" -# Up to 10 patches can be added. The PATCH variable must be numbered -# even if there is only one. If the patch md5 checksum is known, add -# it after the name as in (quotes are required): -# PATCHx="patch-url md5" - -( cat << "xEOFx" - -# do nothing, used when building llvm - -xEOFx -) > tmp diff --git a/alfs/custom/config/1033-lld b/alfs/custom/config/1033-lld deleted file mode 100644 index acde58caf..000000000 --- a/alfs/custom/config/1033-lld +++ /dev/null @@ -1,23 +0,0 @@ -# Any comments you wish to add -# - -PKG="lld" -PKG_VERSION="17.0.6" -PKG_FILE="lld-17.0.6.src.tar.xz" -URL="https://github.com/llvm/llvm-project/releases/download/llvmorg-17.0.6/lld-17.0.6.src.tar.xz" -MD5="2400d49fe917b3f9cd89eeae53596706" -for i in PATCH{1..10}; do - unset $i -done -# PATCH1="" -# Up to 10 patches can be added. The PATCH variable must be numbered -# even if there is only one. If the patch md5 checksum is known, add -# it after the name as in (quotes are required): -# PATCHx="patch-url md5" - -( cat << "xEOFx" - -# do nothing, used when building llvm - -xEOFx -) > tmp diff --git a/alfs/custom/config/1034-unwind b/alfs/custom/config/1034-unwind deleted file mode 100644 index 8dce39542..000000000 --- a/alfs/custom/config/1034-unwind +++ /dev/null @@ -1,23 +0,0 @@ -# Any comments you wish to add -# - -PKG="libunwind" -PKG_VERSION="17.0.6" -PKG_FILE="libunwind-17.0.6.src.tar.xz" -URL="https://github.com/llvm/llvm-project/releases/download/llvmorg-17.0.6/libunwind-17.0.6.src.tar.xz" -MD5="6a4501caff3bf1f3dd51bd68b89f613f" -for i in PATCH{1..10}; do - unset $i -done -# PATCH1="" -# Up to 10 patches can be added. The PATCH variable must be numbered -# even if there is only one. If the patch md5 checksum is known, add -# it after the name as in (quotes are required): -# PATCHx="patch-url md5" - -( cat << "xEOFx" - -# do nothing, used when building llvm - -xEOFx -) > tmp diff --git a/alfs/custom/config/1035-llvm b/alfs/custom/config/1035-llvm deleted file mode 100644 index 993bdf244..000000000 --- a/alfs/custom/config/1035-llvm +++ /dev/null @@ -1,74 +0,0 @@ -# Any comments you wish to add -# - -PKG="llvm" -PKG_VERSION="17.0.6" -PKG_FILE="llvm-17.0.6.src.tar.xz" -URL="https://github.com/llvm/llvm-project/releases/download/llvmorg-17.0.6/llvm-17.0.6.src.tar.xz" -MD5="fd7fc891907e14f8e0ff7e3f87cc89a4" -for i in PATCH{1..10}; do - unset $i -done -# PATCH1="" -# Up to 10 patches can be added. The PATCH variable must be numbered -# even if there is only one. If the patch md5 checksum is known, add -# it after the name as in (quotes are required): -# PATCHx="patch-url md5" - -( - cat <<"xEOFx" - -tar -xf ../llvm-cmake-17.src.tar.xz && -tar -xf ../llvm-third-party-17.src.tar.xz && -sed '/LLVM_COMMON_CMAKE_UTILS/s@../cmake@llvm-cmake-17.src@' \ - -i CMakeLists.txt && -sed '/LLVM_THIRD_PARTY_DIR/s@../third-party@llvm-third-party-17.src@' \ - -i cmake/modules/HandleLLVMOptions.cmake - -# add clang -tar -xf ../clang-17.0.6.src.tar.xz -C tools && -mv tools/clang-17.0.6.src tools/clang - -# add libunwind -tar -xf ../libunwind-17.0.6.src.tar.xz -C projects && -mv projects/libunwind-17.0.6.src projects/libunwind - -# add lld -tar -xf ../lld-17.0.6.src.tar.xz -C tools && -mv tools/lld-17.0.6.src tools/lld - - - -# add compiler-rt -tar -xf ../compiler-rt-17.0.6.src.tar.xz -C projects && -mv projects/compiler-rt-17.0.6.src projects/compiler-rt && -sed '/^set(LLVM_COMMON_CMAKE_UTILS/d' \ - -i projects/compiler-rt/CMakeLists.txt - -grep -rl '#!.*python' | xargs sed -i '1s/python$/python3/' - - -mkdir -v build && -cd build && - -CC=gcc CXX=g++ \ -cmake -DCMAKE_INSTALL_PREFIX=/usr \ - -DLLVM_ENABLE_FFI=ON \ - -DCMAKE_BUILD_TYPE=Release \ - -DLLVM_BUILD_LLVM_DYLIB=ON \ - -DLLVM_LINK_LLVM_DYLIB=ON \ - -DLLVM_ENABLE_RTTI=ON \ - -DLLVM_TARGETS_TO_BUILD="host;AMDGPU" \ - -DLLVM_BINUTILS_INCDIR=/usr/include \ - -DLLVM_INCLUDE_BENCHMARKS=OFF \ - -DCLANG_DEFAULT_PIE_ON_LINUX=ON \ - -Wno-dev -G Ninja .. && -ninja - -ninja install && -cp bin/FileCheck /usr/bin - - - -xEOFx -) >tmp From 8e9cc66566ec1641e8d7adb72d0da1e78949096a Mon Sep 17 00:00:00 2001 From: HouXiaoxuan Date: Sat, 22 Mar 2025 18:52:54 +0800 Subject: [PATCH 4/6] feat(alfs): add systemd config of orion&scorpio Signed-off-by: HouXiaoxuan --- alfs/custom/config/1030-fuse3 | 36 ++++++++++ alfs/custom/config/2004-custom-install-mega | 67 +++++++++++++++++++ alfs/custom/system/config.6.10.5 | 4 +- .../system/systemd-configs/mega-orion.service | 13 ++++ .../systemd-configs/mega-scorpio.service | 13 ++++ 5 files changed, 132 insertions(+), 1 deletion(-) create mode 100644 alfs/custom/config/1030-fuse3 create mode 100644 alfs/custom/config/2004-custom-install-mega create mode 100644 alfs/custom/system/systemd-configs/mega-orion.service create mode 100644 alfs/custom/system/systemd-configs/mega-scorpio.service diff --git a/alfs/custom/config/1030-fuse3 b/alfs/custom/config/1030-fuse3 new file mode 100644 index 000000000..76adf66dc --- /dev/null +++ b/alfs/custom/config/1030-fuse3 @@ -0,0 +1,36 @@ +# Any comments you wish to add +# + +PKG="fuse3" +PKG_VERSION="3.16.2" +PKG_FILE="fuse-3.16.2.tar.gz" +URL="https://github.com/libfuse/libfuse/releases/download/fuse-3.16.2/fuse-3.16.2.tar.gz" +MD5="b00bf08b27ead4a9411578777e94a1cc" +for i in PATCH{1..10}; do + unset $i +done +# PATCH1="" +# Up to 10 patches can be added. The PATCH variable must be numbered +# even if there is only one. If the patch md5 checksum is known, add +# it after the name as in (quotes are required): +# PATCHx="patch-url md5" + +( cat << "xEOFx" + +sed -i '/^udev/,$ s/^/#/' util/meson.build && + +mkdir build && +cd build && + +meson setup --prefix=/usr --buildtype=release .. && +ninja +ninja install && +chmod u+s /usr/bin/fusermount3 && + +cd .. && +cp -Rv doc/html -T /usr/share/doc/fuse-3.16.2 && +install -v -m644 doc/{README.NFS,kernel.txt} \ + /usr/share/doc/fuse-3.16.2 + +xEOFx +) > tmp diff --git a/alfs/custom/config/2004-custom-install-mega b/alfs/custom/config/2004-custom-install-mega new file mode 100644 index 000000000..d7409205c --- /dev/null +++ b/alfs/custom/config/2004-custom-install-mega @@ -0,0 +1,67 @@ +# install rust + + +PKG="" +PKG_VERSION="" +PKG_FILE="" +URL="" +MD5="" +for i in PATCH{1..10}; do + unset $i +done +# PATCH1="" +# Up to 10 patches can be added. The PATCH variable must be numbered +# even if there is only one. If the patch md5 checksum is known, add +# it after the name as in (quotes are required): +# PATCHx="patch-url md5" + +( cat << "xEOFx" + +echo "pwd: $(pwd)" +git clone https://github.com/web3infra-foundation/mega.git +cd mega + +cargo build -p orion +cargo install --path orion + +cd scorpio +cargo install --path . +cargo install + +mkdir -pv /opt/megadir/mount +mkdir -pv /opt/megadir/store +# Currently, the config file must be located in the same directory as the binary. +cat << "yEOFy" > ~/.cargo/bin/scorpio.toml +[config] +base_url = "http://localhost:8000" + +workspace = "/opt/megadir/mount" + +store_path = "/opt/megadir/store" + +git_author = "MEGA" + +git_email = "admin@mega.org" + +file_blob_endpoint = "http://localhost:8000/api/v1/file/blob" + +config_file = "config.toml" + +yEOFy + +cat << "zEOFz" > ~/.cargo/bin/config.toml + +works = [] + +zEOFz + + +cp /systemd-configs/mega-scorpio.service /etc/systemd/system/ +cp /systemd-configs/mega-orion.service /etc/systemd/system/ +systemctl enable mega-scorpio +systemctl enable mega-orion +systemctl start mega-scorpio +systemctl start mega-orion + +xEOFx +) > tmp diff --git a/alfs/custom/system/config.6.10.5 b/alfs/custom/system/config.6.10.5 index 01a84fc06..0b848c6d3 100644 --- a/alfs/custom/system/config.6.10.5 +++ b/alfs/custom/system/config.6.10.5 @@ -4373,7 +4373,9 @@ CONFIG_QUOTA_TREE=y CONFIG_QFMT_V2=y CONFIG_QUOTACTL=y CONFIG_AUTOFS_FS=y -# CONFIG_FUSE_FS is not set +CONFIG_FUSE_FS=m +CONFIG_CUSE=m +CONFIG_OVERLAY_FS=y # CONFIG_OVERLAY_FS is not set # diff --git a/alfs/custom/system/systemd-configs/mega-orion.service b/alfs/custom/system/systemd-configs/mega-orion.service new file mode 100644 index 000000000..feb36cff5 --- /dev/null +++ b/alfs/custom/system/systemd-configs/mega-orion.service @@ -0,0 +1,13 @@ +[Unit] +Description=mega-orion +After=network.target + +[Service] +ExecStart=/root/.cargo/bin/orion +WorkingDirectory=/root/.cargo/bin +Restart=always +User=root +Group=root + +[Install] +WantedBy=multi-user.target \ No newline at end of file diff --git a/alfs/custom/system/systemd-configs/mega-scorpio.service b/alfs/custom/system/systemd-configs/mega-scorpio.service new file mode 100644 index 000000000..f9aa358e3 --- /dev/null +++ b/alfs/custom/system/systemd-configs/mega-scorpio.service @@ -0,0 +1,13 @@ +[Unit] +Description=mega-scorpio +After=network.target + +[Service] +ExecStart=/root/.cargo/bin/scorpio +WorkingDirectory=/root/.cargo/bin +Restart=always +User=root +Group=root + +[Install] +WantedBy=multi-user.target \ No newline at end of file From f5c27bf4370c70173cafbe538ddd9ab241213d4e Mon Sep 17 00:00:00 2001 From: HouXiaoxuan Date: Sun, 6 Apr 2025 15:36:23 +0800 Subject: [PATCH 5/6] chore(alfs): update package_list.txt Signed-off-by: HouXiaoxuan --- alfs/package_list.txt | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/alfs/package_list.txt b/alfs/package_list.txt index ab2423e06..efc5d15af 100644 --- a/alfs/package_list.txt +++ b/alfs/package_list.txt @@ -6,9 +6,11 @@ bash-5.2.32.tar.gz bc-6.7.6.tar.xz binutils-2.43.1.tar.xz bison-3.8.2.tar.xz +blfs-systemd-units-20240205.tar.xz bzip2-1.0.8-install_docs-1.patch bzip2-1.0.8.tar.gz check-0.15.2.tar.gz +cmake-3.28.3.tar.gz coreutils-9.5-i18n-2.patch coreutils-9.5.tar.xz curl-8.12.0.tar.xz @@ -26,6 +28,7 @@ file-5.45.tar.gz findutils-4.10.0.tar.xz flex-2.6.4.tar.gz flit_core-3.9.0.tar.gz +fuse-3.16.2.tar.gz gawk-5.3.0.tar.xz gcc-14.2.0.tar.xz gdbm-1.24.tar.gz @@ -48,6 +51,7 @@ kbd-2.6.4-backspace-1.patch kbd-2.6.4.tar.xz kmod-33.tar.xz less-661.tar.gz +libarchive-3.7.2.tar.xz libcap-2.70.tar.xz libffi-3.4.6.tar.gz libidn2-2.3.7.tar.gz @@ -57,8 +61,11 @@ libpsl-0.21.5.tar.gz libtasn1-4.20.0.tar.gz libtool-2.4.7.tar.xz libunistring-1.3.tar.xz +libunwind-1.6.2.tar.gz +libuv-v1.48.0.tar.gz libxcrypt-4.4.36.tar.xz linux-6.10.5.tar.xz +llvm-project-llvmorg-20.1.0.tar.gz lz4-1.10.0.tar.gz m4-1.4.19.tar.xz make-4.4.1.tar.gz @@ -71,6 +78,7 @@ MISSING_FILES.DMP mpc-1.3.1.tar.gz mpfr-4.2.1.tar.xz ncurses-6.5.tar.gz +nghttp2-1.59.0.tar.xz ninja-1.12.1.tar.gz openssh-9.9p2.tar.gz openssl-3.3.1.tar.gz @@ -101,5 +109,4 @@ wheel-0.44.0.tar.gz XML-Parser-2.47.tar.gz xz-5.6.2.tar.xz zlib-1.3.1.tar.gz -zstd-1.5.6.tar.gz -blfs-systemd-units-20240205.tar.xz \ No newline at end of file +zstd-1.5.6.tar.gz \ No newline at end of file From 7712a7ab5996bbd833853ce3c64f3d3b880374fe Mon Sep 17 00:00:00 2001 From: HouXiaoxuan Date: Thu, 17 Apr 2025 03:50:04 +0800 Subject: [PATCH 6/6] feat(origin): Edit grub.cfg to fix kernel panic, add systemd configs --- alfs/custom/config/1008-make-ca | 10 ++--- alfs/custom/config/1022-libunwind | 2 +- alfs/custom/config/1099-custom-config-systemd | 5 +-- alfs/custom/config/1101-custom-config-fstab | 4 +- alfs/custom/config/1102-custom-config-grub | 15 ++++--- alfs/custom/config/2000-custom-install-rust | 3 +- alfs/custom/config/2004-custom-install-mega | 44 +++++-------------- alfs/custom/system/config.6.10.5 | 12 ++--- .../custom/system/mega-configs/start-orion.sh | 14 ++++++ .../system/mega-configs/start-scorpio.sh | 43 ++++++++++++++++++ .../system/systemd-configs/mega-orion.service | 2 +- .../systemd-configs/mega-scorpio.service | 2 +- alfs/scripts/chroot.sh | 32 ++++++++++++++ alfs/scripts/mount.sh | 10 +++++ alfs/scripts/umount.sh | 5 +++ alfs/scripts/unmount_after_chroot.sh | 20 +++++++++ 16 files changed, 164 insertions(+), 59 deletions(-) create mode 100644 alfs/custom/system/mega-configs/start-orion.sh create mode 100644 alfs/custom/system/mega-configs/start-scorpio.sh create mode 100644 alfs/scripts/chroot.sh create mode 100644 alfs/scripts/mount.sh create mode 100644 alfs/scripts/umount.sh create mode 100644 alfs/scripts/unmount_after_chroot.sh diff --git a/alfs/custom/config/1008-make-ca b/alfs/custom/config/1008-make-ca index 929258207..5028e8e69 100644 --- a/alfs/custom/config/1008-make-ca +++ b/alfs/custom/config/1008-make-ca @@ -1,11 +1,11 @@ # Any comments you wish to add -# +# If an error occurs when executing make-ca -g, the certificate version may be updated, and make-ca needs to be updated to the latest version. PKG="make-ca" -PKG_VERSION="1.14" -PKG_FILE="make-ca-1.14.tar.gz" -URL="https://github.com/lfs-book/make-ca/archive/v1.14/make-ca-1.14.tar.gz" -MD5="e99d2985ead0037caedb765fd66b33f0" +PKG_VERSION="1.16" +PKG_FILE="make-ca-1.16.tar.gz" +URL="https://github.com/lfs-book/make-ca/archive/v1.16/make-ca-1.16.tar.gz" +MD5="bf1497691f72ec79d5e0456e3ac3eadc" for i in PATCH{1..10}; do unset $i done diff --git a/alfs/custom/config/1022-libunwind b/alfs/custom/config/1022-libunwind index 062c8d029..a59693acb 100644 --- a/alfs/custom/config/1022-libunwind +++ b/alfs/custom/config/1022-libunwind @@ -5,7 +5,7 @@ PKG="libunwind" PKG_VERSION="1.6.2" PKG_FILE="libunwind-1.6.2.tar.gz" URL="https://download.savannah.nongnu.org/releases/libunwind/libunwind-1.6.2.tar.gz" -MD5="9d486750569e7025e5d0afdcc509b93c" +MD5="f625b6a98ac1976116c71708a73dc44a" for i in PATCH{1..10}; do unset $i done diff --git a/alfs/custom/config/1099-custom-config-systemd b/alfs/custom/config/1099-custom-config-systemd index dbcd15d9d..c863e077a 100644 --- a/alfs/custom/config/1099-custom-config-systemd +++ b/alfs/custom/config/1099-custom-config-systemd @@ -18,8 +18,7 @@ done ( cat << "xEOFx" make install-sshd - - - +make install-dhcpcd +systemctl enable dhcpcd@enp1s0 xEOFx ) > tmp diff --git a/alfs/custom/config/1101-custom-config-fstab b/alfs/custom/config/1101-custom-config-fstab index 6ed0f2fe2..671e85d7b 100644 --- a/alfs/custom/config/1101-custom-config-fstab +++ b/alfs/custom/config/1101-custom-config-fstab @@ -18,8 +18,8 @@ done ( cat << "xEOFx" # use blkid to get the uuid -uuid1=41686c57-192d-4ed8-87a2-7399482c0261 -uuid2=60F7-8A4C +uuid1=5efa0d7d-02fc-402b-9781-359e12acb34d +uuid2=55A7-4F9E # fstab #cat > /etc/fstab << "EOF" diff --git a/alfs/custom/config/1102-custom-config-grub b/alfs/custom/config/1102-custom-config-grub index 7e4c5c69c..257a744d7 100644 --- a/alfs/custom/config/1102-custom-config-grub +++ b/alfs/custom/config/1102-custom-config-grub @@ -17,14 +17,12 @@ done ( cat << "xEOFx" - - -/usr/sbin/grub-install /dev/nbd1 +/usr/sbin/grub-install --target=i386-pc /dev/nbd1 mkdir -p /boot/grub -BOOTUUID=60F7-8A4C -ROOTPARTUUID=dfd4b6d0-02 +BOOTUUID=55A7-4F9E +ROOTPARTUUID=939e0e11-02 echo "# Begin /boot/grub/grub.cfg set default=0 @@ -33,11 +31,14 @@ set timeout=5 insmod ext2 # root = /dev/nbd1p1, used to boot kernel -search --set=root --fs-uuid $BOOTUUID +# search --set=root --fs-uuid $BOOTUUID +set root=(hd0,1) menuentry \"GNU/Linux, Linux 6.10.5-lfs-12.2\" { # here, root is /dev/nbd1p2, used to boot the system - linux /vmlinux-6.10.5-lfs-12.2 root=$ROOTPARTUUID ro + # linux /vmlinux-6.10.5-lfs-12.2 root=$ROOTPARTUUID ro + # for unkown reason, the kernel didn't recognize the root partition, use dev/vdb2 instead + linux /vmlinux-6.10.5-lfs-12.2 root=/dev/vdb2 ro # initrd /initrd.img-6.10.5 } ">/boot/grub/grub.cfg diff --git a/alfs/custom/config/2000-custom-install-rust b/alfs/custom/config/2000-custom-install-rust index 04ada9617..b87088d17 100644 --- a/alfs/custom/config/2000-custom-install-rust +++ b/alfs/custom/config/2000-custom-install-rust @@ -16,9 +16,8 @@ done # PATCHx="patch-url md5" ( cat << "xEOFx" - echo "Install for user $(whoami)" -curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --no-modify-path +curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --no-modify-path || { echo "Curl failed. Exiting."; exit 1; } echo 'export PATH="$PATH:$HOME/.cargo/bin"' >> /etc/profile source /etc/profile xEOFx diff --git a/alfs/custom/config/2004-custom-install-mega b/alfs/custom/config/2004-custom-install-mega index d7409205c..96da10200 100644 --- a/alfs/custom/config/2004-custom-install-mega +++ b/alfs/custom/config/2004-custom-install-mega @@ -18,50 +18,30 @@ done ( cat << "xEOFx" echo "pwd: $(pwd)" -git clone https://github.com/web3infra-foundation/mega.git -cd mega + +if [ ! -d "mega" ]; then + git clone https://github.com/web3infra-foundation/mega.git + cd mega +else + cd mega + git pull --force +fi cargo build -p orion cargo install --path orion cd scorpio cargo install --path . -cargo install - -mkdir -pv /opt/megadir/mount -mkdir -pv /opt/megadir/store -# Currently, the config file must be located in the same directory as the binary. -cat << "yEOFy" > ~/.cargo/bin/scorpio.toml -[config] -base_url = "http://localhost:8000" - -workspace = "/opt/megadir/mount" - -store_path = "/opt/megadir/store" - -git_author = "MEGA" - -git_email = "admin@mega.org" - -file_blob_endpoint = "http://localhost:8000/api/v1/file/blob" - -config_file = "config.toml" - -yEOFy - -cat << "zEOFz" > ~/.cargo/bin/config.toml - -works = [] - -zEOFz +cp /mega-configs/start-scorpio.sh /usr/local/bin/ +cp /mega-configs/start-orion.sh /usr/local/bin/ +chmod +x /usr/local/bin/start-scorpio.sh +chmod +x /usr/local/bin/start-orion.sh cp /systemd-configs/mega-scorpio.service /etc/systemd/system/ cp /systemd-configs/mega-orion.service /etc/systemd/system/ systemctl enable mega-scorpio systemctl enable mega-orion -systemctl start mega-scorpio -systemctl start mega-orion xEOFx ) > tmp diff --git a/alfs/custom/system/config.6.10.5 b/alfs/custom/system/config.6.10.5 index 0b848c6d3..d8e3e9fc1 100644 --- a/alfs/custom/system/config.6.10.5 +++ b/alfs/custom/system/config.6.10.5 @@ -2,14 +2,14 @@ # Automatically generated file; DO NOT EDIT. # Linux/x86 6.10.5 Kernel Configuration # -CONFIG_CC_VERSION_TEXT="gcc (GCC) 14.2.1 20250128" +CONFIG_CC_VERSION_TEXT="gcc (GCC) 14.2.1 20250207" CONFIG_CC_IS_GCC=y CONFIG_GCC_VERSION=140201 CONFIG_CLANG_VERSION=0 CONFIG_AS_IS_GNU=y -CONFIG_AS_VERSION=24301 +CONFIG_AS_VERSION=24400 CONFIG_LD_IS_BFD=y -CONFIG_LD_VERSION=24301 +CONFIG_LD_VERSION=24400 CONFIG_LLD_VERSION=0 CONFIG_CC_CAN_LINK=y CONFIG_CC_CAN_LINK_STATIC=y @@ -18,7 +18,7 @@ CONFIG_CC_HAS_ASM_GOTO_TIED_OUTPUT=y CONFIG_TOOLS_SUPPORT_RELR=y CONFIG_CC_HAS_ASM_INLINE=y CONFIG_CC_HAS_NO_PROFILE_FN_ATTR=y -CONFIG_PAHOLE_VERSION=128 +CONFIG_PAHOLE_VERSION=0 CONFIG_IRQ_WORK=y CONFIG_BUILDTIME_TABLE_SORT=y CONFIG_THREAD_INFO_IN_TASK=y @@ -4335,6 +4335,7 @@ CONFIG_NVMEM_SYSFS=y CONFIG_DCACHE_WORD_ACCESS=y # CONFIG_VALIDATE_FS_PARSER is not set CONFIG_FS_IOMAP=y +CONFIG_FS_STACK=y CONFIG_BUFFER_HEAD=y CONFIG_LEGACY_DIRECT_IO=y # CONFIG_EXT2_FS is not set @@ -4375,7 +4376,8 @@ CONFIG_QUOTACTL=y CONFIG_AUTOFS_FS=y CONFIG_FUSE_FS=m CONFIG_CUSE=m -CONFIG_OVERLAY_FS=y +CONFIG_VIRTIO_FS=m +CONFIG_FUSE_PASSTHROUGH=y # CONFIG_OVERLAY_FS is not set # diff --git a/alfs/custom/system/mega-configs/start-orion.sh b/alfs/custom/system/mega-configs/start-orion.sh new file mode 100644 index 000000000..6da41f501 --- /dev/null +++ b/alfs/custom/system/mega-configs/start-orion.sh @@ -0,0 +1,14 @@ +gateway_ip=$(ip route | grep default | awk '{print $3}') + +if [ -z "$gateway_ip" ]; then + echo "Unable to find the default gateway." + exit 1 +fi + +# BUCK_PROJECT_ROOT="/home/bean/projects/buck2" +# SERVER_WS="ws://localhost:8004/ws" + +export BUCK_PROJECT_ROOT="/opt/megadir/mount" # TODO: need to cooperate with the scprio +export SERVER_WS="ws://$gateway_ip:8004/ws" + +exec /root/.cargo/bin/orion \ No newline at end of file diff --git a/alfs/custom/system/mega-configs/start-scorpio.sh b/alfs/custom/system/mega-configs/start-scorpio.sh new file mode 100644 index 000000000..8a8d2d767 --- /dev/null +++ b/alfs/custom/system/mega-configs/start-scorpio.sh @@ -0,0 +1,43 @@ +#!/bin/sh +#!/bin/bash + +gateway_ip=$(ip route | grep default | awk '{print $3}') + +if [ -z "$gateway_ip" ]; then + echo "Unable to find the default gateway." + exit 1 +fi + +mkdir -pv /opt/megadir/mount +mkdir -pv /opt/megadir/store + +# TODO: pass config file as argument + +# delete the old config +if [ -d ~/.cargo/bin/scorpio.toml ]; then + rm -rf ~/.cargo/bin/scorpio.toml +fi +if [ -d ~/.cargo/bin/config.toml ]; then + rm -rf ~/.cargo/bin/config.toml +fi + +cat < ~/.cargo/bin/scorpio.toml +git_author = "MEGA" +git_email = "admin@mega.org" +# monorepo path +workspace = "/opt/megadir/mount" +# local storage path +store_path = "/opt/megadir/store" +base_url = "http://${gateway}:8000" +config_file = "config.toml" +file_blob_endpoint = "http://$gateway_ip:8000/api/v1/file/blob" +lfs_url = "http://$gateway_ip:8000" +EOF + +cat < ~/.cargo/bin/config.toml +works = [] +EOF + +echo "Configuration files created successfully with the gateway IP: $gateway_ip" + +exec /root/.cargo/bin/scorpio \ No newline at end of file diff --git a/alfs/custom/system/systemd-configs/mega-orion.service b/alfs/custom/system/systemd-configs/mega-orion.service index feb36cff5..96129061d 100644 --- a/alfs/custom/system/systemd-configs/mega-orion.service +++ b/alfs/custom/system/systemd-configs/mega-orion.service @@ -3,7 +3,7 @@ Description=mega-orion After=network.target [Service] -ExecStart=/root/.cargo/bin/orion +ExecStart=/usr/local/bin/start-orion.sh WorkingDirectory=/root/.cargo/bin Restart=always User=root diff --git a/alfs/custom/system/systemd-configs/mega-scorpio.service b/alfs/custom/system/systemd-configs/mega-scorpio.service index f9aa358e3..60d0ee8b9 100644 --- a/alfs/custom/system/systemd-configs/mega-scorpio.service +++ b/alfs/custom/system/systemd-configs/mega-scorpio.service @@ -3,7 +3,7 @@ Description=mega-scorpio After=network.target [Service] -ExecStart=/root/.cargo/bin/scorpio +ExecStart=/usr/local/bin/start-scorpio.sh WorkingDirectory=/root/.cargo/bin Restart=always User=root diff --git a/alfs/scripts/chroot.sh b/alfs/scripts/chroot.sh new file mode 100644 index 000000000..caa693b23 --- /dev/null +++ b/alfs/scripts/chroot.sh @@ -0,0 +1,32 @@ +#!/bin/bash +set -e + +LFS=/mnt/lfs + +# 确保挂载点存在 +if [ ! -d "$LFS" ]; then + echo "错误:$LFS 不存在" + exit 1 +fi + +# 挂载虚拟文件系统 +mount --types proc /proc $LFS/proc +mount --rbind /sys $LFS/sys +mount --make-rslave $LFS/sys +mount --rbind /dev $LFS/dev +mount --make-rslave $LFS/dev +mount --bind /run $LFS/run +mount --make-slave $LFS/run + +# 如果 /dev/shm 是符号链接,创建对应目标目录 +if [ -h $LFS/dev/shm ]; then + mkdir -pv $LFS/$(readlink $LFS/dev/shm) +fi + +# 进入 chroot 环境 +chroot "$LFS" /usr/bin/env -i \ + HOME=/root \ + TERM="$TERM" \ + PS1='(lfs chroot) \u:\w\$ ' \ + PATH=/bin:/usr/bin:/sbin:/usr/sbin \ + /bin/bash --login diff --git a/alfs/scripts/mount.sh b/alfs/scripts/mount.sh new file mode 100644 index 000000000..ec3df5082 --- /dev/null +++ b/alfs/scripts/mount.sh @@ -0,0 +1,10 @@ + +IMAGE_PATH=./vda.qcow2 +LFS_PATH=/mnt/lfs + +sudo modprobe nbd max_part=4 +sudo qemu-nbd -c /dev/nbd1 $IMAGE_PATH +sleep 2 +sudo mount /dev/nbd1p2 $LFS_PATH +sudo mount /dev/nbd1p1 $LFS_PATH/boot + diff --git a/alfs/scripts/umount.sh b/alfs/scripts/umount.sh new file mode 100644 index 000000000..19a152f26 --- /dev/null +++ b/alfs/scripts/umount.sh @@ -0,0 +1,5 @@ +LFS_PATH=/mnt/lfs + +sudo umount $LFS_PATH/boot +sudo umount $LFS_PATH +sudo qemu-nbd -d /dev/nbd1 \ No newline at end of file diff --git a/alfs/scripts/unmount_after_chroot.sh b/alfs/scripts/unmount_after_chroot.sh new file mode 100644 index 000000000..e4148aaca --- /dev/null +++ b/alfs/scripts/unmount_after_chroot.sh @@ -0,0 +1,20 @@ +#!/bin/bash + +# 确保我们是在退出 chroot 环境后执行的清理操作 +if mount | grep -q 'on /mnt/lfs'; then + echo "Unmounting chroot mounts..." + + # 卸载 /mnt/lfs 相关的文件系统 + # 注意:调整 `/mnt/lfs` 为你的 chroot 挂载目录路径 + umount -R /mnt/lfs/dev/pts + umount -R /mnt/lfs/dev + umount -R /mnt/lfs/proc + umount -R /mnt/lfs/sys + umount -R /mnt/lfs/tmp + umount -R /mnt/lfs/run + umount -R /mnt/lfs/var + + echo "All chroot mounts have been successfully unmounted." +else + echo "Not inside chroot environment or mounts not found." +fi