ryao
Posts: 24
Joined: Sun Sep 11, 2011 3:47 am

Re: Smallest Linux Install

Fri Nov 25, 2011 10:01 pm

Quote from AlanCox on November 10, 2011, 20:28
About the absolute minimum is busybox + kernel + ucLibc Pre-seed the kernel with device nodes or include devtmpfs. That will get you enough to actually bootstrap a lot of projects and stuff. It'll also build with a full glibc if you want to be able to drop on fullblown apps without mucking about.

There are plenty of embedded devices whose environment is essentially busybox + scripts + specific app (sometimes + an ssh daemon) and they are actually not unpleasant to hack on.In fact functionally they are probably better shell and scripting wise than many older Unixen !

Getting a bit bigger as well as buildroot you may want to look at Yocto which can be used to build embedded environments to a recipe and without sucking in all the usual junk of a random desktop OS. That really helps once you get a few dependancies and security updates and the like to juggle.


The absolute minimum would be the kernel and a bootloader. The kernel has its own commandline for recovery purposes. It would not be good for much without a userland, but it would work.

Quote from mung on November 18, 2011, 18:03
To compile something for the Pi you will need a toolchain to compile for arm.

I would like to add that you can obtain a Gentoo toolchain if you do a Gentoo Prefix installation, install crossdev inside it and then tell crossdev to build the toolchain you want. Gentoo's toolchain is well maintained, so it is probably a good one to use.

User avatar
psergiu
Posts: 224
Joined: Mon Nov 07, 2011 8:36 am
Location: TX, U.S.A. (was: RO, E.U.)
Contact: Website

Re: Smallest Linux Install

Sun Nov 27, 2011 10:50 pm

Or you can do it like this:

1) Install a full ARM distro on a large SD
2) Connect the 2nd small SD to a USB reader
3) Create all the required filesystems and dirs on the small SD (RPi msdos partition with "The Blob", ext3 partition (ex: mount in /mnt/small) with /etc, /bin, /sbin, /lib, /tmp
4) Use MAKEDEV in the /dev of the small SD (/mnt/small/dev/)
5) Copy the kernel, /lib/modules/... /sbin/init /etc/passwd /etc/fstab /etc/group /etc/inittab (edited accordingly to fsck & mount / rw, mount /dev & all special FSs and start a single login prompt ) /sbin/getty /sbin/login /bin/mount /bin/umount /bin/sync /sbin/reboot /sbin/fsck /bin/sync /bin/sh /bin/ls /bin/cat ...
6) Use "ldd" on all the binaries and copy all the required libs too
7) "man" all the binaries and copy all the required config & additional files
8 ) Check permissions on the new files (suid bits & co)
9) Shutdown and boot from the small card.
10) See if you're happy
11) Shutdown and boot from the large card, add some more stuff ( insmod, more, ae or nano or other small editor, ifconfig, route, dropbear ... ) and GOTO step 8 untill you're happy.
12) If you get a stable standalone config, you can start making it smaller: put busybox and try switching everything to it - deleting the old binaries & related libs & files, remove unused dev files from /dev ...

sylvan
Posts: 118
Joined: Sun Nov 27, 2011 8:39 pm

Re: Smallest Linux Install

Tue Nov 29, 2011 9:44 pm

Quote from ryao on November 25, 2011, 22:01
The absolute minimum would be the kernel and a bootloader. The kernel has its own commandline for recovery purposes.

You should check that again.

