In what circumstances 'Openwrt ' is preferred over 'Buildroot' frame work? - embedded-linux

I'm confused between Buildroot and OpenWrt. I mean in which scenario one will choose OpenWrt over Buildroot.
As per my understanding, there are only 2 differences between Buildroot and OpenWrt
OpenWrt provides package manager(opkg) which is not available for buildroot.
OpenWrt provides the good number of packages support for most networking related devices (routers, switches etc).
If I don’t need any package manager for a project and yet I want network support then I can choose Build root over OpenWrt, right? Is it not possible to build networking related packages in Buildroot itself?
I mean if package manager is not a concern we can go ahead with buildroot itself right? there is no need to opt OpenWrt?
If I'm wrong can anyone address the scenarios where buildroot fails and Openwrt wins?
I mean is it possible to achieve what OpenWrt is doing(Building Firmware images for networking related hardware) with Buildroot itself. I observed that the init process (early userspace) behaviour is different for Buildroot and OpenWrt.
In Buildroot init script will be read etc/inittab and the scripts under init.d will be executed.
In Openwrt procd is the init script (rc.common)and will run the scripts listed under init.d as well as scripts under rc.d.
Will this affect any way if I try to use Buildroot to generate an Image for the firmware which is supported by OpenWrt?

OpenWRT is based on Buildroot, just as Ubuntu is based on Debian. While the two projects share code, OpenWRT focuses on routers and the like, whereas buildroot is just a general purpose toolchain for embedded linux. What you should be asking yourself is, "Which of these two projects contain what I need to accomplish my task?"
OpenWRT can be compiled without opkg, in fact, many packages can be ripped out and it will work just fine. This is useful for devices with less resources.
Also, OpenWRT can be made to use regular init scripts; you don't have to use procd if you don't want to. The abstractions offered by it do make it easier to configure an existing package, however, if you are looking to port a new package, advanced knowledge of procd is needed to create those from scratch.

Related

setting up a development environment for Linux device driver

I am trying to read the LDD book by Jonathan Corbet, Greg Kroah-Hartman, Alessandro Rubini and implement the sample modules. So to begin with, I tried setting up a development system. Installed Ubuntu 16.04 Xenial. Now, I just created a directory and wrote the hello_world module with a Makefile. Got it built and run it, verified the dmesg logs.
Is that all the development setup? I searched online and found articles where they are asking to download and compile the kernel, use a VM to boot the kernel. What is the reason? Or what am I missing?
Is there any better article which clarifies this?
Thanks
hago
You can try one more way:
If you have native windows, install virtual machine software such as
Virtual box. Get your favourite Linux distribution (no bias, just
an example - Ubuntu) and install it through Virtual box.
Get the latest kernel (or of your choice) from kernel.org.
Choose the platform you want to build this kernel for. E.g arm64 or x86.
In case you do not have real boards (e.g RPi for arm variant), you can use qemu-arm64 or qemu-x86 to run your compiled kernel. This is also a good option when users do not have the boards.
Another good use case for using qemu for the newbie kernel developers is even they write some modules which crashes, then the qemu instance is crashed so no harm.
I think using qemu is a good option for people who starts to learn kernel programming and also want to try writing some of their modules and do not intend to purchase hardware at this point of time.
It depends on your target. For your case, you have made a kernel driver for your computer (it run Linux kernel).
But if you want to develop a Kernel driver for another target like Rasberry Pi, ARM board, X86-X64 board, ... you must learn to compile, edit Kernel config, boot Kernel image, ... because each target has different kernel versions.
You can refer to this training for more detail: https://bootlin.com/training/embedded-linux/

What is the difference between make nconfig & make linux-nconfig?

I am using buildroot and did not see a difference between:
make nconfig
and
make linux-nconfig
Is there a difference?
make nconfig runs the configuration of Buildroot itself (i.e. selecting which packages to build, which architecture, which toolchain, etc). make linux-nconfig runs the configuration of the Linux kernel. It will first download and extract the kernel, and then run the kernel Kconfig infrastructure. It allows you to select CPU, drivers, filesystems etc.

How to install transmission bittorrent client busybox function

