updated mkinitramfs.sh and lsinitramfs

This commit is contained in:
wt committed 2025-01-09 12:09:02 +07:00
1 parent 55b0c4149e
commit 1cede8e014
2 files changed
+5 -4

No files matched your search

+1 -1
View File
@@ -4,7 +4,7 @@
[ "$1" ] || exit 1 [ "$1" ] || exit 1
case $INITFSCOMP in case $INITRAMFSCOMP in
gzip) compressor="gzip -dc" ;; gzip) compressor="gzip -dc" ;;
lz4) compressor="lz4 -d -c" ;; lz4) compressor="lz4 -d -c" ;;
cat) compressor="cat --" ;; cat) compressor="cat --" ;;
+4 -3
View File
@@ -1,21 +1,22 @@
#!/bin/bash #!/bin/bash
export PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin export PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin
initdir=./initramfs initdir=$(pwd)/initramfs
create_dirs() { create_dirs() {
mkdir -pv $initdir/{bin,dev,mnt,proc,root,sys,run} mkdir -pv $initdir/{bin,dev,mnt,proc,root,sys,run}
} }
main() { main() {
CPIO=$(command -v cpio)
create_dirs create_dirs
cp -v /usr/share/mkinitramfs/init.in $initdir/init cp -v /usr/share/mkinitramfs/init.in $initdir/init
chmod 755 $initdir/init chmod 755 $initdir/init
cp -v /usr/share/mkinitramfs/busybox $initdir/bin/busybox cp -v /usr/share/mkinitramfs/busybox $initdir/bin/busybox
cd $initdir/bin cd $initdir/bin
for i in $(cat /usr/share/mkinitramfs/busybox_list);do ln -sv busybox $i;done for i in $(cat /usr/share/mkinitramfs/busybox_list);do ln -sv busybox $i;done
cd .. cd $initdir
find . | cpio -H newc -o | gzip > ../initramfs.img find . | $CPIO -H newc -o | gzip > ../initramfs.img
cd .. cd ..
rm -rv $initdir rm -rv $initdir
} }