Live data from Hacker News

Creating purpose-built TinyCoreLinux Images

fabianstumpf.de

11–20 of 33 posts

Re: Creating purpose-built TinyCoreLinux Images

#11

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.

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

Re: Creating purpose-built TinyCoreLinux Images

#12
post #9
post #6

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?

You need just the Linux kernel and Busybox in order to run Linux with a working shell. 2-4 MB all together I would say. My first Internet router ran a Linux from a 1.44MB disk 15 years ago.

You're in the right ballpark. I ported a network monitoring app to Linux and helped bring Linux up on a custom board a long time ago, and that device had 4MB for the kernel, shell/utilities and the application itself. It fit nicely.

Re: Creating purpose-built TinyCoreLinux Images

#14

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.

.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 .b…

Aren't these images typically built on designated build machines anyway? Sure you've got to develop it locally. But the majority of developer-consumers will get it from some distributor fed from a build machine.

The diffing is still a great point. I did not know that about qcow2 images. Do you have any articles then on incremental builds with .qcow2 images?

Re: Creating purpose-built TinyCoreLinux Images

#15

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.

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

Re: Creating purpose-built TinyCoreLinux Images

#16
post #10

Is the Linux kernel compatible with multiboot specification yet? http://www.gnu.org/software/grub/manual/multiboot/multiboot....

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

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

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.

Re: Creating purpose-built TinyCoreLinux Images

#17

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.

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

Re: Creating purpose-built TinyCoreLinux Images

#18

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.

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

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

Re: Creating purpose-built TinyCoreLinux Images

#19
post #12
post #9

Earlier quoted context omitted.

You need just the Linux kernel and Busybox in order to run Linux with a working shell. 2-4 MB all together I would say. My first Internet router ran a Linux from a 1.44MB disk 15 years ago.

You're in the right ballpark. I ported a network monitoring app to Linux and helped bring Linux up on a custom board a long time ago, and that device had 4MB for the kernel, shell/utilities and the application itself. It fit nicely.

Even a modern OpenWRT distribution still fits in 4MB of flash if you leave out the web interface and only include the basic features.

Re: Creating purpose-built TinyCoreLinux Images

#20
post #6

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?

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?

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

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

via https://news.ycombinator.com/item?id=10498305

Post reply on HN