Run two commands, get a Linux distro built from source.
Takes care of:
- cross compilation. In other words, compiles GCC for you. Several archs supported.
- bootloading. Several bootloaders supported.
- root filesystem generation.
- tons of packages, e.g. X.org. Packages have a dependency system, but no versioning.
Lots of software supported.
Tested on Ubuntu 16.04.
git clone git://git.buildroot.net/buildroot
cd buildroot
git checkout 2016.05
make qemu_x86_64_defconfig
# Can't use -jN, use `BR2_JLEVEL=2` instead.
make BR2_JLEVEL=2
# Wait.
# cat board/qemu/x86_64/readme.txt
qemu-system-x86_64 -M pc -kernel output/images/bzImage -drive file=output/images/rootfs.ext2,if=virtio,format=raw -append root=/dev/vda -net nic,model=virtio -net user
Full QEMU command documented under board/qemu/*/readme.txt
.
The obvious x86 analog just works, beauty.
The only thing is that you have to move the x86 output away if you have one:
mv output output.x86~
make qemu_arm_versatile_defconfig
make
qemu-system-arm -M versatilepb -kernel output/images/zImage -dtb output/images/versatile-pb.dtb -drive file=output/images/rootfs.ext2,if=scsi,format=raw -append "root=/dev/sda console=ttyAMA0,115200" -serial stdio -net nic,model=rtl8139 -net user -nographic
Then in QEMU:
cat /proc/cpuinfo
Vexpress requires a more recent QEMU, 2.0.0 does not work, but the 2.7.0 built with QEMU did.
TODO: Ctrl + C kills the emulator itself. Why? Not like that in X86.
All options are stored in .config
before build. The .config
file fully specifies the entire system.
Make and environment variables don't in general override options:
# Does not work.
#make defconfig BR2_SOME_OPT=y
Whenever you do make
, make oldconfig
gets run. make oldconfig
removes any new options you've added to the file, unless they are specified under package/Config.in
.
Some configs are not put on the .config
, while others are commented out. TODO: commented out means dependencies and have been met, removed not?
LINUX_KERNEL_VERSION="4.5.3"
BR2_GCC_VERSION_4_9_X=y
mkdir a
mkdir a/b
date >a/b/c
make BR2_ROOTFS_OVERLAY='a'
Outcome: the root of the generated filesystem now contains /b/c
.
TODO
Currently impossible.
For simple cases, just remove the files from:
rm output/target/usr/bin/hello
TODO how to stop printing that
Placed under /usr/bin
and /usr/games
.
Grouped under packages/Config.in
:
menu "Games"
Many / all are SDL based. It seems that SDL has an fbdev
mode that dispenses X11.
Doom clones.
This shows one running on uclinux blackfin SDL DirectFB: https://www.youtube.com/watch?v=fKyQOntPEFs
From: http://lgames.sourceforge.net/about.php
Simple SDL based games L
stands for Linux.
Should be able to run on framebuffer? But both on TTY and X11 they fail with:
set_video_mode: cannot allocate screen: Couldn't set console screen info
Looks like this is caused by the call: https://www.libsdl.org/release/SDL-1.2.15/docs/html/sdlsetvideomode.html
fbset
seems to do the same calls, and fails in the same way.
Takes over screen and hangs.
Classic steam locomotive sl
typo corrector. Text only.
CLI chess.
http://unix.stackexchange.com/questions/70931/install-x11-on-my-own-linux-system
The basics: always compile with:
- debugging symbols
- gdb and gdbserver on target. Requires toolchain with thread support, e.g. glibc.
- host cross gdb
- strace
- QEMU: buildroot can even compile QEMU!
http://stackoverflow.com/a/39301480/895245
Not enabled on BusyBox by default, see: package/busybox/default.config
But we have ping (TODO from where?), so whatever.
TODO: how to emulate with QEMU? aarch
procedure did no work, no dtb
file.
Just worked on a PI2 via UART. No sshd
daemon though.
- https://bugs.busybox.net/show_bug.cgi?id=9226
- http://bbs.t-firefly.com/forum.php?mod=viewthread&tid=1777
TODO: supported or not?
Direct linux
in rootfs failed.
- http://lists.busybox.net/pipermail/buildroot/2013-December/085486.html
- http://oss.sgi.com/LDP/HOWTO/SSI-UML-HOWTO/buildroot.html
- https://wiki.archlinux.org/index.php/User-mode_Linux#Build_rootfs_image
- https://unix.stackexchange.com/questions/73203/how-to-create-rootfs-for-user-mode-linux-on-fedora-18