这是个比较随意的分享,希望能够起到拓宽同学们视野的作用就 OK 了!
- 技术问题的核心往往是非技术问题
混个脸熟点燃火种,团结社区力量
- GitHub: @xen0n
- Gentoo Wiki: https://wiki.gentoo.org/wiki/User:Xen0n
- 兴趣使然 & 容易将电子设备用坏 → 承担社会责任
- 近一年比起打包,更多在各种上游打杂
想吃面包了,先种麦子- Make LoongArch new world happen
- Linux
arch/loongarchreviewer - Toolchain dev: contributor to LLVM/Go/Rust/...
- 分发模式:源码发行版 or 二进制发行版?
- 要制作成品发行版,必须做的一系列技术决策,如何决定?
- 许可证:纯自由软件?如果需要集成非自由软件,以什么标准判断?
- 包的版本选取策略:固定版本 or 滚动更新?
- 工具链
- GNU or LLVM?
- glibc or musl? (think Alpine)
- 假定什么指令集特性可用?
- 服务管理:SysV or systemd?
- 图形界面:X11 or Wayland? GNOME or KDE or ...?
- 网络管理:NetworkManager or sd-networkd or ...?
- ...
- 预装哪些软件和配置?意欲优化哪个(哪些)应用场景?
- 内核特性:rt 补丁?out-of-tree 驱动?Kconfig 参数?
- 预装应用如何选取?
- 对某个(些)软件包,打开或关闭什么功能?
- https://www.gentoo.org/
- https://wiki.gentoo.org/
- https://github.com/gentoo/gentoo
- https://devmanual.gentoo.org/
Every user has work they need to do. The goal of Gentoo is to design tools and systems that allow a user to do that work as pleasantly and efficiently as possible, as they see fit. Our tools should be a joy to use, and should help the user to appreciate the richness of the Linux and free software community, and the flexibility of free software. This is only possible when the tool is designed to reflect and transmit the will of the user, and leave the possibilities open as to the final form of the raw materials (the source code.) If the tool forces the user to do things a particular way, then the tool is working against, rather than for, the user. We have all experienced situations where tools seem to be imposing their respective wills on us. This is backwards, and contrary to the Gentoo philosophy.
Put another way, the Gentoo philosophy is to create better tools. When a tool is doing its job perfectly, you might not even be very aware of its presence, because it does not interfere and make its presence known, nor does it force you to interact with it when you don’t want it to. The tool serves the user rather than the user serving the tool.
The goal of Gentoo is to strive to create near-ideal tools. Tools that can accommodate the needs of many different users all with divergent goals. Don’t you love it when you find a tool that does exactly what you want to do? Doesn’t it feel great? Our mission is to give that sensation to as many people as possible.
基于此,Gentoo 对以上关键问题的回答是:
- 默认从源码编译,但近年 binhost 支持也已可用
- best of both worlds: 如果用户不做更多定制,则包版本、配置相同,会命中 binpackage。自定义过的包则在本地编译
- 仓库允许包含非 FLOSS 包,但默认不开启
- 包的版本:需要/支持多少,保留多少
- 必须决定,或变更难度较高的配置:通过 profiles 选择,e.g.
default/linux/amd64/17.1/desktop/gnome/systemd/merged-usr-- merged-/usr& GNOME & systemddefault/linux/amd64/23.0/musl/llvm-- musl & LLVM & openrcdefault/linux/amd64/23.0/split-usr/hardened/selinux-- split-/usr& SELinux & openrcdefault/linux/amd64/23.0/x32-- x32 ABI
- 用户可随时方便修改的配置:自助维护
/etc/portage/package.accept_keywords选择不稳定包版本/etc/portage/package.license放行非开源许可证/etc/portage/package.use控制可选特性- etc.
- 包管理工具 Portage:超群的依赖表示与解析能力
- 丰富的元数据表达方式
- 反向依赖(reverse dependencies, revdeps)处理
FEATURES=preserve-libs: 追踪所有 ELF 的DT_NEEDED信息- sub-slot 触发的 rebuilds
Gentoo ebuild 模板 skel.ebuild 是 Gentoo 打包哲学的一面镜子。
SLOT: 允许同一包的不同 SLOT 共存- sub-slot: ABI marker
举例说明:
sys-devel/llvm:SLOT="18"media-video/ffmpeg:SLOT="0/58.60.60
# dev-lang/rust 架空的、简化的 LLVM 依赖 # 支持 llvm:17 & llvm:18,本身支持的每个 target 都要在 llvm 有对应支持 LLVM_DEPEND=" || ( ( llvm_targets_aarch64? ( sys-devel/llvm:17[llvm_targets_aarch64(-)] ) llvm_targets_loongarch? ( sys-devel/llvm:17[llvm_targets_loongarch(-)] ) llvm_targets_riscv? ( sys-devel/llvm:17[llvm_targets_riscv(-)] ) llvm_targets_x86? ( sys-devel/llvm:17[llvm_targets_x86(-)] ) ... wasm? ( sys-devel/lld:17 ) ) ( llvm_targets_aarch64? ( sys-devel/llvm:18[llvm_targets_aarch64(-)] ) llvm_targets_loongarch? ( sys-devel/llvm:18[llvm_targets_loongarch(-)] ) llvm_targets_riscv? ( sys-devel/llvm:18[llvm_targets_riscv(-)] ) llvm_targets_x86? ( sys-devel/llvm:18[llvm_targets_x86(-)] ) ... wasm? ( sys-devel/lld:18 ) ) ) <sys-devel/llvm-19:= "# net-im/telegram-desktop # 不约束 slot,需要跟踪 subslot,需要它以 USE=opus & USE=vpx 构建 DEPEND=" media-video/ffmpeg:=[opus,vpx] "预置的各种配置:USE、masks(哪些配置、版本是已知存在问题的)、license 选取(例如 linux-firmware),等等。
- 手工管理
genkernel- Distribution Kernel:
gentoo-kernel
Overlay 结构与主库(::gentoo)相同,方便各种需求:
- 下游衍生发行版 e.g. ChromiumOS
- 个人 overlay,自用软件包
- 涉及范围较广的测试 e.g.
::kde::x11::haskell