I found my WD MyPassport Wireless is running Buildroot Linaro linux with busybox; It doesn't have aptitude package manager. I don't know much about busybox; I came to know the commands provided by the busybox are called defined functions. How can I install Transmission BitTorrent client? I came across something called patch that i think provides Transmission function for the Buildroot busybox
http://buildroot-busybox.2317881.n4.nabble.com/PATCH-introducing-transmission-bittorrent-client-td7898.html
Is this the thing that does the thing? If so, how to go forward?
# uname -a
Linux Mammoth 3.2.0 #1 Tue Sep 8 14:42:47 CST 2015 armv7l GNU/Linux
You're confusing many things here. First "Buildroot Linaro" doesn't mean anything. Buildroot (http://buildroot.org) is an open-source project that provides an embedded Linux build system, Linaro (http://linaro.org) is a non-profit organization that enhances the support of the ARM architecture in the Linux eco-system. The main interaction between the two is that Buildroot can use a Linaro toolchain as the cross-compiler.
Indeed, there is nothing like "aptitude" on a Buildroot generated system, because we don't support binary packages. See http://buildroot.org/downloads/manual/manual.html#faq-no-binary-packages for details.
Finally, you're confusing Buildroot and Busybox. Busybox is a userspace application that provides a lightweight implementation of many basic Linux utilities. It is one of the 1600+ userspace packages provided by Buildroot.
Busybox definitely doesn't provide a Bittorent client. However, Buildroot indeed has a package for transmission.
So if you want to move forward, you need to get the source of the Buildroot that WD used to generate the firmware to your device, modify this Buildroot to add transmission, then re-build the filesystem using Buildrot, and finally flash it on your device.

How to install a bare Linux kernel without any distribution to study it?

I want to study the kernel of Linux without any distribution.
I found the LoadLin boatloader of Ms-dos, but i think it works only in older version of windows (windows 95,98, ME).
So i need to install the kernel only in my PC if Possible.
How I can install it?
The kernel only is not that much useful to you; you'll probably need some shell and a working compiler if you want to test things first-hand, and these are not part of the kernel.
There's a distribution called Linux From Scratch which basically allows you to install the kernel and then whatever other stuff you want, literally from scratch (as in, by compiling stuff yourself and only adding what YOU want)
I am wondering though, what is it exactly you want to study and how does having a distribution affect your studying of the kernel? (Yes, some distributions ship custom kernels but the major features are almost always the same)
Minimal Linux Live is a small script that:
downloads the source for the kernel and busybox
compiles them
generates a bootable 8Mb ISO with them
The ISO then leaves you in a minimal shell with busybox.
With QEMU you can then easily boot into the system, which might be a more convenient way to study the kernel.
Or you can just use the Live ISO as a regular distribution and install it on metal.
Usage:
git clone https://github.com/ivandavidov/minimal
cd minimal/src
./build_minimal_linux_live.sh
# Wait.
# Install QEMU.
# minimal_linux_live.iso was generated
./qemu64.sh
and you will be left inside a QEMU Window with you new minimal system. Awesome.
See also:
https://unix.stackexchange.com/questions/17122/is-it-possible-to-install-the-linux-kernel-alone
https://superuser.com/questions/307087/linux-distro-with-just-busybox-and-bash
Why not use a distribution? Just get some free VM (eg. virtualbox) and install an arbitrary Linux distribution. You have all the build tools there you need to compile the kernel, without actually touching your system.

Linux kernel on virtual machine

I am studying Linux driver programming and in it, it is recommended that I work on self-compiled Linux kernels and not any distributions. I have tried compiling Linux 2.6.9 in ubuntu but the process returns errors in 'make menuconfig' stage.
I would prefer to work with Linux in a virtual environment so that I can fearlessly experiment with the kernel. So, is there any way I can compile and run Linux in a virtual machine (say VMware installed on Windows)? I can use live CDs for the purpose of compiling the kernel.
So in short, please suggest, how can I compile, install and run Linux kernel in a virtual machine in an error-free way?
I searched and read this. But after following these steps when I restarted my computer there was no separate Linux 3.2.17 OS. But my ubuntu 12.04 was now showing 3.2.17 kernel. Although this is the first time I could compile a whole kernel on ubuntu without any error, I want to load that kernel on other partition and use it as an independent OS. So, if anyone can tell, what to do in addition to the steps in the tutorial so that I can achieve this?
The simplest thing to do is probably to install some Linux distribution on a VM, such as VMWare or VirtualBox, and continue from there. You could try using a live-cd, but I'm guessing that the lack of persistent storage might get irritating. There are, of course, ways around that, but installing some distribution is probably simpler, and you don't really need that much disk space for it if all you want to do is compile a kernel.
If all you want to do is compile a kernel module, and if you already have some pre-installed Linux environment, you should also note that modern Linux installations allow you to compile modules without the need to re-compile the entire kernel. You will need the kernel source and headers, though. See, for example, this document.
And BTW, speaking of modern kernels, why did you choose to use 2.6.9? It's almost 8 years old by now. Newer kernels might actually be easier to develop for. Also, there's no guarantee that
modules developed with such an old kernel would still work with current ones.
I suggest you to read this page. This document shows you how to boot your personal kernel on qemu and how to use the debugger on it.
Kernelnewbies is the right place to start kernel hacking. This website contains a set of rich tutorials about kernel hacking and tweaking just for newbie Linux developers. Also, you can join the community and start contributing to some tiny Linux projects.
For a quick start, follow the instruction from the "kernel first patch" tutorial. Since you're cloning the "origin" remote repository in this tutorial, you'll work on the latest branches of Linux kernel. So, there's no need to worry about working on an old version of Linux. Meanwhile, if you're not comfortable working with git trees, you can always download the latest version of Linux from front page of "kernel.org".

Resources