diff --git a/README.md b/README.md index 71d1388..0d59d3e 100644 --- a/README.md +++ b/README.md @@ -1,26 +1,25 @@ # Yosild - Your simple Linux distro Yosild is a single shell script that builds a full, minimal Linux distribution, -based on BusyBox. It compiles the **latest stable kernel** (5.16.1) and the -**latest stable version of the BusyBox** (1.34.1). This script can prepare +based on BusyBox. It compiles the **stable kernel** 5.16.19 and the +**latest stable version of the BusyBox** 1.34.1. This script can prepare minimalistic Linux system for devices with little hardware resources. Yosild Linux -needs just **64 MB RAM** and **36 MB storage size**. *yosild.sh* requires +needs just **70 MB RAM** and **40 MB storage size**. *yosild.sh* requires [minimal][1] *Debian* or *Ubuntu* distro to run with the architecture compatible with the target device. -The script works with VirtualBox or KVM/QEMU (all drive types except VirtIO) - you -can create an additional virtual hard drive and install Yosild Linux on it, and -then connect this virtual disk to a new virtual machine - just like in my -[YouTube video][3]: +The script works with VirtualBox, Hyper-V and KVM/QEMU (all drive types except +VirtIO) - you can create an additional virtual hard drive and install Yosild Linux +on it, and then connect this virtual disk to a new virtual machine - just like in +my [YouTube video][3]:

Yosild creates probably the simplest, complete version of Linux, which makes it -easier to understand, how to build the system from scratch. It is much easier to -build than other, previously available solutions: Aboriginal, mkroot, Buildroot or -Linux From Scratch - just specify the target drive (virtual or flash drive) inside -the *yosild.sh* script and simply run the script. You can also rename the system -to make it your distribution. - +easier to understand, how to build the system from scratch and how to use it. +Yosild is much easier to build than other, previously available solutions: +Aboriginal, mkroot, Buildroot or Linux From Scratch. Just specify the target +drive (virtual or flash drive) inside the *yosild.sh* script and simply run the +script. You can also rename the system to make it your distribution. **Yosild**: @@ -46,6 +45,13 @@ Yosild is licensed under GNU General Public License v3.0. For more information please visit my website: [https://jm.iq.pl/yosild][2] +### Support + +You can transfer any funds you wish to my +*[PayPal account](https://www.paypal.com/paypalme/jaromaz)* if you want to +support this project. + + [1]: https://www.debian.org/CD/netinst/ [2]: https://jm.iq.pl/yosild [3]: https://www.youtube.com/watch?v=BPXxPZBBeJ0 diff --git a/yosild.sh b/yosild.sh index 25aa748..bea4572 100755 --- a/yosild.sh +++ b/yosild.sh @@ -1,7 +1,7 @@ #!/bin/sh - # --------------------------------------- -# Yosild 3.1.5 - Your simple Linux distro +# Yosild - Your simple Linux distro + version="3.2.1" # (c) Jaromaz https://jm.iq.pl # Yosild is licensed under # GNU General Public License v3.0 @@ -11,10 +11,10 @@ device="sdc" distro_name="Yosild" distro_desc="Your simple Linux distro" -distro_version="3.1.5" distro_codename="chinchilla" -telnetd="true" -kernel="https://cdn.kernel.org/pub/linux/kernel/v5.x/linux-5.16.1.tar.xz" +telnetd_enabled="true" +hyperv_support="false" +kernel="https://cdn.kernel.org/pub/linux/kernel/v5.x/linux-5.16.19.tar.xz" busybox="https://busybox.net/downloads/busybox-1.34.1.tar.bz2" # --------------------------------------- @@ -56,11 +56,11 @@ if [ $answer != "y" ] ; then cd busybox make defconfig - # BusyBox configuration ------ + # BusyBox configuration -------------------------------- sed 's/^.*CONFIG_STATIC.*$/CONFIG_STATIC=y/' -i .config sed 's/^CONFIG_MAN=y/CONFIG_MAN=n/' -i .config echo "CONFIG_STATIC_LIBGCC=y" >> .config - + # ------------------------------------------------------ make cd ../../ fi @@ -98,12 +98,21 @@ if [ $answer != "y" ] ; then rm linux-*.tar.xz mv linux* linux cd linux - make defconfig - # Linux Kernel configuration ----- - sed "s/Debian/$distro_name/" -i .config - # -------------------------------- +# Linux Kernel config -------------------------------------- +if [ "$hyperv_support" = "true" ]; then +cat <> arch/x86/configs/x86_64_defconfig +CONFIG_HYPERVISOR_GUEST=y +CONFIG_PARAVIRT=y +CONFIG_CONNECTOR=y +CONFIG_HYPERV=y +CONFIG_HYPERV_NET=y +EOF +fi +# ---------------------------------------------------------- + + make defconfig make cd ../../ fi @@ -158,7 +167,7 @@ cat << EOF > var/www/html/index.html $distro_name httpd default page: It works

It works!


-

$distro_name httpd default page
ver. $distro_version

+

$distro_name httpd default page
ver. $version

EOF # fstab @@ -172,16 +181,18 @@ export PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin export PS1="\\e[0;32m\\u@\\h:\\w\\\$ \\e[m" [ \$(id -u) -eq 0 ] && export PS1="\\u@\\h:\\w# " alias vim=vi -alias su="su -l" -alias exit="clear;exit" -alias logout="clear;logout" +alias l.='ls -d .*' +alias ll='ls -Al' +alias su='su -l' +alias logout='clear;exit' +alias exit='clear;exit' alias locate=which alias whereis=which -alias logout=exit +alias useradd=adduser EOF # banner -printf "\n\e[96m${*}$distro_name\e[0m${*} Linux \e[97m${*}$distro_version\e[0m${*} - $distro_desc\n\n" | tee -a etc/issue usr/share/infoban >/dev/null +printf "\n\e[96m${*}$distro_name\e[0m${*} Linux \e[97m${*}$version\e[0m${*} - $distro_desc\n\n" | tee -a etc/issue usr/share/infoban >/dev/null cat << EOF >> etc/issue * Default root password: Yosild * Networking: ifupdown @@ -203,8 +214,8 @@ EOF cat << EOF > etc/os-release PRETTY_NAME="$distro_name - $distro_desc ($distro_codename)" NAME="$distro_name" -VERSION_ID="$distro_version" -VERSION="$distro_version" +VERSION_ID="$version" +VERSION="$version" VERSION_CODENAME="$distro_codename" ID="$distro_name" HOME_URL="https://github.com/jaromaz/yosild" @@ -316,11 +327,11 @@ cat << EOF > var/spool/cron/crontabs/root EOF # logrotate -cat << EOF > etc/cron/daily/logrotate +cat << EOF > usr/sbin/logrotate #!/bin/sh maxsize=512 dir=/var/log -for log in messages lastlog; do +for log in \$(ls -1 \${dir} | grep -Ev '\.gz$'); do size=\$(du "\$dir/\$log" | tr -s '\t' ' ' | cut -d' ' -f1) if [ "\$size" -gt "\$maxsize" ] ; then tsp=\$(date +%s) @@ -330,6 +341,7 @@ for log in messages lastlog; do fi done EOF +ln -s ../../../usr/sbin/logrotate etc/cron/daily/logrotate # init scripts installer cat << EOF > usr/bin/add-rc.d @@ -381,7 +393,7 @@ PIDFILE=/var/run/$1.pid init \$@ EOF chmod 744 etc/init.d/$1 -[ $1 = 'telnetd' ] && [ "$telnetd" = false ] && continue; +[ $1 = 'telnetd' ] && [ "$telnetd_enabled" = false ] && continue; [ "$3" ] && ln -s ../init.d/$1 etc/rc.d/$3$1.sh done @@ -424,7 +436,7 @@ chmod 664 var/log/lastlog var/log/wtmp chmod 4755 bin/busybox chmod 600 var/spool/cron/crontabs/root chmod 755 usr/sbin/nologin sbin/disban init sbin/man etc/init.d/rcS\ - etc/cron/daily/logrotate usr/bin/add-rc.d sbin/halt\ + usr/sbin/logrotate usr/bin/add-rc.d sbin/halt\ usr/share/udhcpc/default.script chmod 644 etc/passwd etc/group etc/hostname etc/shells etc/hosts etc/fstab\ etc/issue etc/motd etc/network/interfaces etc/profile