More progress and less space wasted !
A little bit busybox customization, just to shrink used ram memory a little bit more. I hadn’t dropped any common linux commands from filesystem because I don’t neet to save more disk space, I need to have a usable system. Just to follow the previous post I have added to the disk more utilities (~5Mb !) to have a complete shell packed with a lot of tools. Image size is still across 64Mb of disk so it perfectly fits every spare or unused SD memory card you have around.
My biggest concern is related to occupied memory because Raspberry doesn’t have a lot of it and I just want to have free memory for our own applications.
Here’s my latest screenshot:
~$ ssh email@example.com The authenticity of host '192.168.0.141 (192.168.0.141)' can't be established. RSA key fingerprint is 5c:34:78:10:71:ca:20:73:bd:cb:92:3a:04:d3:86:84. Are you sure you want to continue connecting (yes/no)? yes Warning: Permanently added '192.168.0.141' (RSA) to the list of known hosts. firstname.lastname@example.org's password: __ __ _ _ | \/ | ___ ___| |__ (_)_ _ ___ | |\/| |/ _ \ / _ \ '_ \| | | | / __| | | | | (_) | __/ |_) | | |_| \__ \ |_| |_|\___/ \___|_.__/|_|\__,_|___/ v2.0.0 (250 GTO) root@moebius:~# free total used free shared buffers Mem: 447868 20852 427016 0 1740 -/+ buffers: 19112 428756 Swap: 0 0 0 root@moebius:~# df Filesystem 1K-blocks Used Available Use% Mounted on /dev/root 110925 67194 37792 64% / devtmpfs 219768 0 219768 0% /dev tmpfs 223932 152 223780 0% /run tmpfs 223932 52 223880 0% /var/volatile root@moebius:~#
As you can see I saved 2 additional Megs of RAM memory on boot
What have I done ? Let’s talk about udev.
As you certainly know udev is a device manager for your device nodes in the /dev directory, it creates and populate this dir and also handles userspace operations. It’s really useful and common in every linux desktop or server but not strictly necessary in a really tiny embedded appliance or a minimal embedded linux distro.
I personally like it and it’s common to use it in every desktop/server linux distribution, but when you’re hunting free memory in a really tiny device every byte counts so you’ll probably kill (or disable) services not strictly needed.
A quite common approach on embedded devices is to statically populate /dev directory with just the device nodes you need, it wouldn’t be fancy but it’s effective and fast and you don’t need to worry about having an additional service. I have decided to use a mixed approach, I am starting udev from multiuser runlevel (3) as every linux distro does in these days but I kill it after its initial job.
In my /etc/rc.local script (the last script in the init sequence) there’s a row who tells to stop udevd, this is what I’m doing to normally populate the /dev directory but I definitively stop this service before giving the shell to the user, I won’t have udev hotplug events but I don’t even care of this kind of feature, this method is aimed to save free memory so manually mounting external storage for example it’s not a big problem.
This is what I’m doing, if you prefer to have udevd working you can still use it even after boot, just comment out the line:
# Stopping udev daemon to free more memory /etc/init.d/udev stop
in /etc/rc.local file and you’ll have a more common linux behavior with two extra Mb of ram occupied
What do you think about it ?
I’m glad to hear your thoughts