(And while you're at it, notice who you were correcting.)

I've never seen any commandline code in the kernel before or after building. Perhaps you were thinking of the initrd or initram image.

As for a bootloader, the kernel used to, looks like it still is x86 bootable. ('file' still identifies the kernel on my x86 and amd64 ubuntu systems as an x86 boot image)

Therefore on an x86 PC the absolute minimum is a kernel and some executable application because it will use the bootloader in the BIOS.

On R-Pi (and most embedded platforms) the application is still needed but a bootloader is a design decision. The kernel might be installed to "execute in place" (XIP) and so not need a bootloader. Or some bootloader might be the XIP image.

eric_baird
Posts: 37
Joined: Sun Dec 04, 2011 3:42 pm
Contact: Website

Re: Smallest Linux Install

Sun Dec 04, 2011 4:03 pm

Perhaps when people have this running, it might be nice to have distros already set up for a few common applications of the board.
The two main uses I can think of so far are:

1: Wireless network storage.
* RPi & wifi dongle, plus 2.5" USB harddrive(s).
IMO It's slightly odd that there aren't more hard drives sold with wifi, it'd be cool to clip an RPi to a pocketable HD and turn it into a networked wifi drive. That'd be useful to me immediately.

2: Wifi webcam
* RPi & wifi dongle & USB webcam
This might be a big application for the board (eg video entry systems), but would need rather more software than (1), because it'd need to stream video.

I'm currently pondering the feasibility of sticking an RPi in a "gauge 0" model railway wagon with webcam and wifi dongle and giving a large model railway layout a live video feed from inside the train. :)

User avatar
OMightyBuggy
Posts: 21
Joined: Wed Jan 25, 2012 6:52 pm
Location: Mesa, AZ

Re: Smallest Linux Install

Sat May 10, 2014 8:56 am

Is there any Linux distro that can fit on a 16MB SD card? 16MB or less?

User avatar
DougieLawson
Posts: 39900
Joined: Sun Jun 16, 2013 11:19 pm
Location: A small cave in deepest darkest Basingstoke, UK
Contact: Website Twitter

Re: Smallest Linux Install

Sat May 10, 2014 9:19 am

OMightyBuggy wrote:Is there any Linux distro that can fit on a 16MB SD card? 16MB or less?
For X86 there was Toms Root Boot floppy (less than 2.88MB) but nobody has built anything like that for a RPi.

You can save lots of space by ditching kernel modules that you won't ever use. You can trim the kernel by not configuring things you don't need.

Busybox is the shell/toolkit needed for userspace operations.

Best of luck with building that.

Remember you've got a whole SDCard to play on because you can't boot your RPi without one. So trimming to the bone is pointless.
Note: Any requirement to use a crystal ball or mind reading will result in me ignoring your question.

Criticising any questions is banned on this forum.

Any DMs sent on Twitter will be answered next month.
All fake doctors are on my foes list.

Joe Schmoe
Posts: 4277
Joined: Sun Jan 15, 2012 1:11 pm

Re: Smallest Linux Install

Sat May 10, 2014 9:33 am

Of course, if the SD card is only 16Mb total (as is the case here), then having the "entire SD card to use" isn't saying that much.
And some folks need to stop being fanboys and see the forest behind the trees.

(One of the best lines I've seen on this board lately)

mikerr
Posts: 2826
Joined: Thu Jan 12, 2012 12:46 pm
Location: UK
Contact: Website

Re: Smallest Linux Install

Sat May 10, 2014 9:54 am

OMightyBuggy wrote:Is there any Linux distro that can fit on a 16MB SD card? 16MB or less?
Not quite what you're asking, but you can run raspbian with a 16MB SD card if you use USB root to hold the rest ;)
(the fat32 partition files are under 16MB)

Check out this thread for a small raspbian, but that needs a 256mb card
http://www.raspberrypi.org/forums/viewt ... 63&t=47634
if you want to keep apt-get and other niceties, it seems 1GB is about as low as you go.


For smallest linux, look at picore, a version of tinycore for the pi:
http://forum.tinycorelinux.net/index.ph ... 937.0.html
CLi version is fully functional with 21mb of files.
Android app - Raspi Card Imager - download and image SD cards - No PC required !

User avatar
pluggy
Posts: 3635
Joined: Thu May 31, 2012 3:52 pm
Location: Barnoldswick, Lancashire,UK
Contact: Website

Re: Smallest Linux Install

Sat May 10, 2014 2:38 pm

I think the need for a Linux to run on an SD card you found in an ancient digital camera at the back of a drawer are fairly limited. Get you hand down and buy an 8GB one, its not like they're expensive.

http://swag.raspberrypi.org/collections ... gb-sd-card

Even has NOOBS preinstalled....
Don't judge Linux by the Pi.......
I must not tread on too many sacred cows......

User avatar
OMightyBuggy
Posts: 21
Joined: Wed Jan 25, 2012 6:52 pm
Location: Mesa, AZ

Re: Smallest Linux Install

Sun May 11, 2014 7:25 am

Well all great ideas. :) I don't want to buy another SD card when I have one. Just wanted to know if there was anyway to boot the Raspberry Pi up for just SSH or something. 15.9MB is all the space that can be used on my SD card.

User avatar
DougieLawson
Posts: 39900
Joined: Sun Jun 16, 2013 11:19 pm
Location: A small cave in deepest darkest Basingstoke, UK
Contact: Website Twitter

Re: Smallest Linux Install

Sun May 11, 2014 8:51 am

OMightyBuggy wrote:Well all great ideas. :) I don't want to buy another SD card when I have one.
I can't see any reason not to spend a few £££ on having a collection of 8GB cards sitting on the shelf so you don't have to faff about when you want to try a new project on your Raspberry Pi.
Note: Any requirement to use a crystal ball or mind reading will result in me ignoring your question.

