|
| 1 | +# Buildroot |
| 2 | + |
| 3 | +Run two commands, get a Linux distro built from source. |
| 4 | + |
| 5 | +1. Examples |
| 6 | + 1. [Add a new package in tree](https://github.com/cirosantilli/buildroot/tree/in-tree-package-2016.05) |
| 7 | + 1. [Package with a Kernel module in tree](https://github.com/cirosantilli/buildroot/tree/kernel-module-2016.05) |
| 8 | + 1. [Out of tree package](https://github.com/cirosantilli/buildroot/tree/out-of-tree-2016.05) |
| 9 | + |
| 10 | +## Introduction |
| 11 | + |
| 12 | +Takes care of: |
| 13 | + |
| 14 | +- cross compilation. In other words, compiles GCC for you. Several archs supported. |
| 15 | +- bootloading. Several bootloaders supported. |
| 16 | +- root filesystem generation. |
| 17 | +- tons of packages, e.g. X.org. Packages have a dependency system, but no versioning. |
| 18 | + |
| 19 | +Lots of software supported. |
| 20 | + |
| 21 | +## QEMU example |
| 22 | + |
| 23 | +Tested on Ubuntu 16.04. |
| 24 | + |
| 25 | + git clone git://git.buildroot.net/buildroot |
| 26 | + cd buildroot |
| 27 | + git checkout 2016.05 |
| 28 | + make qemu_x86_64_defconfig |
| 29 | + # Can't use -jN, use `BR2_JLEVEL=2` instead. |
| 30 | + make BR2_JLEVEL=2 |
| 31 | + # Wait. |
| 32 | + # cat board/qemu/x86_64/readme.txt |
| 33 | + 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 |
| 34 | + |
| 35 | +## ARM |
| 36 | + |
| 37 | +The obvious x86 analog just works, beauty. |
| 38 | + |
| 39 | +The only thing is that you have to move the x86 output away if you have one: |
| 40 | + |
| 41 | + mv output output.x86~ |
| 42 | + make qemu_arm_versatile_defconfig |
| 43 | + make |
| 44 | + 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 |
| 45 | + |
| 46 | +Then in QEMU: |
| 47 | + |
| 48 | + cat /proc/cpuinfo |
| 49 | + |
| 50 | +## Don't ask for password at login |
| 51 | + |
| 52 | +<http://unix.stackexchange.com/questions/299408/how-to-login-automatically-without-typing-root-in-buildroot-x86-64-qemu> |
| 53 | + |
| 54 | +## config |
| 55 | + |
| 56 | +All options are stored in `.config` before build. The `.config` file fully specifies the entire system. |
| 57 | + |
| 58 | +Make and environment variables *don't* in general override options: |
| 59 | + |
| 60 | + # Does not work. |
| 61 | + #make defconfig BR2_SOME_OPT=y |
| 62 | + |
| 63 | +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`. |
| 64 | + |
| 65 | +Some configs are not put on the `.config`, while others are commented out. TODO: commented out means dependencies and have been met, removed not? |
| 66 | + |
| 67 | +### Important configurations |
| 68 | + |
| 69 | + LINUX_KERNEL_VERSION="4.5.3" |
| 70 | + BR2_GCC_VERSION_4_9_X=y |
| 71 | + |
| 72 | +## Add a file to the distro |
| 73 | + |
| 74 | + mkdir a |
| 75 | + mkdir a/b |
| 76 | + date >a/b/c |
| 77 | + make BR2_ROOTFS_OVERLAY='a' |
| 78 | + |
| 79 | +Outcome: the root of the generated filesystem now contains `/b/c`. |
| 80 | + |
| 81 | +## Permanent storage filesystem |
| 82 | + |
| 83 | +TODO |
| 84 | + |
| 85 | +## Remove package |
| 86 | + |
| 87 | +Currently impossible. |
| 88 | + |
| 89 | +For simple cases, just remove the files from: |
| 90 | + |
| 91 | + rm output/target/usr/bin/hello |
| 92 | + |
| 93 | +## random: nonblocking pool is initialized |
| 94 | + |
| 95 | +TODO how to stop printing that |
| 96 | + |
| 97 | +## Projects that use Buildroot: |
| 98 | + |
| 99 | +- <https://en.wikipedia.org/wiki/OpenWrt> |
| 100 | + |
| 101 | +## Games |
| 102 | + |
| 103 | +Placed under `/usr/bin` and `/usr/games`. |
| 104 | + |
| 105 | +Grouped under `packages/Config.in`: |
| 106 | + |
| 107 | + menu "Games" |
| 108 | + |
| 109 | +Many / all are SDL based. It seems that SDL has an `fbdev` mode that dispenses X11. |
| 110 | + |
| 111 | +### ltris |
| 112 | + |
| 113 | +### lbreakout2 |
| 114 | + |
| 115 | +Fails with: |
| 116 | + |
| 117 | + set_video_mode: cannot allocate screen: Couldn't set console screen info |
| 118 | + |
| 119 | +### opentyrian |
| 120 | + |
| 121 | +Hangs. |
| 122 | + |
| 123 | +### sl |
| 124 | + |
| 125 | +Classic steam locomotive `sl` typo corrector. Text only. |
| 126 | + |
| 127 | +## X11 |
| 128 | + |
| 129 | +http://unix.stackexchange.com/questions/70931/install-x11-on-my-own-linux-system |
0 commit comments