How To Create A Very Small Linux System Using Buildroot - Agent OSS
How To Create A Very Small Linux System Using Buildroot - Agent OSS
Agent OSS
Home
About
2 Votes
Follow
How to create a very small Linux system using Buildroot | Agent OSS
very small (embedded) Linux system (targeted at a standard intel x86 computer)
Buildroot :
Sign me up
http://buildroot.uclibc.org/
Documentation :
Powered by WordPress.com
http://buildroot.uclibc.org/buildroot.html
Prior to using it, youll have to install a development environment on your system (GCC
compiler, Linux kernel headers, make tools etc). On Debian/Ubuntu, this is done by
installing packages such as :
build-essentials
First of all, we need to download and setup Buildroot on our build machine.
As a standard user (not root) :
# cd
# wget http://buildroot.uclibc.org/downloads/buildroot-snapshot.tar.bz2
# tar xvjf buildroot*
# cd buildroot
Buildroot Configuration
# make menuconfig
http://agentoss.wordpress.com/2011/02/27/how-to-create-a-very-small-linux-system-using-buildroot/[23/7/2013 14:30:39]
How to create a very small Linux system using Buildroot | Agent OSS
http://agentoss.wordpress.com/2011/02/27/how-to-create-a-very-small-linux-system-using-buildroot/[23/7/2013 14:30:39]
How to create a very small Linux system using Buildroot | Agent OSS
- some lightweight networking apps : dropbear (SSH server) , thttpd (ultra small http server)
Networking applications >
[X] dropbear
[X] thttpd
- I like the nano text editor too
Text editors and viewers >
[X] nano
Target filesystem options >
[X] initramfs for initial ramdisk of linux kernel
Uncheck the other options.
This way, our system files (rootfs) will be contained within the kernel file, and loaded into
RAM by the kernel.
(note : cramfs does the same, but is older and limited to a 16Meg rootfs max.)
Bootloaders >
Uncheck everything here. We will test our image using qemu so we dont need a bootloader
yet. If you want to put your embedded system on a bootable USB drive, you can use
SYSLINUX/EXTLINUX to make it bootable (see here!).
Kernel >
[X] Linux Kernel
Important :
in Defconfig name, enter the value : i386
it corresponds to the linux-2.6.37/arch/x86/configs/i386_defconfig file
http://agentoss.wordpress.com/2011/02/27/how-to-create-a-very-small-linux-system-using-buildroot/[23/7/2013 14:30:39]
How to create a very small Linux system using Buildroot | Agent OSS
(otherwise the build system will complain that it couldnt find a kernel configuration file).
Now select Exit to end the Buildroot configuration, save the changes of course (These
settings are stored in the .config file in the Buildroot directory).
Its time to start compiling!
# make
The first compilation will take some time, as software packages for the toolchain and other
components are downloaded, extracted and compiled on your build machine!
TIP :
If you need to configure the linux kernel for your special needs (youll likely have to) :
# make linux-menuconfig
Important especially : remember to include support for the EXT2 filesystem in your kernel, if
you want to be able to mount EXT2 formatted devices (usb flash drive for example) from
your embedded system!
If everything went well, the compilation is finished and your final system files (kernel and
optional boot and rootfs files) will be found in the output/images sub-directory of your
Buildroot.
In our example, we can see that the obtained kernel file : bzImage, is very small (above 5
megs, with and LZMA compressed initramfs filesystem)!
TIP
To force the complete rebuild of your embedded system :
# rm -rf output/build
# make
How to create a very small Linux system using Buildroot | Agent OSS
# udhcpc eth0
look at the busybox available commands :
# busybox
TIP
load a keymap :
# loadkeys fr
Ok, we have a new system, but some things have to be improved in order to make it more
usable. We are going to apply changes to the root filesystem (rootfs) before its included in
the kernel by Buildroots make process.
Wed like, amongst other things :
- that our preferred keymap be automatically loaded,
- the network to be automatically up and running,
etc
To do that, changes will be applied in the rootfs files contained in Buildroots output/target
http://agentoss.wordpress.com/2011/02/27/how-to-create-a-very-small-linux-system-using-buildroot/[23/7/2013 14:30:39]
How to create a very small Linux system using Buildroot | Agent OSS
subdir.
For the keymap :
# cd output/target
# nano etc/init.d/S99keymap
- file S99keymap
#!/bin/sh
loadkeys fr
- file S99keymap
# chmod 755 etc/init.d/S99keymap
and then the S99keymap file contains the following line instead :
loadkmap </etc/fr.kmap
For the network configuration, we modify the etc/network/interfaces file :
# nano etc/network/interfaces
# Configure Loopback
auto lo
http://agentoss.wordpress.com/2011/02/27/how-to-create-a-very-small-linux-system-using-buildroot/[23/7/2013 14:30:39]
How to create a very small Linux system using Buildroot | Agent OSS
SECURITY enhancements :
- Change the root password :
There maybe other ways to do the trick, but I found this one to be working :
# apt-get install mkpasswd
# echo 'mynewpassword' | mkpasswd -s -m md5
http://agentoss.wordpress.com/2011/02/27/how-to-create-a-very-small-linux-system-using-buildroot/[23/7/2013 14:30:39]
How to create a very small Linux system using Buildroot | Agent OSS
default:LK:10933:0:99999:7:::
(LK is for locked)
Other modifications (may be useful, some more testing needed!) :
To improve device hotplug support, add the two following lines
null::sysinit:/bin/echo /sbin/mdev >/proc/sys/kernel/hotplug
null::sysinit:/sbin/mdev -s
in the output/target/etc/inittab file. So that it looks :
etc/inittab
etc/inittab
Final generation of our embedded Linux system :
go back to the Buildroot directory, then
# make
TIP :
If you delete the whole output subir, your changes in the output/target rootfs will be lost
(obviously!) so it may be more convenient to make your changes in the fs/skeleton subdir,
so that they will be used when generating the target subdir.
http://agentoss.wordpress.com/2011/02/27/how-to-create-a-very-small-linux-system-using-buildroot/[23/7/2013 14:30:39]
How to create a very small Linux system using Buildroot | Agent OSS
There is still plenty of work to do in our embedded system, but youve got the process
uncovered.
About these ads
If You Want To Be
Awesome At Emails, Add
by Gravity
Share this:
Like this:
Digg
StumbleUpon
Like
Be the first to like this.
This entry was posted in Howto, Linux and tagged buildroot, embedded, lightweight, linux, smallest, system, tiny.
Bookmark the permalink.
hi,
http://agentoss.wordpress.com/2011/02/27/how-to-create-a-very-small-linux-system-using-buildroot/[23/7/2013 14:30:39]
How to create a very small Linux system using Buildroot | Agent OSS
I followed your procedure, but i am getting kernel panic when I emulate using qemu.
please help me. what is your build environment?
Cheers,
Venkat
Reply
AgentOss says:
18/08/2011 at 10:49
Hi
Im using a Debian 6.0 virtual machine (VirtualBox) for my buildroot environment.
Try starting qemu with -m 256 (to emulate 256Megs of RAM). By default qemu
uses 128Megs, which might not be nough for bigger kernels.
If that doesnt still work, please show a screen capture and your qemu line
Reply
venkat says:
18/08/2011 at 11:43
Thank you so much for the response. I shall try that and I get back to you .
Cheers,
Venkat
Reply
http://agentoss.wordpress.com/2011/02/27/how-to-create-a-very-small-linux-system-using-buildroot/[23/7/2013 14:30:39]
How to create a very small Linux system using Buildroot | Agent OSS
David J says:
07/01/2012 at 07:08
Hi,
I followed your steps, but in the end the qemu hangs on starting tftpd.. After googling,
it seems it didnt start console on serial port, but I cant figure out what is the next. The
inittab looks have the right ttyS0:
# Put a getty on the serial port
ttyS0::respawn:/sbin/getty -L ttyS0 38400 vt100 # GENERIC_SERIAL
Can you help?
Reply
AgentOss says:
07/01/2012 at 13:31
Hi,
Looks like that we need to use tty1 instead of ttyS0 !
Then youll have a login prompt in your buildroot system.
Im updating this howto
Thanks & have fun!
Reply
David J says:
07/01/2012 at 17:41
Its working perfectly. This will be my starting point and look forward to reducing the
memory consumption. Do you have any suggestion or link?
http://agentoss.wordpress.com/2011/02/27/how-to-create-a-very-small-linux-system-using-buildroot/[23/7/2013 14:30:39]
How to create a very small Linux system using Buildroot | Agent OSS
AgentOss says:
07/01/2012 at 22:17
Good!
What are your memory requirements?
You could configure the kernel to remove unneeded drivers and features, but this
wont give a big gain in memory consumption.
I found that a minimal buildroot generated system (no X) with initramfs embedded
within the kernel needs at least 27M of RAM to boot, not less.
If you have less RAM, you might try to generate a kernel with no embedded
initramfs, but then you need to create a virtual hard disk with the root filesystem on
it (when using qemu).
Reply
David J says:
08/01/2012 at 07:07
AgentOss says:
http://agentoss.wordpress.com/2011/02/27/how-to-create-a-very-small-linux-system-using-buildroot/[23/7/2013 14:30:39]
How to create a very small Linux system using Buildroot | Agent OSS
08/01/2012 at 21:00
stewe says:
05/02/2012 at 21:12
hi
how it is possible that you have eth0 device present in the system? I do it by virtualbox
and there is only lo device and sit0, i do the same with qemu but theres no eth0 at all
what should i do in order to setup networking? thx
Reply
http://agentoss.wordpress.com/2011/02/27/how-to-create-a-very-small-linux-system-using-buildroot/[23/7/2013 14:30:39]
How to create a very small Linux system using Buildroot | Agent OSS
AgentOss says:
05/02/2012 at 21:29
Hi,
Have you configured your kernel with the ethernet drivers? (include them all in
doubt)
Also, paste your dmesg to pastebin and give us the link here so we can see whats
happening
Reply
stewe says:
05/02/2012 at 23:44
ive got it, i had to compile some additional network driver to the kernel
(Intel(R) 82575/82576 PCI-Express Gigabit Ethernet support + Intel(R) 82576
Virtual Function Ethernet support) and switch network adapter in vmware
setting like Intel PRO/1000 MT Desktop (82540EM) under network adapter 1
advanced settings
Peter says:
18/01/2013 at 16:05
I tried to preapre my own linux by buildroot but after changed of ttyS0 to ttyS1 I still
cannot see login promt, it hangs after dropbear dsa key generated. I didnt add thttpd. I
have tried to change baudrate and ttyS to higher but after two days of compiling my
kernel still hangs after dropbear
Reply
AgentOss says:
18/01/2013 at 18:08
http://agentoss.wordpress.com/2011/02/27/how-to-create-a-very-small-linux-system-using-buildroot/[23/7/2013 14:30:39]
How to create a very small Linux system using Buildroot | Agent OSS
Peter says:
18/01/2013 at 18:33
Antoine says:
12/02/2013 at 15:38
http://agentoss.wordpress.com/2011/02/27/how-to-create-a-very-small-linux-system-using-buildroot/[23/7/2013 14:30:39]
How to create a very small Linux system using Buildroot | Agent OSS
AgentOss says:
12/02/2013 at 18:03
xsmos says:
18/02/2013 at 18:47
I said I followed your tutorial to the letter but the launch of the initramfs image with the
launch qemu hangs a thttpd server initialization
my config is as follows
Lubuntu 12.04 X64
Intel core I3
6 giga ram
please help me thank you
Reply
AgentOss says:
18/02/2013 at 19:01
maybe a problem with tty1 not enabled (see the other comments above)
Reply
Peter says:
03/03/2013 at 12:31
Hi,
http://agentoss.wordpress.com/2011/02/27/how-to-create-a-very-small-linux-system-using-buildroot/[23/7/2013 14:30:39]
How to create a very small Linux system using Buildroot | Agent OSS
How can I build a system with buildroot which will be remember changes which I made
on harddrive? So it will remember changes which I made in rootfs.cpio filesystem, or it
will remember that Ive added some new software.
Regards,
Piotr
Reply
AgentOss says:
03/03/2013 at 14:31
Hi, I havent experimented that kind of things yet But look at Slitaz, or even Slax.
They have different mechanisms to do what you are looking for
Reply
Albert says:
06/04/2013 at 09:17
after the configuration and when i excute the make command i get this error message
:
2013-04-06 08:12:51 http://ftp.gnu.org/pub/gnu/gmp/gmp-5.0.2.tar.bz2
Connecting to 192.168.110.80:8080 failed: Connection timed out.
Retrying.
2013-04-06 08:13:13 (try: 2) http://ftp.gnu.org/pub/gnu/gmp/gmp-5.0.2.tar.bz2
Connecting to 192.168.110.80:8080 failed: Connection timed out.
Retrying.
2013-04-06 08:13:36 (try: 3) http://ftp.gnu.org/pub/gnu/gmp/gmp-5.0.2.tar.bz2
Connecting to 192.168.110.80:8080 failed: Connection timed out.
Giving up.
http://agentoss.wordpress.com/2011/02/27/how-to-create-a-very-small-linux-system-using-buildroot/[23/7/2013 14:30:39]
How to create a very small Linux system using Buildroot | Agent OSS
AgentOss says:
06/04/2013 at 12:21
It looks like you are behind a proxy that prevents you from downloading
Check your network / ask your sysadmin!
Reply
Albert says:
06/04/2013 at 22:21
when i excute:
# qemu -kernel output/images/bzImage
i get this message :
pci_add_option_rom: failed to find romfile pxe-rtl8139.bin
Reply
http://agentoss.wordpress.com/2011/02/27/how-to-create-a-very-small-linux-system-using-buildroot/[23/7/2013 14:30:39]
How to create a very small Linux system using Buildroot | Agent OSS
Alfred says:
10/04/2013 at 09:26
AgentOss says:
10/04/2013 at 18:23
Maybe your ethernet driver (module) is missing. Verify that you have it in your
kernel config.
Reply
Leave a Reply
Enter your comment here...
Search
Recent Posts
Wifi repeater/range extenderscript
Debian 6.0 (Squeeze) on the Xplore iX104C3 rugged TabletPC
Debian Wheezy andsystemd
Home mail server with Postfix + Dovecot (IMAP) + Squirrelmail/Roundcube on NetBSD6.0.1
Wireless Ad-hoc serverscript
http://agentoss.wordpress.com/2011/02/27/how-to-create-a-very-small-linux-system-using-buildroot/[23/7/2013 14:30:39]
How to create a very small Linux system using Buildroot | Agent OSS
Categories
Arch
Bash scripts
BSD
Debian
Howto
Linux
Mageia
Tags
3130 access point AMD apache arch backtrack bootable bootloader brazos bridge buildroot busybox
compact flash compilation configuration crux
extlinux fast boot fedora fglrx g4 hardware hibernation hotspot ibm imac g3
lightweight linux macintosh mageia mandriva mp3 netbook netboot netinstall old computer openbsd
opensuse package manager pclinuxos player ports powermac powerpc recycled review server simple
smallest sony vaio syslinux
system thinkpad 365x tiny touchpad ubuntu usb wifi windows wireless x xfce
xorg zacate
Archives
SelectMonth
Month
Select
Links
BSD Guides
Distrowatch
HowtoForge
LinuxQuestions
Mageia Linux
nixCraft
http://agentoss.wordpress.com/2011/02/27/how-to-create-a-very-small-linux-system-using-buildroot/[23/7/2013 14:30:39]
How to create a very small Linux system using Buildroot | Agent OSS
February 2011
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
Mar
Follow
RSS
RSS - Posts
RSS - Comments
http://agentoss.wordpress.com/2011/02/27/how-to-create-a-very-small-linux-system-using-buildroot/[23/7/2013 14:30:39]
How to create a very small Linux system using Buildroot | Agent OSS
http://agentoss.wordpress.com/2011/02/27/how-to-create-a-very-small-linux-system-using-buildroot/[23/7/2013 14:30:39]