mirror of
https://gitlab.archlinux.org/tpowa/archboot.git
synced 2024-09-19 19:40:37 +02:00
use 3cpio/zstd to uncompress multi archive initramfs, create multi archive cpio initramfs files
This commit is contained in:
parent
d131d2c24e
commit
7ab3daa611
7 changed files with 22 additions and 12 deletions
|
@ -246,14 +246,24 @@ _install_libs() {
|
||||||
}
|
}
|
||||||
|
|
||||||
_create_cpio() {
|
_create_cpio() {
|
||||||
echo "Creating zstd compressed image..."
|
|
||||||
pushd "${_ROOTFS}" >"${_NO_LOG}" || return
|
pushd "${_ROOTFS}" >"${_NO_LOG}" || return
|
||||||
|
echo "Creating initramfs:"
|
||||||
# Reproducibility: set all timestamps to 0
|
# Reproducibility: set all timestamps to 0
|
||||||
fd . -u --min-depth 1 -X touch -hcd "@0"
|
fd . -u --min-depth 1 -X touch -hcd "@0"
|
||||||
|
echo "Appending directories..."
|
||||||
|
fd . -t d -0 | sort -z |
|
||||||
|
LC_ALL=C.UTF-8 bsdtar --null -cnf - -T - |
|
||||||
|
LC_ALL=C.UTF-8 bsdtar --null -cf - --format=newc @- > "${_GENERATE_IMAGE}" || _abort "Image creation failed!"
|
||||||
|
echo "Appending compressed files..."
|
||||||
|
fd . -u -e 'bz2' -e 'gz' -e 'xz' -e 'zst' --min-depth 1 -0 | sort -z |
|
||||||
|
LC_ALL=C.UTF-8 bsdtar --null -cnf - -T - |
|
||||||
|
LC_ALL=C.UTF-8 bsdtar --null -cf - --format=newc @- >> "${_GENERATE_IMAGE}" || _abort "Image creation failed!"
|
||||||
|
fd . -u -e 'bz2' -e 'gz' -e 'xz' -e 'zst' --min-depth 1 -X rm
|
||||||
|
echo "Appending zstd compressed image..."
|
||||||
# use zstd only it has best compression and decompression
|
# use zstd only it has best compression and decompression
|
||||||
fd . -u --min-depth 1 -0 | sort -z |
|
fd . -u --min-depth 1 -0 | sort -z |
|
||||||
LC_ALL=C.UTF-8 bsdtar --null -cnf - -T - |
|
LC_ALL=C.UTF-8 bsdtar --null -cnf - -T - |
|
||||||
LC_ALL=C.UTF-8 bsdtar --null -cf - --format=newc @- |
|
LC_ALL=C.UTF-8 bsdtar --null -cf - --format=newc @- |
|
||||||
zstd -T0 -19 > "${_GENERATE_IMAGE}" || _abort "Image creation failed!"
|
zstd -T0 -19 >> "${_GENERATE_IMAGE}" || _abort "Image creation failed!"
|
||||||
popd >"${_NO_LOG}" || return
|
popd >"${_NO_LOG}" || return
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,11 +5,11 @@
|
||||||
_run ()
|
_run ()
|
||||||
{
|
{
|
||||||
# add basic apps
|
# add basic apps
|
||||||
_map _binary bash blkid bsdcpio cat cp cut dialog echo env find grep \
|
_map _binary 3cpio bash blkid cat cp cut dialog echo env find grep \
|
||||||
gzip halt head init journalctl kmod ln loadkeys logger ls{,blk,mod} \
|
gzip halt head init journalctl kmod ln loadkeys logger ls{,blk,mod} \
|
||||||
mkdir mkfs.btrfs modprobe less mount mountpoint mv poweroff \
|
mkdir mkfs.btrfs modprobe less mount mountpoint mv poweroff \
|
||||||
realpath reboot rg rm setfont sh shutdown sleep sulogin systemctl \
|
realpath reboot rg rm setfont sh shutdown sleep sulogin systemctl \
|
||||||
systemd-tmpfiles udevadm umount uname
|
systemd-tmpfiles udevadm umount uname zstd
|
||||||
# rdinit= kernel parameter defaults to /init
|
# rdinit= kernel parameter defaults to /init
|
||||||
# https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/init/main.c
|
# https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/init/main.c
|
||||||
_symlink /init bin/init
|
_symlink /init bin/init
|
||||||
|
|
|
@ -6,7 +6,7 @@ _run ()
|
||||||
{
|
{
|
||||||
! grep -qw 'archboot' /etc/hostname && return
|
! grep -qw 'archboot' /etc/hostname && return
|
||||||
_install_files
|
_install_files
|
||||||
rm /usr/bin/{bsdcpio,blkid,gzip,journalctl,less,lsmod,mkfs.btrfs,\
|
rm /usr/bin/{3cpio,blkid,gzip,journalctl,less,lsmod,mkfs.btrfs,\
|
||||||
mountpoint,setfont,sulogin,systemctl}
|
mountpoint,setfont,sulogin,systemctl}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -35,7 +35,7 @@ usr/share/{locale/{be,bg,cs,da,de,en_US,el,es,fi,fr,hu,it,lt,lv,mk,nl,nn,pl,pt,r
|
||||||
var/lib/pacman/local \
|
var/lib/pacman/local \
|
||||||
| tar -C "${_ROOTFS}" -xpf -
|
| tar -C "${_ROOTFS}" -xpf -
|
||||||
fi
|
fi
|
||||||
_map _binary agetty archlinux-keyring-wkd-sync awk bat basename brotli bsdtar \
|
_map _binary agetty archlinux-keyring-wkd-sync awk bat basename brotli bsd{cpio,tar} \
|
||||||
{bus,boot,coredump,hostname,journal,locale,login,machine,network,\
|
{bus,boot,coredump,hostname,journal,locale,login,machine,network,\
|
||||||
system,timedate,userdb,home,oom,portable}ctl btm certutil chmod clear cmsutil crlutil curl date \
|
system,timedate,userdb,home,oom,portable}ctl btm certutil chmod clear cmsutil crlutil curl date \
|
||||||
dbus-{broker{,-launch},cleanup-sockets,daemon,launch,monitor,run-session,send,test-tool,\
|
dbus-{broker{,-launch},cleanup-sockets,daemon,launch,monitor,run-session,send,test-tool,\
|
||||||
|
@ -49,7 +49,7 @@ update-activation-environment,uuidgen} dd df dir du dust exa eza false fd fzf fz
|
||||||
cgls,cgtop,confextdelta,detect-virt,escape,firstboot,hwdb,inhibit,machine-id-setup,mount,notify,nspawn,path,\
|
cgls,cgtop,confextdelta,detect-virt,escape,firstboot,hwdb,inhibit,machine-id-setup,mount,notify,nspawn,path,\
|
||||||
resolve,repartrun,socket-activate,stdio-bridge,sysusers,tty-ask-password-agent,umount,creds,cryptenroll,dissect,\
|
resolve,repartrun,socket-activate,stdio-bridge,sysusers,tty-ask-password-agent,umount,creds,cryptenroll,dissect,\
|
||||||
id128,sysext} tar tee testpkg top touch trust tty unix_{chkpwd,update} /usr/lib/dbus-1.0/dbus-daemon-launch-helper \
|
id128,sysext} tar tee testpkg top touch trust tty unix_{chkpwd,update} /usr/lib/dbus-1.0/dbus-daemon-launch-helper \
|
||||||
umount.nfs{,4} update-ca-trust vercmp wc yes zoxide zstd
|
umount.nfs{,4} update-ca-trust vercmp wc yes zoxide
|
||||||
# add C.UTF-8 locale
|
# add C.UTF-8 locale
|
||||||
_dir /usr/lib/locale
|
_dir /usr/lib/locale
|
||||||
[[ -d /usr/lib/locale/C.utf8 ]] && _full_dir /usr/lib/locale/C.utf8
|
[[ -d /usr/lib/locale/C.utf8 ]] && _full_dir /usr/lib/locale/C.utf8
|
||||||
|
|
|
@ -16,7 +16,7 @@ daemon,launch,monitor,run-session,send,test-tool,update-activation-environment,u
|
||||||
kernel-install,systemd-{analyze,ask-password,cat,cgls,cgtop,delta,detect-virt,escape,firstboot,\
|
kernel-install,systemd-{analyze,ask-password,cat,cgls,cgtop,delta,detect-virt,escape,firstboot,\
|
||||||
hwdb,inhibit,machine-id-setup,mount,notify,nspawn,path,resolve,run,umount,socket-activate,\
|
hwdb,inhibit,machine-id-setup,mount,notify,nspawn,path,resolve,run,umount,socket-activate,\
|
||||||
stdio-bridge,sysusers,tty-ask-password-agent,repart,creds,cryptenroll,dissect,id128,sysext},\
|
stdio-bridge,sysusers,tty-ask-password-agent,repart,creds,cryptenroll,dissect,id128,sysext},\
|
||||||
{bus,boot,coredump,locale,login,machine,network,hostname,timedate,userdb,home,oom,portable}ctl}
|
{bus,boot,coredump,locale,login,machine,network,hostname,timedate,userdb,home,oom,portable}ctl,zoxide}
|
||||||
}
|
}
|
||||||
|
|
||||||
# vim: set ft=sh ts=4 sw=4 et:
|
# vim: set ft=sh ts=4 sw=4 et:
|
||||||
|
|
|
@ -83,7 +83,7 @@ _task() {
|
||||||
#shellcheck disable=SC2164
|
#shellcheck disable=SC2164
|
||||||
cd /sysroot
|
cd /sysroot
|
||||||
# fastest uncompression of zstd cpio format
|
# fastest uncompression of zstd cpio format
|
||||||
bsdcpio -i -d -u <"/mnt/efi/boot/initrd-${_ARCH}.img" &>/dev/null
|
3cpio -x "/mnt/efi/boot/initrd-${_ARCH}.img" &>/dev/null
|
||||||
rm -r sysroot
|
rm -r sysroot
|
||||||
rm init
|
rm init
|
||||||
fi
|
fi
|
||||||
|
|
|
@ -17,7 +17,7 @@
|
||||||
<h1>Archboot Home | <a href="https://archboot.com/gallery.html">Gallery</a> | <a href="https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=Z7GXKW4MKHK7C"><img src="donate.png" alt="Donate"></a></h1>
|
<h1>Archboot Home | <a href="https://archboot.com/gallery.html">Gallery</a> | <a href="https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=Z7GXKW4MKHK7C"><img src="donate.png" alt="Donate"></a></h1>
|
||||||
<h2>2024 Fundraise: 0% <progress max="100" value="38">0%</progress> 100%</h2>
|
<h2>2024 Fundraise: 0% <progress max="100" value="38">0%</progress> 100%</h2>
|
||||||
<p><strong>© 2006 - 2024 | <a href=mailto:tpowa@archlinux.org>Tobias Powalowski</a></strong> | Arch Linux Developer <strong><a href="https://archlinux.org/people/developers/#tpowa">tpowa</a></strong><br>
|
<p><strong>© 2006 - 2024 | <a href=mailto:tpowa@archlinux.org>Tobias Powalowski</a></strong> | Arch Linux Developer <strong><a href="https://archlinux.org/people/developers/#tpowa">tpowa</a></strong><br>
|
||||||
<strong>Last update: 10.07.2024 12:06</strong></p>
|
<strong>Last update: 14.07.2024 22:26</strong></p>
|
||||||
<nav id="TOC" role="doc-toc">
|
<nav id="TOC" role="doc-toc">
|
||||||
<ul>
|
<ul>
|
||||||
<li><a href="#introduction" id="toc-introduction"><strong><span class="toc-section-number">1.</span> Introduction</strong></a></li>
|
<li><a href="#introduction" id="toc-introduction"><strong><span class="toc-section-number">1.</span> Introduction</strong></a></li>
|
||||||
|
@ -1318,7 +1318,7 @@ Functions supported in <strong>/usr/lib/archboot/cpio/hooks/<hook></strong
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
<tr class="odd">
|
<tr class="odd">
|
||||||
<td><code>$ qemu-system-x86_64 -drive file=<isofile>,if=virtio,format=raw \<br>-usb -usbdevice tablet --enable-kvm -boot d \<br>-drive if=pflash,format=raw,readonly=on,\<br>file=/usr/share/ovmf/x64/OVMF_CODE.secboot.fd \<br>-drive if=pflash,format=raw,file=OVMF_VARS.secboot.fd \<br>-global driver=cfi.pflash01,property=secure,value=on \<br>-machine q35,smm=on,accel=kvm \<br>-global ICH9-LPC.disable_s3=1 -m <memory></code></td>
|
<td><code>$ qemu-system-x86_64 -drive file=<isofile>,if=virtio,format=raw \<br>-usb -usbdevice tablet --enable-kvm -boot d \<br>-drive if=pflash,format=raw,readonly=on,\<br>file=/usr/share/archboot/ovmf/OVMF_CODE.secboot_x64.fd \<br>-drive if=pflash,format=raw,file=OVMF_VARS.secboot.fd \<br>-global driver=cfi.pflash01,property=secure,value=on \<br>-machine q35,smm=on,accel=kvm \<br>-global ICH9-LPC.disable_s3=1 -m <memory></code></td>
|
||||||
</tr>
|
</tr>
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
|
@ -1330,7 +1330,7 @@ Functions supported in <strong>/usr/lib/archboot/cpio/hooks/<hook></strong
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
<tr class="odd">
|
<tr class="odd">
|
||||||
<td><code>$ qemu-system-x86_64 -drive file=<isofile>,if=virtio,format=raw \<br>-usb -usbdevice tablet --enable-kvm -boot d \<br>-drive if=pflash,format=raw,readonly=on,\<br>file=/usr/share/ovmf/ia32/OVMF_CODE.secboot.fd \<br>-drive if=pflash,format=raw,file=OVMF_VARS.secboot.fd \<br>-global driver=cfi.pflash01,property=secure,value=on \<br>-machine q35,smm=on,accel=kvm \<br>-global ICH9-LPC.disable_s3=1 -m <memory> </code></td>
|
<td><code>$ qemu-system-x86_64 -drive file=<isofile>,if=virtio,format=raw \<br>-usb -usbdevice tablet --enable-kvm -boot d \<br>-drive if=pflash,format=raw,readonly=on,\<br>file=/usr/share/archboot/ovmf/OVMF_CODE.secboot_ia32.fd \<br>-drive if=pflash,format=raw,file=OVMF_VARS.secboot.fd \<br>-global driver=cfi.pflash01,property=secure,value=on \<br>-machine q35,smm=on,accel=kvm \<br>-global ICH9-LPC.disable_s3=1 -m <memory> </code></td>
|
||||||
</tr>
|
</tr>
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
|
|
Loading…
Reference in a new issue