Hacker News new | ask | show | jobs
by serguzest 3884 days ago
I wouldn't bother with this. There is an excellent project named Buildroot for the exact purpose. There is also Yocto but it generates bigger images in their recommended configuration but you can always tweak it.
3 comments

Buildroot can be quite intimidating to the newcomer - I had to ask many questions on IRC to get my build tree down to something I could share [1]

[1]: https://github.com/voltagex/serial-vm-buildroot

Supermin[0] is another really cool tool that might be interesting. Though I still can't exactly tell if it's relevant.

[0] http://people.redhat.com/~rjones/supermin

Supermin solves a narrow case: how to distribute an appliance [Linux-based OS disk image] as a very small download (typically 100K - 1MB). It works by observing that the end user already has the files they need as part of their host Linux OS (eg. /bin/bash, /lib/libc.so), and the distribution is just a skeleton of the disk image, which is "filled in" on the end user's machine by copying the host files in at the last second.

So it's not really applicable here, although I understand people use supermin to build chroots for Docker (as the author of supermin, I wouldn't necessarily recommend doing that unless you understand the limitations).

What is actually needed here is libguestfs, which is a pure userspace tool for building disk images that doesn't require root access and is built for scripting/automation and security. We have a tool built on top of libguestfs called virt-builder which specifically churns out minimal Linux distros very quickly.

Sadly virt-builder can't build TinyCore Linux yet, although it probably should be extended to do that. It would be a lot simpler to use virt-builder, than to go through the tedious and dangerous steps outlined in the article.

http://libguestfs.org/

http://libguestfs.org/virt-builder.1.html

Unrelated(ish), but thanks for mentioning libguestfs! I've been passively looking for the solution to the non-root filesystem access problem for a while.

Also, PSA: this project has a program that can read and write Windows registry hives.

These kinds of tools are very relevant when creating Docker base images - not all of us can afford to download 1.6GB just for Ruby. See the official Ruby baseimage vs Alpine + ruby package for example
Supermin seems quite old. Perhaps an idea that has passed?
Supermin is actively developed. The last commit was 2 days ago.

https://github.com/libguestfs/supermin/commits/master

Having said that, it's not relevant to what the OP wants to do. libguestfs, however, is very relevant.