GithubHelp home page GithubHelp logo

ivandavidov / minimal-linux-script Goto Github PK

View Code? Open in Web Editor NEW
219.0 18.0 70.0 51 KB

One script which generates live Linux ISO image with minimal effort. Based on the first published version of Minimal Linux Live: http://github.com/ivandavidov/minimal

License: GNU General Public License v3.0

Shell 100.00%
linux linux-kernel shell shell-scripts operating-system minimal

minimal-linux-script's Introduction

Minimal Linux Script

One script which generates fully functional live Linux ISO image with minimal effort. This is based on the first published version of Minimal Linux Live with some improvements taken from the next releases. All empty lines and comments have been removed and the script has been modified to reduce the overall length.

The script below uses Linux kernel 4.19.12, BusyBox 1.29.3 and Syslinux 6.03. The source bundles are downloaded and compiled automatically. If you are using Ubuntu or Linux Mint, you should be able to resolve all build dependencies by executing the following command:

sudo apt install wget make gawk gcc bc bison flex xorriso libelf-dev libssl-dev

After that simply run the below script. It doesn't require root privileges. In the end you should have a bootable ISO image named minimal_linux_live.iso in the same directory where you executed the script.

wget http://kernel.org/pub/linux/kernel/v4.x/linux-4.19.12.tar.xz
wget http://busybox.net/downloads/busybox-1.29.3.tar.bz2
wget http://kernel.org/pub/linux/utils/boot/syslinux/syslinux-6.03.tar.xz
mkdir isoimage
tar -xvf linux-4.19.12.tar.xz
tar -xvf busybox-1.29.3.tar.bz2
tar -xvf syslinux-6.03.tar.xz
cd busybox-1.29.3
make distclean defconfig
sed -i "s|.*CONFIG_STATIC.*|CONFIG_STATIC=y|" .config
make busybox install
cd _install
rm -f linuxrc
mkdir dev proc sys
echo '#!/bin/sh' > init
echo 'dmesg -n 1' >> init
echo 'mount -t devtmpfs none /dev' >> init
echo 'mount -t proc none /proc' >> init
echo 'mount -t sysfs none /sys' >> init
echo 'setsid cttyhack /bin/sh' >> init
chmod +x init
find . | cpio -R root:root -H newc -o | gzip > ../../isoimage/rootfs.gz
cd ../../linux-4.19.12
make mrproper defconfig bzImage
cp arch/x86/boot/bzImage ../isoimage/kernel.gz
cd ../isoimage
cp ../syslinux-6.03/bios/core/isolinux.bin .
cp ../syslinux-6.03/bios/com32/elflink/ldlinux/ldlinux.c32 .
echo 'default kernel.gz initrd=rootfs.gz' > ./isolinux.cfg
xorriso \
    -as mkisofs \
    -o ../minimal_linux_live.iso \
    -b isolinux.bin \
    -c boot.cat \
    -no-emul-boot \
    -boot-load-size 4 \
    -boot-info-table \
    ./
cd ..

Note that this script produces very small live Linux OS with working shell only and no network support. The network functionality has been implemented properly in the Minimal Linux Live project which is extensively documented and more feature rich, yet still produces very small live Linux ISO image.

minimal-linux-script's People

Contributors

antoniusmisfit avatar awlsomealex avatar ivandavidov avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

minimal-linux-script's Issues

[QUESTION] Installing apps

How I can install more apps? I want mount USB and SD Card Reader. I wish get there mysql, openssl, samba and more what I need. What about browsers?

no grub

error seems to be in this section? total grub failure
In file included from scripts/selinux/genheaders/genheaders.c:19:
./security/selinux/include/classmap.h:249:2: error: #error New address family defined, please update secclass_map.
249 | #error New address family defined, please update secclass_map.
| ^~~~~
make[4]: *** [scripts/Makefile.host:90: scripts/selinux/genheaders/genheaders] Error 1
make[3]: *** [scripts/Makefile.build:544: scripts/selinux/genheaders] Error 2
make[2]: *** [scripts/Makefile.build:544: scripts/selinux] Error 2
make[1]: *** [Makefile:1067: scripts] Error 2
make: *** [Makefile:286: __build_one_by_one] Error 2
cp: cannot stat 'arch/x86/boot/bzImage': No such file or directory

(Question) Regarding linuxrc

Hello,
What is linuxrc, why do you delete it and is it possible to build the MLS without removing it?
Best regards,
Ben.

Compile kernel and rootfs in xz format

Hi, I'm trying to create a bootable usb using your systemd-boot configuration. The problem is that it requires the kernel and rootfs to be in xz format and not in gz, while this script compiles them in xz. How can I edit the script to obtain "kernel.xz" and "rootfs.xz" instead of gz format?

NCurses programs?

Hi again. So this time I was coding a really simple NCurses program:

#include <ncurses.h>

int main() {
	initscr();
	printw("hit a key: ");
	getch();
	return endwin();
}

I compile this with g++ test.cpp -o test -static -lncurses -ltinfo, and gives no errors.

Then, I run it on my machine, and works like a charm.

The thing is that when I copy the binary into the filesystem of the OS, when I run it from a VM, it prints: Error opening terminal: linux. So I'm guessing there's something missing, but I haven't been able to figure out what.

Ideas?

nano missing dependencies?

so i tried to build the latest commit with just ncurses and nano.
however, when i try to run nano the following happens.

emupng

it complains about missing a lib,, and when i check the /lib folder, it does
the only thing i changed was that i added ncurses and nano as overlay packages
config
i tried adding glibc_full to see if it would help but it didn't
besides in the documentation it states that it should automatically add dependencies.
so i think i might have found, a bug related to one of the dependencies.
correct me if i'm wrong of course, i'm still pretty new to this low level stuff.

