1*4882a593Smuzhiyun// -*- mode:doc; -*- 2*4882a593Smuzhiyun// vim: set syntax=asciidoc: 3*4882a593Smuzhiyun 4*4882a593Smuzhiyun== Frequently Asked Questions & Troubleshooting 5*4882a593Smuzhiyun 6*4882a593Smuzhiyun[[faq-boot-hang-after-starting]] 7*4882a593Smuzhiyun=== The boot hangs after 'Starting network...' 8*4882a593Smuzhiyun 9*4882a593SmuzhiyunIf the boot process seems to hang after the following messages 10*4882a593Smuzhiyun(messages not necessarily exactly similar, depending on the list of 11*4882a593Smuzhiyunpackages selected): 12*4882a593Smuzhiyun 13*4882a593Smuzhiyun------------------------ 14*4882a593SmuzhiyunFreeing init memory: 3972K 15*4882a593SmuzhiyunInitializing random number generator... done. 16*4882a593SmuzhiyunStarting network... 17*4882a593SmuzhiyunStarting dropbear sshd: generating rsa key... generating dsa key... OK 18*4882a593Smuzhiyun------------------------ 19*4882a593Smuzhiyun 20*4882a593Smuzhiyunthen it means that your system is running, but didn't start a shell on 21*4882a593Smuzhiyunthe serial console. In order to have the system start a shell on your 22*4882a593Smuzhiyunserial console, you have to go into the Buildroot configuration, in 23*4882a593Smuzhiyun+System configuration+, modify +Run a getty (login prompt) after boot+ 24*4882a593Smuzhiyunand set the appropriate port and baud rate in the +getty options+ 25*4882a593Smuzhiyunsubmenu. This will automatically tune the +/etc/inittab+ file of the 26*4882a593Smuzhiyungenerated system so that a shell starts on the correct serial port. 27*4882a593Smuzhiyun 28*4882a593Smuzhiyun[[faq-no-compiler-on-target]] 29*4882a593Smuzhiyun=== Why is there no compiler on the target? 30*4882a593Smuzhiyun 31*4882a593SmuzhiyunIt has been decided that support for the _native compiler on the 32*4882a593Smuzhiyuntarget_ would be stopped from the Buildroot-2012.11 release because: 33*4882a593Smuzhiyun 34*4882a593Smuzhiyun* this feature was neither maintained nor tested, and often broken; 35*4882a593Smuzhiyun* this feature was only available for Buildroot toolchains; 36*4882a593Smuzhiyun* Buildroot mostly targets _small_ or _very small_ target hardware 37*4882a593Smuzhiyun with limited resource onboard (CPU, ram, mass-storage), for which 38*4882a593Smuzhiyun compiling on the target does not make much sense; 39*4882a593Smuzhiyun* Buildroot aims at easing the cross-compilation, making native 40*4882a593Smuzhiyun compilation on the target unnecessary. 41*4882a593Smuzhiyun 42*4882a593SmuzhiyunIf you need a compiler on your target anyway, then Buildroot is not 43*4882a593Smuzhiyunsuitable for your purpose. In such case, you need a _real 44*4882a593Smuzhiyundistribution_ and you should opt for something like: 45*4882a593Smuzhiyun 46*4882a593Smuzhiyun* http://www.openembedded.org[openembedded] 47*4882a593Smuzhiyun* https://www.yoctoproject.org[yocto] 48*4882a593Smuzhiyun* http://www.emdebian.org[emdebian] 49*4882a593Smuzhiyun* https://fedoraproject.org/wiki/Architectures[Fedora] 50*4882a593Smuzhiyun* http://en.opensuse.org/Portal:ARM[openSUSE ARM] 51*4882a593Smuzhiyun* http://archlinuxarm.org[Arch Linux ARM] 52*4882a593Smuzhiyun* ... 53*4882a593Smuzhiyun 54*4882a593Smuzhiyun[[faq-no-dev-files-on-target]] 55*4882a593Smuzhiyun=== Why are there no development files on the target? 56*4882a593Smuzhiyun 57*4882a593SmuzhiyunSince there is no compiler available on the target (see 58*4882a593Smuzhiyunxref:faq-no-compiler-on-target[]), it does not make sense to waste 59*4882a593Smuzhiyunspace with headers or static libraries. 60*4882a593Smuzhiyun 61*4882a593SmuzhiyunTherefore, those files are always removed from the target since the 62*4882a593SmuzhiyunBuildroot-2012.11 release. 63*4882a593Smuzhiyun 64*4882a593Smuzhiyun[[faq-no-doc-on-target]] 65*4882a593Smuzhiyun=== Why is there no documentation on the target? 66*4882a593Smuzhiyun 67*4882a593SmuzhiyunBecause Buildroot mostly targets _small_ or _very small_ target 68*4882a593Smuzhiyunhardware with limited resource onboard (CPU, ram, mass-storage), it 69*4882a593Smuzhiyundoes not make sense to waste space with the documentation data. 70*4882a593Smuzhiyun 71*4882a593SmuzhiyunIf you need documentation data on your target anyway, then Buildroot 72*4882a593Smuzhiyunis not suitable for your purpose, and you should look for a _real 73*4882a593Smuzhiyundistribution_ (see: xref:faq-no-compiler-on-target[]). 74*4882a593Smuzhiyun 75*4882a593Smuzhiyun[[faq-why-not-visible-package]] 76*4882a593Smuzhiyun=== Why are some packages not visible in the Buildroot config menu? 77*4882a593Smuzhiyun 78*4882a593SmuzhiyunIf a package exists in the Buildroot tree and does not appear in the 79*4882a593Smuzhiyunconfig menu, this most likely means that some of the package's 80*4882a593Smuzhiyundependencies are not met. 81*4882a593Smuzhiyun 82*4882a593SmuzhiyunTo know more about the dependencies of a package, search for the 83*4882a593Smuzhiyunpackage symbol in the config menu (see xref:make-tips[]). 84*4882a593Smuzhiyun 85*4882a593SmuzhiyunThen, you may have to recursively enable several options (which 86*4882a593Smuzhiyuncorrespond to the unmet dependencies) to finally be able to select 87*4882a593Smuzhiyunthe package. 88*4882a593Smuzhiyun 89*4882a593SmuzhiyunIf the package is not visible due to some unmet toolchain options, 90*4882a593Smuzhiyunthen you should certainly run a full rebuild (see xref:make-tips[] for 91*4882a593Smuzhiyunmore explanations). 92*4882a593Smuzhiyun 93*4882a593Smuzhiyun[[faq-why-not-use-target-as-chroot]] 94*4882a593Smuzhiyun=== Why not use the target directory as a chroot directory? 95*4882a593Smuzhiyun 96*4882a593SmuzhiyunThere are plenty of reasons to *not* use the target directory a chroot 97*4882a593Smuzhiyunone, among these: 98*4882a593Smuzhiyun 99*4882a593Smuzhiyun* file ownerships, modes and permissions are not correctly set in the 100*4882a593Smuzhiyun target directory; 101*4882a593Smuzhiyun* device nodes are not created in the target directory. 102*4882a593Smuzhiyun 103*4882a593SmuzhiyunFor these reasons, commands run through chroot, using the target 104*4882a593Smuzhiyundirectory as the new root, will most likely fail. 105*4882a593Smuzhiyun 106*4882a593SmuzhiyunIf you want to run the target filesystem inside a chroot, or as an NFS 107*4882a593Smuzhiyunroot, then use the tarball image generated in +images/+ and extract it 108*4882a593Smuzhiyunas root. 109*4882a593Smuzhiyun 110*4882a593Smuzhiyun[[faq-no-binary-packages]] 111*4882a593Smuzhiyun=== Why doesn't Buildroot generate binary packages (.deb, .ipkg...)? 112*4882a593Smuzhiyun 113*4882a593SmuzhiyunOne feature that is often discussed on the Buildroot list is the 114*4882a593Smuzhiyungeneral topic of "package management". To summarize, the idea 115*4882a593Smuzhiyunwould be to add some tracking of which Buildroot package installs 116*4882a593Smuzhiyunwhat files, with the goals of: 117*4882a593Smuzhiyun 118*4882a593Smuzhiyun * being able to remove files installed by a package when this package 119*4882a593Smuzhiyun gets unselected from the menuconfig; 120*4882a593Smuzhiyun 121*4882a593Smuzhiyun * being able to generate binary packages (ipk or other format) that 122*4882a593Smuzhiyun can be installed on the target without re-generating a new root 123*4882a593Smuzhiyun filesystem image. 124*4882a593Smuzhiyun 125*4882a593SmuzhiyunIn general, most people think it is easy to do: just track which package 126*4882a593Smuzhiyuninstalled what and remove it when the package is unselected. However, it 127*4882a593Smuzhiyunis much more complicated than that: 128*4882a593Smuzhiyun 129*4882a593Smuzhiyun * It is not only about the +target/+ directory, but also the sysroot in 130*4882a593Smuzhiyun +host/<tuple>/sysroot+ and the +host/+ directory itself. All files 131*4882a593Smuzhiyun installed in those directories by various packages must be tracked. 132*4882a593Smuzhiyun 133*4882a593Smuzhiyun * When a package is unselected from the configuration, it is not 134*4882a593Smuzhiyun sufficient to remove just the files it installed. One must also 135*4882a593Smuzhiyun remove all its reverse dependencies (i.e. packages relying on it) 136*4882a593Smuzhiyun and rebuild all those packages. For example, package A depends 137*4882a593Smuzhiyun optionally on the OpenSSL library. Both are selected, and Buildroot 138*4882a593Smuzhiyun is built. Package A is built with crypto support using OpenSSL. 139*4882a593Smuzhiyun Later on, OpenSSL gets unselected from the configuration, but 140*4882a593Smuzhiyun package A remains (since OpenSSL is an optional dependency, this 141*4882a593Smuzhiyun is possible.) If only OpenSSL files are removed, then the files 142*4882a593Smuzhiyun installed by package A are broken: they use a library that is no 143*4882a593Smuzhiyun longer present on the target. Although this is technically doable, 144*4882a593Smuzhiyun it adds a lot of complexity to Buildroot, which goes against the 145*4882a593Smuzhiyun simplicity we try to stick to. 146*4882a593Smuzhiyun 147*4882a593Smuzhiyun * In addition to the previous problem, there is the case where the 148*4882a593Smuzhiyun optional dependency is not even known to Buildroot. For example, 149*4882a593Smuzhiyun package A in version 1.0 never used OpenSSL, but in version 2.0 it 150*4882a593Smuzhiyun automatically uses OpenSSL if available. If the Buildroot .mk file 151*4882a593Smuzhiyun hasn't been updated to take this into account, then package A will 152*4882a593Smuzhiyun not be part of the reverse dependencies of OpenSSL and will not be 153*4882a593Smuzhiyun removed and rebuilt when OpenSSL is removed. For sure, the .mk file 154*4882a593Smuzhiyun of package A should be fixed to mention this optional dependency, 155*4882a593Smuzhiyun but in the mean time, you can have non-reproducible behaviors. 156*4882a593Smuzhiyun 157*4882a593Smuzhiyun * The request is to also allow changes in the menuconfig to be 158*4882a593Smuzhiyun applied on the output directory without having to rebuild 159*4882a593Smuzhiyun everything from scratch. However, this is very difficult to achieve 160*4882a593Smuzhiyun in a reliable way: what happens when the suboptions of a package 161*4882a593Smuzhiyun are changed (we would have to detect this, and rebuild the package 162*4882a593Smuzhiyun from scratch and potentially all its reverse dependencies), what 163*4882a593Smuzhiyun happens if toolchain options are changed, etc. At the moment, what 164*4882a593Smuzhiyun Buildroot does is clear and simple so its behaviour is very 165*4882a593Smuzhiyun reliable and it is easy to support users. If configuration changes 166*4882a593Smuzhiyun done in menuconfig are applied after the next make, then it has to 167*4882a593Smuzhiyun work correctly and properly in all situations, and not have some 168*4882a593Smuzhiyun bizarre corner cases. The risk is to get bug reports like "I have 169*4882a593Smuzhiyun enabled package A, B and C, then ran make, then disabled package 170*4882a593Smuzhiyun C and enabled package D and ran make, then re-enabled package C 171*4882a593Smuzhiyun and enabled package E and then there is a build failure". Or worse 172*4882a593Smuzhiyun "I did some configuration, then built, then did some changes, 173*4882a593Smuzhiyun built, some more changes, built, some more changes, built, and now 174*4882a593Smuzhiyun it fails, but I don't remember all the changes I did and in which 175*4882a593Smuzhiyun order". This will be impossible to support. 176*4882a593Smuzhiyun 177*4882a593SmuzhiyunFor all these reasons, the conclusion is that adding tracking of 178*4882a593Smuzhiyuninstalled files to remove them when the package is unselected, or to 179*4882a593Smuzhiyungenerate a repository of binary packages, is something that is very 180*4882a593Smuzhiyunhard to achieve reliably and will add a lot of complexity. 181*4882a593Smuzhiyun 182*4882a593SmuzhiyunOn this matter, the Buildroot developers make this position statement: 183*4882a593Smuzhiyun 184*4882a593Smuzhiyun * Buildroot strives to make it easy to generate a root filesystem (hence 185*4882a593Smuzhiyun the name, by the way.) That is what we want to make Buildroot good at: 186*4882a593Smuzhiyun building root filesystems. 187*4882a593Smuzhiyun 188*4882a593Smuzhiyun * Buildroot is not meant to be a distribution (or rather, a distribution 189*4882a593Smuzhiyun generator.) It is the opinion of most Buildroot developers that this 190*4882a593Smuzhiyun is not a goal we should pursue. We believe that there are other tools 191*4882a593Smuzhiyun better suited to generate a distro than Buildroot is. For example, 192*4882a593Smuzhiyun http://openembedded.org/[Open Embedded], or https://openwrt.org/[openWRT], 193*4882a593Smuzhiyun are such tools. 194*4882a593Smuzhiyun 195*4882a593Smuzhiyun * We prefer to push Buildroot in a direction that makes it easy (or even 196*4882a593Smuzhiyun easier) to generate complete root filesystems. This is what makes 197*4882a593Smuzhiyun Buildroot stands out in the crowd (among other things, of course!) 198*4882a593Smuzhiyun 199*4882a593Smuzhiyun * We believe that for most embedded Linux systems, binary packages are 200*4882a593Smuzhiyun not necessary, and potentially harmful. When binary packages are 201*4882a593Smuzhiyun used, it means that the system can be partially upgraded, which 202*4882a593Smuzhiyun creates an enormous number of possible combinations of package 203*4882a593Smuzhiyun versions that should be tested before doing the upgrade on the 204*4882a593Smuzhiyun embedded device. On the other hand, by doing complete system 205*4882a593Smuzhiyun upgrades by upgrading the entire root filesystem image at once, 206*4882a593Smuzhiyun the image deployed to the embedded system is guaranteed to really 207*4882a593Smuzhiyun be the one that has been tested and validated. 208*4882a593Smuzhiyun 209*4882a593Smuzhiyun[[faq-speeding-up-build]] 210*4882a593Smuzhiyun=== How to speed-up the build process? 211*4882a593Smuzhiyun 212*4882a593SmuzhiyunSince Buildroot often involves doing full rebuilds of the entire 213*4882a593Smuzhiyunsystem that can be quite long, we provide below a number of tips to 214*4882a593Smuzhiyunhelp reduce the build time: 215*4882a593Smuzhiyun 216*4882a593Smuzhiyun * Use a pre-built external toolchain instead of the default Buildroot 217*4882a593Smuzhiyun internal toolchain. By using a pre-built Linaro toolchain (on ARM) 218*4882a593Smuzhiyun or a Sourcery CodeBench toolchain (for ARM, x86, x86-64, MIPS, 219*4882a593Smuzhiyun etc.), you will save the build time of the toolchain at each 220*4882a593Smuzhiyun complete rebuild, approximately 15 to 20 minutes. Note that 221*4882a593Smuzhiyun temporarily using an external toolchain does not prevent you to 222*4882a593Smuzhiyun switch back to an internal toolchain (that may provide a higher 223*4882a593Smuzhiyun level of customization) once the rest of your system is working; 224*4882a593Smuzhiyun 225*4882a593Smuzhiyun * Use the +ccache+ compiler cache (see: xref:ccache[]); 226*4882a593Smuzhiyun 227*4882a593Smuzhiyun * Learn about rebuilding only the few packages you actually care 228*4882a593Smuzhiyun about (see xref:rebuild-pkg[]), but beware that sometimes full 229*4882a593Smuzhiyun rebuilds are anyway necessary (see xref:full-rebuild[]); 230*4882a593Smuzhiyun 231*4882a593Smuzhiyun * Make sure you are not using a virtual machine for the Linux system 232*4882a593Smuzhiyun used to run Buildroot. Most of the virtual machine technologies are 233*4882a593Smuzhiyun known to cause a significant performance impact on I/O, which is 234*4882a593Smuzhiyun really important for building source code; 235*4882a593Smuzhiyun 236*4882a593Smuzhiyun * Make sure that you're using only local files: do not attempt to do 237*4882a593Smuzhiyun a build over NFS, which significantly slows down the build. Having 238*4882a593Smuzhiyun the Buildroot download folder available locally also helps a bit. 239*4882a593Smuzhiyun 240*4882a593Smuzhiyun * Buy new hardware. SSDs and lots of RAM are key to speeding up the 241*4882a593Smuzhiyun builds. 242*4882a593Smuzhiyun 243*4882a593Smuzhiyun * Experiment with top-level parallel build, see 244*4882a593Smuzhiyun xref:top-level-parallel-build[]. 245