LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Mobile (http://www.linuxquestions.org/questions/linux-mobile-81/)
-   -   Minimal USB Linux Install (http://www.linuxquestions.org/questions/linux-mobile-81/minimal-usb-linux-install-4175481602/)

JoseCuervo 10-21-2013 10:59 AM

Minimal USB Linux Install
 
Hey guys, my ISY professor wants the smallest possible footprint on a USB possible, and the fastest possible time to a shell. It is sort of a contest for our class. I did a Kali build that booted very fast, and a DSL/knoppix build that was tiny, but he's not impressed. He said that I should be thinking kilobytes, not megabytes.

The requirements: I can use any resources I want. The USB needs to boot into a shell that has dd and vi available.

I've tried looking into LFS, core, and Arch, but I'm not quite sure how to customize or strip out parts that I don't need. I've also done extensive googling and searching on LQ. Does anyone have any experience with a mobile OS that loads almost nothing but init and bash?

rtmistler 10-21-2013 11:39 AM

Sounds like your professor covered how to change kernel options and compile the kernel. Instead of looking for "the one" distribution which has it done for you; you should start with a distribution that works for your architecture and customize it to remove all the non-essentials. I'd say look at the differences and similarities between the very fast one and the very small one and try to marry those together.

Note also that configuring the kernel sets up a bunch of code inclusion/exclusion flags affecting the amount of features compiled. But perhaps one can go further than the flags ...

Bear in mind that there are different variations of the shell, dd, and vi available in source form; hence you can rewrite them and discard portions which take up a lot of space. Bear further in mind that a command shell needs to support solely the necessary commands which here sound to be "dd" and "vi".

And this is clearly a case where you follow the mantra of The Commander (see below).

JoseCuervo 10-21-2013 12:01 PM

My professor covered no such thing! He's great though, he gives us something way over our head, and two weeks later we're confident on it.

Update: I have TinyCore installed in 9MBs, and boots (to a GUI!) in <4.5 seconds. I'm working on Core to a USB now, and I'm going to start stripping that down when I get it running. Thanks for the quick response!

TobiSGD 10-21-2013 02:23 PM

All you need is a kernel, a shell (Ash from Busybox should be fine) and copies of vi and dd (of course with the needed libraries). Assembling that is pretty easy, for example following this tutorial: http://doc.slitaz.org/en:scratchbook:start
I have made special purpose systems with about 5MB of size this way, but with using only the kernel drivers and Busybox modules you really need you might get that even smaller.

jheengut 10-21-2013 03:46 PM

asm. mikeos
 
go for http://[URL="http://asm.sourceforge.net/"]asm.sourceforge.net/[/URL] or mikeos http://mikeos.berlios.de

jefro 10-21-2013 08:37 PM

Tell him to get QNX. Full GUI on 1.44m floppy.
A bit of work and you can get menuetos on a usb in 1.38m. Plus syslinux.

I was thinking of what TobiSGD suggested. You build a custom kernel with the bare bones drivers for your system and some minimal cli. Since he didn't say you needed any apps, you don't need busybox.

Some of the newest compression can be used on a new kernel.

jamison20000e 10-21-2013 10:59 PM

I like this thread, plus. :)

JoseCuervo 10-22-2013 01:33 AM

Those are all interesting avenues, I'm definitely going to aim for the 1~2 Mb range now. I'm running the boot speed tests in VMWare Player, and I've been using a USB2.0 stick. I'll be moving the installs to a USB3.0 just in case it helps, though I doubt it, because the read speed on both is significantly higher than the size of these tiny operating systems. I'll post updates as I shrink the installs or run into problems. Thanks again guys!

pan64 10-22-2013 01:57 AM

probably not suitable for you but one floppy is enough: http://www.linuxlinks.com/Distributions/Floppy/ (a few of them may work with usb too).

rtmistler 10-22-2013 08:33 AM

Quote:

Originally Posted by jefro (Post 5050060)
Tell him to get QNX. Full GUI on 1.44m floppy.
A bit of work and you can get menuetos on a usb in 1.38m. Plus syslinux.

I was thinking of what TobiSGD suggested. You build a custom kernel with the bare bones drivers for your system and some minimal cli. Since he didn't say you needed any apps, you don't need busybox.

Some of the newest compression can be used on a new kernel.

I thought this was a school assignment, no GUI, boot the kernel as small and fast as possible; requires a command shell supporting dd and vi.

I would give the instructor a micro-micro kernel and a shell which couldn't even perform ls. You don't even need a frame buffer, let alone GUI! No network, no swap space. The fun part, and the assignment, is how minimal can you go, not how cool you can make it.

agentsteel 10-25-2013 05:26 AM

Quote:

Originally Posted by JoseCuervo (Post 5049683)
Hey guys, my ISY professor wants the smallest possible footprint on a USB possible, and the fastest possible time to a shell. It is sort of a contest for our class. I did a Kali build that booted very fast, and a DSL/knoppix build that was tiny, but he's not impressed. He said that I should be thinking kilobytes, not megabytes.

The requirements: I can use any resources I want. The USB needs to boot into a shell that has dd and vi available.

I've tried looking into LFS, core, and Arch, but I'm not quite sure how to customize or strip out parts that I don't need. I've also done extensive googling and searching on LQ. Does anyone have any experience with a mobile OS that loads almost nothing but init and bash?

With Buildroot you can generate a tiny Linux system (kernel + embedded initramfs), then just copy this kernel onto your usb drive and make it bootable :)

I did some tutos some time ago, they may still be relevant (Buildroot has evolved quite a bit since), see more here :
http://agentoss.wordpress.com/2011/0...ing-buildroot/

Pastychomper 10-25-2013 06:08 AM

This may be my ignorance talking, but I understand Grub includes (some?) filesystem access and normally loads Stage 2 from somewhere outside the MBR. What's to stop you building a custom Grub with some of the bootloading parts removed, and a minimal vi and dd to run from the Grub command line?

Failing that, how about a minimal Freedos with vi.exe and dd.exe?


All times are GMT -5. The time now is 04:21 PM.