Criticising any questions is banned on this forum.

Any DMs sent on Twitter will be answered next month.
All fake doctors are on my foes list.

User avatar
rpdom
Posts: 17600
Joined: Sun May 06, 2012 5:17 am
Location: Chelmsford, Essex, UK

Re: Smallest Linux Install

Sun May 11, 2014 8:53 am

DougieLawson wrote:
OMightyBuggy wrote:Well all great ideas. :) I don't want to buy another SD card when I have one.
I can't see any reason not to spend a few £££ on having a collection of 8GB cards sitting on the shelf so you don't have to faff about when you want to try a new project on your Raspberry Pi.
Lack of £££ is a very good reason.

User avatar
DougieLawson
Posts: 39900
Joined: Sun Jun 16, 2013 11:19 pm
Location: A small cave in deepest darkest Basingstoke, UK
Contact: Website Twitter

Re: Smallest Linux Install

Sun May 11, 2014 9:04 am

rpdom wrote:
Lack of £££ is a very good reason.
Are you serious? Scrimping over £4 for a £35 computer. http://www.ebuyer.com/487066-lexar-8gb- ... 8gbabeuc10
Note: Any requirement to use a crystal ball or mind reading will result in me ignoring your question.

Criticising any questions is banned on this forum.

Any DMs sent on Twitter will be answered next month.
All fake doctors are on my foes list.

mikerr
Posts: 2826
Joined: Thu Jan 12, 2012 12:46 pm
Location: UK
Contact: Website

Re: Smallest Linux Install

Sun May 11, 2014 9:23 am

From previous posts it seems he had a decent sized SD card but it failed. Stopgap until payday ? Not everyone has money to buy a couple of sd cards at a time,
Though I'd guess a friend or neighbour will have a 2gb sd card lying around if you ask.

Boot from 16mb sd can be done, if you also use a usb flashdrive (2GB+):
http://www.redrobe.com/mike/boot-raspbe ... b-sd-card/

That's as easy as

1) selecting your usb pendrive in win32diskimager instead of the sd card, to write an image to (e.g. 2GB raspbian: http://downloads.raspberrypi.org/raspbi ... 013-09-16/)
2) copying all the files (9mb) except emergency.img to the SD card https://www.dropbox.com/s/84r95jovi4rlv ... folder.zip
3) editing the cmdline.txt on the SD card to read /dev/sda2:

Code: Select all

dwc_otg.lpm_enable=0 console=ttyAMA0,115200 kgdboc=ttyAMA0,115200 console=tty1 root=/dev/sda2 rootfstype=ext4 elevator=deadline rootwait 
Last edited by mikerr on Mon May 12, 2014 11:44 am, edited 6 times in total.
Android app - Raspi Card Imager - download and image SD cards - No PC required !

