“Ubuntu From Scratch”(简称 UFS)通常指从零开始构建属于自己的 Ubuntu 风格 Linux 系统,而不是像 LFS(Linux From Scratch)那样从内核和源码完全手写,而是基于 Ubuntu 的包管理和基础结构,自己组装一个可启动的 Ubuntu 系统。
下面按用途分类说明需要什么工具。
你在现有 Ubuntu(或 Debian 系)系统上操作:
sudo apt update
sudo apt install -y \
debootstrap \
schroot \
qemu-user-static \
binfmt-support \
parted \
gdisk \
dosfstools \
mtools \
squashfs-tools \
xorriso \
grub-pc-bin \
grub-efi-amd64-bin \
mtools \
rsync \
git \
vim
用于从 Ubuntu 仓库拉取基础系统:
debootstrap --arch=amd64 noble /mnt/ubuntu http://archive.ubuntu.com/ubuntu
进入构建中的系统:
schroot -c ubuntu-build
# 或
chroot /mnt/ubuntu
linux-image-genericinitramfs-toolsgrub2systemdqemu-img create -f raw ubuntu.img 4G
parted ubuntu.img mklabel gpt
mkfs.ext4
mkfs.vfat
xorriso -as mkisofs ...
squashfs-tools
如果你要为 ARM / RISC-V 构建:
qemu-user-static
binfmt-support
gcc-aarch64-linux-gnu
qemu-system-x86_64gdbstracejournalctldebootstrap 建最小系统chroot 进去装内核和 GRUB如果你愿意,我可以:
你打算做到哪一步?