
Creating purpose-built TinyCoreLinux Images - _cbdev
http://fabianstumpf.de/articles/tinycore_images.htm
======
serguzest
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.

~~~
eatonphil
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](http://people.redhat.com/~rjones/supermin)

~~~
rwmj
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/)

[http://libguestfs.org/virt-builder.1.html](http://libguestfs.org/virt-
builder.1.html)

~~~
i336_
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.

------
mwcampbell
As I get some pleasure out of writing scripts to build finely tuned minimal
images like this, I found the article interesting. However, I think
manipulating a qcow2 image directly via nbd is over-complicating it. I think
it would be better to create a sparse file, mount that via a loopback device,
work with that, and then convert it to a qcow2 image (or vmdk or whatever) at
the end.

~~~
elevation
.qcow2 files have two main advantages when building system images compared to
a loopback device.

First, when building a system image with make, it works best to have each step
result in a separate image file so that make can rebuild your image when a
dependency changes without having to completely start over. Using .qcow2
images means that only the diffs are stored in each image file, instead of
having a dozen 4GB .bin files.

Second, because the loopback device requires root by default, you end up
running "sudo make" as part of your build process. But with .vmdk or .qcow2
files, tools like libguestfs can mount the filesystem for manipulation without
root. If you're planning to distribute your work, then "git clone && cd
project && make" is more accessible directing your users to modify their user
permissions or elevating to root.

~~~
regularfry
When I've done this sort of thing in the past, the ability to work with a set
of staged partial images was a very mixed blessing. It ended up being over-
complicated and rarely taken advantage of. I've settled on local package
repositories and a single image build step which compiles everything together.

The latter problem you describe, that of needing to be root, goes away if you
don't use a loopback device but instead use a mountable filesystem image.
`truncate -d1G os.img && mkfs.ext3 os.img && mount os.img mountpoint/` doesn't
need root at any point.

------
jensmittag
Thank you guys for all the links to related projects. I need to create
embedded Linux image for a project in the near future, so your links are quite
handy.

------
diminish
Does anyone have an idea how a minimal base Linux image can run inside a
browser? Like can we create a small virtual Linux server right inside a
browser?

~~~
mwcampbell
[http://jslinux.org/](http://jslinux.org/)

It's a clever hack, but I don't know of any practical application. Did you
have one in mind? Or is it just for the hack value?

~~~
homarp
Depending what you want to do, there is also the OR1K Emulator running Linux -
[http://jor1k.com](http://jor1k.com) and a generic x86 emulator - v86 -
[https://github.com/copy/v86](https://github.com/copy/v86)

you can check a small benchmark here:
[https://github.com/s-macke/jor1k/wiki/Benchmark-with-
other-e...](https://github.com/s-macke/jor1k/wiki/Benchmark-with-other-
emulators)

via
[https://news.ycombinator.com/item?id=10498305](https://news.ycombinator.com/item?id=10498305)

------
ilurk
Can anyone tell what are the differences between a TinyCoreLinux image and a
Rumpkernel, and the practical implications of those differences?

~~~
justincormack
TinyCoreLinux is just a small Linux distro. A rump kernel is a unikernel
reusing netbsd code, running in a single address space.

------
thoughtexpt
Is the Linux kernel compatible with multiboot specification yet?

[http://www.gnu.org/software/grub/manual/multiboot/multiboot....](http://www.gnu.org/software/grub/manual/multiboot/multiboot.html)

~~~
stonogo
The grub multiboot specification is short-sighted, x86 specific, and generally
useless.

~~~
voltagex_
Not _useless_ , it's a useful thing to have when you're trying to learn how to
write Hello World as an OS -
[http://wiki.osdev.org/Bare_Bones](http://wiki.osdev.org/Bare_Bones)

Are there any bootloader specs that are standard across architectures? UEFI
comes to mind, and I'm sure you could boot an x86 board via u-boot.

~~~
rwmj
Actually UEFI was very Intel-centric when it started out. It worked only on
Itanium and x86. We (Red Hat) spent a great deal of time of a very talented
colleague of mine porting it to Aarch64.

~~~
i336_
Aaaand the jawdrop happened when I reached the last word in that sentence.
Wow, kudos.

Know of any cool videos or anything similar that demo UEFI functionality on
AA64?

~~~
rwmj
I'm afraid I don't have any videos. If you get the APM Mustang, it boots into
UEFI.

~~~
i336_
...ah, nice price (fair, but decidedly not RPi or CHIP scale). Mentally noted,
at least :D