User avatar
rpdom
Posts: 17600
Joined: Sun May 06, 2012 5:17 am
Location: Chelmsford, Essex, UK

Re: Smallest Linux Install

Sun May 11, 2014 9:35 am

DougieLawson wrote:
rpdom wrote:
Lack of £££ is a very good reason.
Are you serious? Scrimping over £4 for a £35 computer. http://www.ebuyer.com/487066-lexar-8gb- ... 8gbabeuc10
Yes, I'm very serious. We don't all have well paid jobs (or any job at all for that matter).

My Raspi was a gift. I'm using old cards and monitors and scrounged bits to keep them going... and yes, I do use an old 8MB SD card for some work, but not Linux. I also have some Pentium MMX/166MHz laptops with 32MB of RAM and 2GB HDs. They run a custom Debian kernel quite well :)

User avatar
OMightyBuggy
Posts: 21
Joined: Wed Jan 25, 2012 6:52 pm
Location: Mesa, AZ

Re: Smallest Linux Install

Mon May 12, 2014 12:10 am

mikerr wrote:From previous posts it seems he had a decent sized SD card but it failed. Stopgap until payday ? Not everyone has money to buy a couple of sd cards at a time,
Though I'd guess a friend or neighbour will have a 2gb sd card lying around if you ask.

Boot from 16mb sd can be done, if you also use a usb flashdrive (2GB+):
http://sirlagz.net/2012/07/31/how-to-ru ... b-sd-card/

That's as easy as

1) selecting your usb pendrive in win32diskimager instead of the sd card, to write an image to (e.g. 2GB raspbian: http://downloads.raspberrypi.org/raspbi ... 013-09-16/)
2) copying all the files (9mb) except emergency.img to the SD card https://www.dropbox.com/s/84r95jovi4rlv ... folder.zip
3) editing the cmdline.txt on the SD card to read /dev/sda2:

Code: Select all

dwc_otg.lpm_enable=0 console=ttyAMA0,115200 kgdboc=ttyAMA0,115200 console=tty1 root=/dev/sda2 rootfstype=ext4 elevator=deadline rootwait 
This is exactly what I was looking for thanks much. :) I did run into a small problem. I can't expand the USB drive like the sd card so I only have 469M left.

Code: Select all

Filesystem      Size  Used Avail Use% Mounted on
rootfs          2.6G  2.0G  469M  82% /
/dev/root       2.6G  2.0G  469M  82% /
devtmpfs        180M     0  180M   0% /dev
tmpfs            38M  284K   38M   1% /run
tmpfs           5.0M     0  5.0M   0% /run/lock
tmpfs            75M     0   75M   0% /run/shm
/dev/mmcblk0p1   16M  9.3M  6.0M  61% /boot

mikerr
Posts: 2826
Joined: Thu Jan 12, 2012 12:46 pm
Location: UK
Contact: Website

Re: Smallest Linux Install

Mon May 12, 2014 9:47 am

raspi-config checks for and uses the sd card,

use this to change it to use usb

Code: Select all

cp /usr/bin/raspi-config ~
sed -i 's/mmcblk0p2/sda2/' ~/raspi-config                                                                             
sed -i 's/mmcblk0/sda/' ~/raspi-config
sudo ~/raspi-config
Android app - Raspi Card Imager - download and image SD cards - No PC required !

Joe Schmoe
Posts: 4277
Joined: Sun Jan 15, 2012 1:11 pm

Re: Smallest Linux Install

Mon May 12, 2014 10:37 am

mikerr wrote:raspi-config checks for and uses the sd card,

use this to change it to use usb

Code: Select all

cp /usr/bin/raspi-config ~
sed -i 's/mmcblk0p2/sda2/' ~/raspi-config                                                                             
sed -i 's/mmcblk0/sda/' ~/raspi-config
sudo ~/raspi-config
More simply:

