Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- start=$PWD
- initramfs=${start}/initramfs
- ARCH="x86_64"
- ARCH2="x86"
- linux="linux-6.0"
- lv="$(echo $linux|cut -d\- -f2|cut -d\. -f1)"
- mkdir $initramfs
- cd $initramfs
- mkdir -pv bin lib dev etc mnt/root proc root sbin sys
- mknod -m 666 dev/null c 1 3
- mknod -m 666 dev/tty c 5 0
- mknod -m 666 dev/zero c 1 5
- mknod -m 666 dev/random c 1 8
- echo "nameserver 8.8.8.8" > etc/resolv.conf
- echo "search 8.8.8.8" >> etc/resolv.conf
- #Create INIT startup script
- cat << EOS > init
- #!/bin/sh
- mknod -m 666 dev/null c 1 3
- mknod -m 666 dev/tty c 5 0
- mknod -m 666 dev/zero c 1 5
- mknod -m 666 dev/random c 1 8
- /bin/mount -t proc none /proc
- /bin/mount -t sysfs sysfs /sys
- cat <<'EOF'
- __ __ _ _ _ _
- | \/ (_)_ __ (_) | | (_)_ __ _ ___ __
- | |\/| | | '_ \| | | | | | '_ \| | | \ \/ /
- | | | | | | | | | | |___| | | | | |_| |> <
- |_| |_|_|_| |_|_| |_____|_|_| |_|\__,_/_/\_\
- EOF
- echo 'Enjoy your new mini system!'
- /bin/sh
- EOS
- chmod 755 init
- cd bin
- wget -c "https://busybox.net/downloads/binaries/1.35.0-x86_64-linux-musl/busybox" -O busybox
- chmod +x busybox
- ./busybox --help | \
- sed -e '1,/^Currently defined functions:/d' \
- -e 's/[ \t]//g' -e 's/,$//' -e 's/,/\n/g' | \
- while read app ; do
- if [ "$app" != "" ]; then
- echo "linking ${app}..."
- ln -sf "./busybox" "$app"
- ls -ld "$app"
- fi
- done
- cd $initramfs
- find . -print0 | cpio --null -ov --format=newc > ../initrd.cpio
- cd $start
- wget -c "https://www.kernel.org/pub/linux/kernel/v${lv}.x/${linux}.tar.xz"
- tar xf ${linux}.tar.xz
- cd ${linux}
- make allnoconfig
- #make menuconfig
- make
- cp arch/$ARCH2/boot/bzImage $start
- cd $start
- qemu-system-$ARCH -kernel bzImage -initrd initrd.cpio
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement