LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Make a shell based live USB (https://www.linuxquestions.org/questions/linux-newbie-8/make-a-shell-based-live-usb-4175507764/)

siba2893 06-11-2014 03:32 PM

Make a shell based live USB
 
Hi Guys could anyone help me with some info of how to make my own distro, well I just need to make a live usb that executes the kernel and a shell with a Hello world message, all by hand, no easy programs. Any help with that?

szboardstretcher 06-11-2014 03:41 PM

I used to keep instructions on how to build the newest kernels/syslinux etc into a bootable embedded linux with busybox. But I've stopped doing it because it was time consuming. It was fun though, So I can empathize with why you would want to do this.

Here is a link to something called Slitaz which claims to let you do the same thing: http://www.slitaz.org/en/doc/scratchbook/ They are very similar,

There is a lot in this example that you can remove if you only want a shell to run and echo a string,.. but going through the entire process might be a great learning tool for you.

jefro 06-11-2014 04:06 PM

Kind of one step past JEOS, just enough operating system.

I might be tempted to take some installer that easily installs with no window manager. Maybe Debian. Then install that to the usb. Then start deleting almost everything. You will need some bare bones stuff.

Personally I might get a JEOS from somewhere, SuseStudio.com can make one. Still would be a lot more than what you'd need.

Once you get the basic OS on and shell support and maybe a few helper files you can execute some way to make this hello world.

The actual way you requested would be to use LFS. Not really worth the time. Guess you could use Gentoo to make a minimal install.

The good old day floppy distro's like that won't easily boot from usb. Might be able to use syslinux or grub to boot to them maybe.

szboardstretcher 06-12-2014 04:14 PM

Quote:

Originally Posted by jefro (Post 5186565)
The good old day floppy distro's like that won't easily boot from usb. Might be able to use syslinux or grub to boot to them maybe.

You could possibly get them to partially boot, but when the distro starts looking for programs/config on fd0 it will fail. Also, at some point the distro will lose access to the usb as older distros didn't have usb drivers -- especially if they were on floppies.

jlinkels 06-12-2014 06:05 PM

Check live.debian.net

Instructions on how to create your own live USB. Some pre-cooked versions are command line only and might provide a good starting point.

jlinkels

szboardstretcher 06-13-2014 09:20 AM

the 'lb' command really takes away from the experience of building your own distro from scratch though. it magically does most everything for you.

jefro 06-13-2014 05:44 PM

I know grub can boot floppy images from a hard drive. Not sure about the usb. Since one can get even dos to boot from usb, I'd think that an old linux might boot. I did state that there are easier ways.

DJ Shaji 06-14-2014 06:29 PM

Actually you can do that with just the kernel and grub. Put a kernel image and a statically linked busybox on a usb drive, install grub, and add a line as follows:

Code:

root (hd1,0)
    kernel=/<kernel image> root=/dev/sdb1 init="/busybox echo hellow world"

Booting the above will accomplish what you want. Although I don't know if init= accepts the argument that I've written here, and because after doing this the kernel will panic because our "init" would exit, it is better to make a small script that would call busybox as echo first and then sleep indefinitely.

EDIT: Also the above assumes grub 0.99 and that the usb drive is the second disk on the system (the local hard disk being the first). Either use values that correspond to your setup or just use UUIDs

jefro 06-14-2014 07:11 PM

I'd guess that LFS (linux from scratch) could be used to create the most minimal and one could only add in drivers needed for target hardware.



Think you'd at least need some version of busybox to add in some useful tools maybe.

http://ttylinux.net/


http://superuser.com/questions/30708...sybox-and-bash


All times are GMT -5. The time now is 01:06 AM.