Skip to content

Commit

Permalink
switch from squashfs to erofs
Browse files Browse the repository at this point in the history
  • Loading branch information
dimkr committed Sep 20, 2024
1 parent b495b34 commit 50d78a3
Show file tree
Hide file tree
Showing 12 changed files with 20 additions and 22 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ jobs:
- name: Install dependencies
run: |
sudo apt-get update -qq
sudo apt-get install -y --no-install-recommends debootstrap
sudo apt-get install -y --no-install-recommends debootstrap erofs-utils
[ ${{ inputs.compat-distro }} != devuan ] || curl https://git.devuan.org/devuan/debootstrap/raw/branch/master/scripts/ceres | sudo tee /usr/share/debootstrap/scripts/`echo ${{ inputs.compat-distro-version }} | sed s/64$//`
- name: 1download
timeout-minutes: 120
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/dpup-kernel.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
- name: Free space
run: sudo rm -rf /usr/local/lib/android /usr/share/dotnet # increase free space, we don't need these
- name: Install dependencies
run: sudo apt-get update -qq && sudo apt-get install -y --no-install-recommends debootstrap
run: sudo apt-get update -qq && sudo apt-get install -y --no-install-recommends debootstrap erofs-utils
- name: merge2out
timeout-minutes: 5
run: sudo -E ./merge2out woof-distro/${{ matrix.arch }}/debian/${{ matrix.release }}64
Expand Down
2 changes: 1 addition & 1 deletion initrd-progs/0initrd/init
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ do_stack_onepupdrv() {
losetup -r $ONE_LOOP $ONE_SFS
SFS_MP="/pup_${ONE_SFX}"
mkdir -p $SFS_MP
mount -r -t squashfs -o noatime $ONE_LOOP $SFS_MP > /dev/console 2>&1
mount -r -t erofs,squashfs -o noatime $ONE_LOOP $SFS_MP > /dev/console 2>&1
STATUS=$? ; check_status $STATUS
[ $STATUS -eq 0 ] && ONE_LAYER="$SFS_MP=rr"
# ======= end of load_sfs_file()
Expand Down
2 changes: 1 addition & 1 deletion kernel-kit/README
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ distro which is compatible with the target distro.

REQUIRED:
gcc - for compilation
mksquashfs - for compressing the kernel source sfs, will build without
erofs-utils - for compressing the kernel source sfs

CREDIT
------
Expand Down
4 changes: 2 additions & 2 deletions kernel-kit/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -60,11 +60,11 @@ mkdir -p ${KBUILD_DIR}/usr/src/${KBUILD_DIR}
mkdir -p ${KBUILD_DIR}/usr/lib/modules/${kernel_version}
ln -s ../../../src/${KBUILD_DIR} ${KBUILD_DIR}/usr/lib/modules/${kernel_version}/build
ln -s ../../../src/${KBUILD_DIR} ${KBUILD_DIR}/usr/lib/modules/${kernel_version}/source
mksquashfs ${KBUILD_DIR} output/${KBUILD_DIR}.sfs ${SFSCOMP} || exit 1
mkfs.erofs ${SFSCOMP} output/${KBUILD_DIR}.sfs ${KBUILD_DIR} || exit 1
rm -rf ${KBUILD_DIR}

KERNEL_MODULES_SFS_NAME="kernel-modules-${kernel_version}.sfs"
mksquashfs output/linux_kernel-${kernel_version} output/${KERNEL_MODULES_SFS_NAME} ${SFSCOMP} || exit 1
mkfs.erofs ${SFSCOMP} output/${KERNEL_MODULES_SFS_NAME} output/linux_kernel-${kernel_version} || exit 1
rm -rf output/linux_kernel-${kernel_version}

echo "Done!"
Expand Down
1 change: 1 addition & 0 deletions kernel-kit/debian-diffconfigs/trixie
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ CONFIG_CROS_EC_LPC=m
CONFIG_CRYPTO_CTS=y
CONFIG_CRYPTO_SHA512=y
CONFIG_CRYPTO_XTS=y
CONFIG_EROFS_FS=y
CONFIG_EXFAT_FS=y
CONFIG_EXT4_FS=y
CONFIG_F2FS_FS=y
Expand Down
8 changes: 4 additions & 4 deletions woof-code/3builddistro
Original file line number Diff line number Diff line change
Expand Up @@ -213,10 +213,10 @@ cp -f ../kernel-kit/output/vmlinuz-* build/vmlinuz
cp -f ../kernel-kit/output/kbuild-*.sfs build/
cp -f ../kernel-kit/output/kernel-modules-*.sfs build/${ZDRVSFS}

mksquashfs fdrv build/${FDRVSFS} ${SFSCOMP}
mksquashfs nlsx build/${NLSXSFS} ${SFSCOMP}
mksquashfs docx build/${DOCXSFS} ${SFSCOMP}
mksquashfs rootfs-complete build/${PUPPYSFS} ${SFSCOMP}
mkfs.erofs ${SFSCOMP} build/${FDRVSFS} fdrv
mkfs.erofs ${SFSCOMP} build/${NLSXSFS} nlsx
mkfs.erofs ${SFSCOMP} build/${DOCXSFS} docx
mkfs.erofs ${SFSCOMP} build/${PUPPYSFS} rootfs-complete

WOOF_OUTPUT="woof-output-${DISTRO_FILE_PREFIX}-${DISTRO_VERSION}"
mkdir -p ../${WOOF_OUTPUT}
Expand Down
4 changes: 2 additions & 2 deletions woof-code/rootfs-skeleton/usr/local/sbin/sfs_load.overlay
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ if [ $# -ne 0 ]; then
[ $FOUND -eq 0 ] && exit 1

mkdir -p "$MNT" || continue
mount -r -t squashfs -o loop,noatime "$SFS" "$MNT"
mount -r -t erofs,squashfs -o loop,noatime "$SFS" "$MNT"
if [ $? -ne 0 ]; then
rmdir "$MNT"
continue
Expand Down Expand Up @@ -220,7 +220,7 @@ if [ $# -ne 0 ]; then
mkdir -p "$MNT"
mountpoint -q "$MNT"
if [ $? -ne 0 ]; then
mount -r -t squashfs -o loop,noatime "$SFS" "$MNT" || continue
mount -r -t erofs,squashfs -o loop,noatime "$SFS" "$MNT" || continue
fi

defaultfilemanager "$MNT" &
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# SFS Modules

SFS modules are [Squashfs](https://docs.kernel.org/filesystems/squashfs.html) images containing a read-only directory hierarchy. DISTRO_NAME uses [overlayfs](https://docs.kernel.org/filesystems/overlayfs.html) to stack SFSs on top of each other and present their contents as a unified directory hierarchy.
SFS modules are [EROFS](https://docs.kernel.org/filesystems/erofs.html) or [Squashfs](https://docs.kernel.org/filesystems/squashfs.html) images containing a read-only directory hierarchy. DISTRO_NAME uses [overlayfs](https://docs.kernel.org/filesystems/overlayfs.html) to stack SFSs on top of each other and present their contents as a unified directory hierarchy.

## Loading

Expand Down Expand Up @@ -39,10 +39,10 @@ Therefore, to control the stacking order of these SFSs, prefix their names with

To create /tmp/app.sfs from /tmp/app:

mksquashfs /tmp/app /tmp/app.sfs -comp zstd -Xcompression-level 19 -b 256K -no-exports -no-xattrs
mkfs.erofs -x0 -zlz4hc,12 -C262144 /tmp/app.sfs /tmp/app

To load app.sfs on startup, place it under the root (or `psubdir`, if set) of the save partition or boot partition.

Once app.sfs is loaded, /tmp/app/usr/bin/a can be accessed through /usr/bin/a.

See `man mksquashfs` for more SFS creation options.
See `man mkfs.erofs` for more SFS creation options.
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ The goal is to build something similar to [DebianDog](https://debiandog.github.i
### Speed

* The init script (/etc/rc.d/rc.sysinit) and the shutdown script (/etc/rc.d/rc.shutdown) are shorter and much faster.
* SFSs can use [EROFS](https://docs.kernel.org/filesystems/erofs.html) instead of [Squashfs](https://docs.kernel.org/filesystems/squashfs.html) and all built-in SFSs use the former.
* Caching of SFSs in RAM (`pfix=ram|copy` or automatic) happens in the background while the boot process continues.
* 1download and 3builddistro are reimplemented using [debootstrap](https://wiki.debian.org/Debootstrap) and chroot environments. Build times are much shorter than upstream's and woof-CE itself is more portable.
* `save2flash` is much faster because it preallocates space when files grow and only copies appended or modified blocks when files change.
Expand Down Expand Up @@ -122,7 +123,7 @@ The goal is to build something similar to [DebianDog](https://debiandog.github.i

## Usage

sudo apt-get install -y --no-install-recommends debootstrap squashfs-tools
sudo apt-get install -y --no-install-recommends debootstrap erofs-utils

Then:

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ yes|desktop-file-utils|desktop-file-utils|exe,dev,doc,nls||deps:yes
yes|dialog|dialog|exe,dev>null,doc,nls||deps:yes
no|dkms|dkms|exe,dev>exe,doc,nls||deps:yes
yes|dosfstools|dosfstools|exe,dev>null,doc,nls||deps:yes
yes|erofs-utils|erofs-utils|exe,dev,doc,nls||deps:yes
yes|exfatprogs|exfatprogs|exe,dev,doc,nls||deps:yes
yes|f2fs-tools|f2fs-tools|exe,dev,doc,nls||deps:yes
yes|gettext-base|gettext-base|exe,dev,doc,nls||deps:yes
Expand All @@ -67,7 +68,6 @@ yes|pipewire|pipewire-pulse,pipewire-alsa,libspa-0.2-bluetooth,libpipewire-0.3-d
yes|pigz|pigz|exe,dev,doc,nls||deps:yes
yes|procps|procps|exe,dev,doc,nls||deps:yes
yes|psmisc|psmisc|exe,dev>null,doc,nls||deps:yes
yes|squashfs-tools|squashfs-tools|exe,dev,doc,nls||deps:yes
yes|udev|udev|exe,dev,doc,nls||deps:yes
yes|wireless-regdb|wireless-regdb|exe,dev,doc,nls||deps:yes
yes|wireplumber|wireplumber|exe,dev,doc,nls||deps:yes
Expand Down
6 changes: 1 addition & 5 deletions woof-distro/x86_64/debian/trixie64/_00build.conf
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,4 @@ fi
[ "$DISTRO_VARIANT" != "barebones" ] && PETBUILDS="$PETBUILDS notification-daemon-stub mtpaint epdfview deadbeef gmeasures fpm2 xpad ExpenseTracker hardinfo gfnrename fsearch wly-colpick gplaces"

## compression method to be used (SFS files)
#SFSCOMP='-comp xz -Xbcj x86 -b 512K'
#SFSCOMP='-comp xz -Xbcj arm,armthumb -b 512K'
#SFSCOMP='-comp gzip'
#SFSCOMP='-noI -noD -noF -noX'
SFSCOMP='-comp zstd -Xcompression-level 19 -b 256K -no-exports -no-xattrs'
SFSCOMP='-x0 -zlz4hc,12 -C262144'

0 comments on commit 50d78a3

Please sign in to comment.