revert cpio usage, bsdtar is faster

This commit is contained in:
Tobias Powalowski 2023-03-17 08:50:04 +01:00
parent 9b7d259fbe
commit 1a30a18998
6 changed files with 14 additions and 7 deletions

View file

@ -152,12 +152,14 @@ build_image() {
find . -mindepth 1 -execdir touch -hcd "@0" "{}" + find . -mindepth 1 -execdir touch -hcd "@0" "{}" +
# If this pipeline changes, |pipeprogs| below needs to be updated as well. # If this pipeline changes, |pipeprogs| below needs to be updated as well.
find . -mindepth 1 | find . -mindepth 1 -printf '%P\0' |
cpio --reproducible --quiet -o -H newc | sort -z |
LANG=C bsdtar --uid 0 --gid 0 --null -cnf - -T - |
LANG=C bsdtar --null -cf - --format=newc @- |
$compress "${COMPRESSION_OPTIONS[@]}" > "$compressout" $compress "${COMPRESSION_OPTIONS[@]}" > "$compressout"
pipestatus=("${PIPESTATUS[@]}") pipestatus=("${PIPESTATUS[@]}")
pipeprogs=('find' 'cpio' "$compress") pipeprogs=('find' 'sort' 'bsdtar (step 1)' 'bsdtar (step 2)' "$compress")
popd >/dev/null || return popd >/dev/null || return

View file

@ -15,6 +15,7 @@ add_firmware() {
if ! compgen -G "${BUILDROOT}${fwpath}/${fw}"?(.*) &>/dev/null; then if ! compgen -G "${BUILDROOT}${fwpath}/${fw}"?(.*) &>/dev/null; then
if fwfile="$(compgen -G "${fwpath}/${fw}"?(.*))"; then if fwfile="$(compgen -G "${fwpath}/${fw}"?(.*))"; then
add_file "$fwfile" add_file "$fwfile"
break
fi fi
fi fi
done done

View file

@ -240,7 +240,11 @@ _create_initramfs() {
# https://www.kernel.org/doc/Documentation/filesystems/ramfs-rootfs-initramfs.txt # https://www.kernel.org/doc/Documentation/filesystems/ramfs-rootfs-initramfs.txt
# compress image with zstd # compress image with zstd
cd "${_W_DIR}"/tmp || exit 1 cd "${_W_DIR}"/tmp || exit 1
find . -mindepth 1 | cpio --reproducible --quiet -o -H newc | zstd --rm -T0> ${_RAM}/${_INITRD} & find . -mindepth 1 -printf '%P\0' |
sort -z |
LANG=C bsdtar --null -cnf - -T - |
LANG=C bsdtar --null -cf - --format=newc @- |
zstd --rm -T0> ${_RAM}/${_INITRD} &
sleep 2 sleep 2
while pgrep -x zstd &>/dev/null; do while pgrep -x zstd &>/dev/null; do
_clean_kernel_cache _clean_kernel_cache

View file

@ -7,7 +7,7 @@ build ()
map add_binary head id cksum tail test uptime w who whoami xargs \ map add_binary head id cksum tail test uptime w who whoami xargs \
swapon uniq seq fdisk sfdisk cfdisk parted free less \ swapon uniq seq fdisk sfdisk cfdisk parted free less \
chgrp chown dialog dmesg egrep fgrep stty sync hdparm \ chgrp chown dialog dmesg egrep fgrep stty sync hdparm \
dirname chroot expr bzip2 su sdparm tput bsdtar bsdcpio \ dirname chroot expr bzip2 su sdparm tput bsdcpio \
losetup mkfifo mknod readlink lzmadec lzop xz last wall mesg utmpdump \ losetup mkfifo mknod readlink lzmadec lzop xz last wall mesg utmpdump \
xzdec switch_root pivot_root chcpu ctrlaltdel gdisk sgdisk cgdisk fixparts findmnt \ xzdec switch_root pivot_root chcpu ctrlaltdel gdisk sgdisk cgdisk fixparts findmnt \
lsfd lsblk swaplabel cal chrt col colcrt colrm column fallocate flock getopt \ lsfd lsblk swaplabel cal chrt col colcrt colrm column fallocate flock getopt \

View file

@ -6,7 +6,7 @@ build ()
{ {
apps="head id cksum tail test uptime w who whoami xargs \ apps="head id cksum tail test uptime w who whoami xargs \
swapon uniq seq fdisk sfdisk cfdisk parted free less \ swapon uniq seq fdisk sfdisk cfdisk parted free less \
chgrp dialog dmesg egrep fgrep stty sync hdparm bsdtar bsdcpio\ chgrp dialog dmesg egrep fgrep stty sync hdparm bsdcpio\
dirname chroot expr bunzip2 bzcat bzip2 su sdparm tput \ dirname chroot expr bunzip2 bzcat bzip2 su sdparm tput \
losetup mkfifo mknod lzmadec lzop lzma lzcat unlzma unxz xzcat \ losetup mkfifo mknod lzmadec lzop lzma lzcat unlzma unxz xzcat \
lastb last wall mesg utmpdump xzdec switch_root pivot_root chcpu ctrlaltdel \ lastb last wall mesg utmpdump xzdec switch_root pivot_root chcpu ctrlaltdel \

View file

@ -19,7 +19,7 @@ build ()
mkdir echo false sleep kmod pidof touch chmod find wc uname yes awk halt \ mkdir echo false sleep kmod pidof touch chmod find wc uname yes awk halt \
shutdown reboot poweroff insmod modprobe sh dd sort zstd date tee mktemp \ shutdown reboot poweroff insmod modprobe sh dd sort zstd date tee mktemp \
install pgrep mkfs.btrfs rmmod mountpoint gzip ldconfig nscd ln top df cut \ install pgrep mkfs.btrfs rmmod mountpoint gzip ldconfig nscd ln top df cut \
stat tr passwd od tar cpio stat tr passwd od tar bsdtar
### add nano ### add nano
add_binary nano add_binary nano