sed -e 's/mmcblk0p2/sda2/' -e 's/mmcblk0/sda/' /usr/bin/rasp-config > ~/raspi-config
chmod +x !$
And some folks need to stop being fanboys and see the forest behind the trees.

(One of the best lines I've seen on this board lately)

User avatar
OMightyBuggy
Posts: 21
Joined: Wed Jan 25, 2012 6:52 pm
Location: Mesa, AZ

Re: Smallest Linux Install

Mon May 12, 2014 8:22 pm

Thank you everyone. :)

User avatar
RichShumaker
Posts: 273
Joined: Tue Jul 31, 2012 4:16 pm
Location: Sunny Southern CA near downtown LA
Contact: Website Facebook Twitter YouTube

Re: Smallest Linux Install

Sun Jul 20, 2014 12:33 am

mikerr wrote: 3) editing the cmdline.txt on the SD card to read /dev/sda2:

Code: Select all

dwc_otg.lpm_enable=0 console=ttyAMA0,115200 kgdboc=ttyAMA0,115200 console=tty1 root=/dev/sda2 rootfstype=ext4 elevator=deadline rootwait 
Looking for some help.

B+ have extra USB's so I have been booting using a 128mb(smallest I could find at a reasonable price) SD Micro to a USB flash/pen drive - works great.
I want to boot my old NOOBs cards using a USB to SD card reader. I have not put an image directly on the SD card yet to see if that works, so I am not sure if I have a USB card reader issue(driver needed) OR a NOOBs wrong location(not just /dev/sda2)

Anyone tried this yet? What worked for you?
My goal is a bunch of 128mb SD Micros in the B+ and I swap out my current systems on SD using the USB Flash Reader.
Thanks in advance for your help.
Rich Shumaker
http://www.instructables.com/id/Pi-Zero-W-NoIR-8MP-Camera-Build-Overview-Introduct/

User avatar
RichShumaker
Posts: 273
Joined: Tue Jul 31, 2012 4:16 pm
Location: Sunny Southern CA near downtown LA
Contact: Website Facebook Twitter YouTube

Re: Smallest Linux Install

Mon Jul 21, 2014 3:28 am

My USB to SD readers are the issue.
Going to try to get a new one, for now I am using the 128MB to boot to a USB flash drive.

Really excited by the New Model B+
Rich Shumaker
http://www.instructables.com/id/Pi-Zero-W-NoIR-8MP-Camera-Build-Overview-Introduct/

User avatar
RichShumaker
Posts: 273
Joined: Tue Jul 31, 2012 4:16 pm
Location: Sunny Southern CA near downtown LA
Contact: Website Facebook Twitter YouTube

Re: Smallest Linux Install

Mon Jul 21, 2014 9:00 pm

The store had a new sd reader, yeah stores.
I put in a NOOBs SD and it did not work, :(
I then put a full image on the same SD card, to avoid changing the set up.
BOOM GOES THE DYNAMITE, it worked.
So I just need to figure out how to point the 128mb micro sd to the correct location on the NOOBs SD card.
sda2/???? Or is there a different path

Side Note: This memory card reader is huge and actually blocks the Cat-5 on the RasPi B+.
So I plugged it into the second set of USB on the B+ and it booted no need to change the 'sda2'

Is this even possible to use a NOOBs SD or is this only possible with a direct image on the SD?
Thanks Again Everyone.
Rich Shumaker
http://www.instructables.com/id/Pi-Zero-W-NoIR-8MP-Camera-Build-Overview-Introduct/

User avatar
AndrewS
Posts: 3625
Joined: Sun Apr 22, 2012 4:50 pm
Location: Cambridge, UK
Contact: Website

Re: Smallest Linux Install

Wed Jul 23, 2014 2:20 am

RichShumaker wrote:Is this even possible to use a NOOBs SD or is this only possible with a direct image on the SD?
Thanks Again Everyone.
To avoid duplicate answers - I've already answered this here http://www.raspberrypi.org/forums/viewt ... 28#p583728

Return to “General discussion”