(Question) Is it possible to make a bootable USB?

Hello,
Sorry if this is a stupid question. This is my first time looking at building Linux at all. As far as I read about syslinux bootloader, it seems that it's possible to make a bootable USB with the help of dd. Can you clarify whether that works, if you have tested that. Currently my goal is to build the most minimal Linux kernel based OS that could run from a bootable USB for learning purposes.
Best regards,
Ben.

Fails to build

Building is giving me this error from sccript lline 12>


  • mkdir isoimage
  • cd busybox-1.30.1
  • make distclean defconfig
    make[1]: *** No rule to make target '/file/projects/minimal/minimal-linux-script-master/busybox-1.30.1/Makefile.local'. Stop.
    make[1]: Nothing to be done for '/file/projects/minimal/minimal-linux-script-master/busybox-1.30.1/Makefile.custom'.
    make[1]: Nothing to be done for '/file/projects/minimal/minimal-linux-script-master/busybox-1.30.1/scripts/Kbuild.include'.
    make[1]: Nothing to be done for 'Makefile'.
    HOSTCC scripts/basic/fixdep
    HOSTCC scripts/basic/split-include
    scripts/basic/split-include.c: In function ‘main’:
    scripts/basic/split-include.c:134:6: warning: ignoring return value of ‘fgets’, declared with attribute warn_unused_result [-Wunused-result]
    fgets(old_line, buffer_size, fp_target);
    ^
    HOSTCC scripts/basic/docproc
    GEN include/applets.h
    GEN include/usage.h
    GEN sysklogd/Kbuild
    GEN sysklogd/Config.in
    GEN klibc-utils/Kbuild
    GEN klibc-utils/Config.in
    GEN libpwdgrp/Kbuild
    GEN shell/Kbuild
    GEN shell/Config.in
    GEN libbb/Kbuild
    GEN libbb/Config.in
    GEN e2fsprogs/Kbuild
    GEN e2fsprogs/Config.in
    GEN util-linux/Kbuild
    GEN util-linux/Config.in
    GEN util-linux/volume_id/Kbuild
    GEN util-linux/volume_id/Config.in
    GEN init/Kbuild
    GEN init/Config.in
    GEN coreutils/Kbuild
    GEN coreutils/Config.in
    GEN coreutils/libcoreutils/Kbuild
    GEN mailutils/Kbuild
    GEN mailutils/Config.in
    GEN procps/Kbuild
    GEN procps/Config.in
    GEN selinux/Kbuild
    GEN selinux/Config.in
    GEN printutils/Kbuild
    GEN printutils/Config.in
    GEN debianutils/Kbuild
    GEN debianutils/Config.in
    GEN applets/Kbuild
    GEN archival/Kbuild
    GEN archival/Config.in
    GEN archival/libarchive/Kbuild
    GEN console-tools/Kbuild
    GEN console-tools/Config.in
    GEN loginutils/Kbuild
    GEN loginutils/Config.in
    GEN editors/Kbuild
    GEN editors/Config.in
    GEN modutils/Kbuild
    GEN modutils/Config.in
    GEN findutils/Kbuild
    GEN findutils/Config.in
    GEN runit/Kbuild
    GEN runit/Config.in
    GEN miscutils/Kbuild
    GEN miscutils/Config.in
    GEN networking/Kbuild
    GEN networking/Config.in
    GEN networking/udhcp/Kbuild
    GEN networking/udhcp/Config.in
    GEN networking/libiproute/Kbuild
    GEN scripts/Kbuild
    HOSTCC scripts/kconfig/conf.o
    scripts/kconfig/conf.c: In function ‘conf_askvalue’:
    scripts/kconfig/conf.c:145:3: warning: ignoring return value of ‘fgets’, declared with attribute warn_unused_result [-Wunused-result]
    fgets(line, 128, stdin);
    ^
    scripts/kconfig/conf.c: In function ‘conf_choice’:
    scripts/kconfig/conf.c:393:4: warning: ignoring return value of ‘fgets’, declared with attribute warn_unused_result [-Wunused-result]
    fgets(line, 128, stdin);
    ^
    HOSTCC scripts/kconfig/kxgettext.o
    HOSTCC scripts/kconfig/mconf.o
    scripts/kconfig/mconf.c: In function ‘exec_conf’:
    scripts/kconfig/mconf.c:503:18: error: ‘EINTR’ undeclared (first use in this function)
    if (errno == EINTR || errno == EAGAIN)
    ^
    scripts/kconfig/mconf.c:503:18: note: each undeclared identifier is reported only once for each function it appears in
    scripts/kconfig/mconf.c:503:36: error: ‘EAGAIN’ undeclared (first use in this function)
    if (errno == EINTR || errno == EAGAIN)
    ^
    scripts/kconfig/mconf.c: In function ‘show_textbox’:
    scripts/kconfig/mconf.c:851:2: warning: ignoring return value of ‘write’, declared with attribute warn_unused_result [-Wunused-result]
    write(fd, text, strlen(text));
    ^
    scripts/kconfig/mconf.c: In function ‘exec_conf’:
    scripts/kconfig/mconf.c:485:2: warning: ignoring return value of ‘pipe’, declared with attribute warn_unused_result [-Wunused-result]
    pipe(pipefd);
    ^
    scripts/Makefile.host:120: recipe for target 'scripts/kconfig/mconf.o' failed
    make[2]: *** [scripts/kconfig/mconf.o] Error 1
    Makefile:443: recipe for target 'defconfig' failed
    make[1]: *** [defconfig] Error 2
    Makefile:423: recipe for target 'defconfig' failed
    make: *** [defconfig] Error 2


Any ideas? I was planning on a toybox instead of busybox version, but that won't pass this problem either.

thanks

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.