Tuesday, December 21, 2010

Steps to build your linux images on buildroot

Extract your buidroot_xxx_.tar.gz
cd into the buildroot directory
issue commands:
make distclean
make i386_defconfig

(if you are building image for i386 - for other processors - run 'make help' get to know what to use)
make menuconfig
(Now set whatever is required for your build. In the defconfig file name for the 'Kernel' give suffix as i386)
make

Thursday, April 8, 2010

configure: error: Can't find Tcl private headers

Pavan (pavangopalapurapu@gmail.com) and Segu Venkatesh (itsvenky86@gmail.com) came across this error while trying to configure Expect...

configure: configuring in testsuite
configure: running /bin/sh './configure' --prefix=/usr --cache-file=/dev/null --srcdir=.
loading cache /dev/null
checking for Tcl configuration... found /usr/lib/tclConfig.sh
checking Tcl build library... -L/usr/lib -ltcl8.5 -ldl -lieee -lm
checking for Tcl_CreateCommand... yes
checking if Tcl library build specification is valid... yes
checking for gcc... gcc
checking whether the C compiler (gcc ) works... yes
checking whether the C compiler (gcc ) is a cross-compiler... no
checking whether we are using GNU C... yes
checking whether gcc accepts -g... yes
checking whether the compiler (gcc) actually works... yes
checking how to run the C preprocessor... gcc -E
checking if running LynxOS... no
checking for Tcl private headers... checking for tclInt.h... no
configure: error: Can't find Tcl private headers
configure: error: /bin/sh './configure' failed for testsuite

Solution:
Install Expect from the source.. While issuing make:

make install-private-headers

Sunday, March 21, 2010

Segu Venkatesh (itsvenky86@gmail.com) came across this error while trying to buildroot a new kernel on the gmp module:

checking size of unsigned short... 2
checking for unsigned... yes
checking size of unsigned... 4
checking for unsigned long... yes
checking size of unsigned long... 4
checking for mp_limb_t... yes
checking size of mp_limb_t... 4
checking for stack_t... yes
checking for tputs in -lncurses... yes
checking for readline in -lreadline... no
checking readline detected... no
checking for bison... bison -y
checking for flex... flex
checking for yywrap in -lfl... yes
checking lex output file root... configure: error: cannot find output from flex; giving up
make: *** [/home/stars/buildroot-2010.02/output/build/gmp-4.2.4/.configured] Error 1


Solution:
in the buildroot-2010.02/output/build/gmp-4.2.4 directory create a file conftest.l having :

%%
%%


as content and do a make again.


Thursday, March 18, 2010

Initrd image for busybox

Here is a script to create initrd image for busybox:



#!/bin/bash



# 2006 by Marco Amrein, released into Public Domain, except the patch lines for

# .config, which are probably GPL'd and thus (C).



set -euv



BB=busybox-1.1.0



apt-get install wget gcc e2fsprogs || true



[ -f $BB.tar.gz ] || wget http://www.busybox.net/downloads/$BB.tar.gz || exit 1

[ -d $BB ] || tar xvfz $BB.tar.gz || exit 1



if [ ! -x $BB/busybox ] ; then

        cd $BB

        make clean

        make allyesconfig

 patch <<__endconfpatch__ span="">

--- .config.orig 2006-02-11 18:03:59.000000000 +0100

+++ .config 2006-02-11 18:05:08.000000000 +0100

@@ -24,5 +24,5 @@

 # Build Options

 #

-# CONFIG_STATIC is not set

+CONFIG_STATIC=y

 CONFIG_LFS=y

 # USING_CROSS_COMPILER is not set

@@ -511,9 +511,9 @@

 # Shells

 #

-# CONFIG_FEATURE_SH_IS_ASH is not set

+CONFIG_FEATURE_SH_IS_ASH=y

 # CONFIG_FEATURE_SH_IS_HUSH is not set

 # CONFIG_FEATURE_SH_IS_LASH is not set

 # CONFIG_FEATURE_SH_IS_MSH is not set

-CONFIG_FEATURE_SH_IS_NONE=y

+# CONFIG_FEATURE_SH_IS_NONE is not set

 CONFIG_ASH=y

 

__ENDCONFPATCH__

 make oldconfig

        make

        cd ..

fi



dd if=/dev/zero of=bb-initrd.img count=1 bs=12M

mke2fs -F -i 1024 bb-initrd.img



mkdir -p bb-initrd

mount -o loop bb-initrd.img bb-initrd



cp -a /dev/.static/dev bb-initrd

mkdir bb-initrd/proc

mkdir bb-initrd/bin

mkdir bb-initrd/sbin

mkdir bb-initrd/tmp

chmod 1777 bb-initrd/tmp

mkdir bb-initrd/mnt

mkdir bb-initrd/etc

mkdir bb-initrd/etc/init.d

touch bb-initrd/etc/mtab



cp -a $BB/busybox bb-initrd/bin/



mount -t proc proc bb-initrd/proc

chroot bb-initrd /bin/busybox --install -s

umount bb-initrd/proc



cat >bb-initrd/etc/init.d/rcS <

#! /bin/sh

/bin/mount -t proc proc proc

#echo go for it!

/bin/ash

EOFrcS



chmod 755 bb-initrd/etc/init.d/rcS



umount bb-initrd



gzip -9 bb-initrd.img



echo 'We are done...'



Thanks Marco Amrein!




/usr/bin/ld: cannot find -lcrypt

Segu Venkatesh (itsvenky86@gmail.com) came across this issue while building BusyBox static:

LINK busybox_unstripped
Trying libraries: crypt m
Failed: -Wl,--start-group -lcrypt -lm -Wl,--end-group
Output of:
gcc -Wall -Wshadow -Wwrite-strings -Wundef -Wstrict-prototypes -Wunused -Wunused-parameter -Wunused-function -Wunused-value -Wmissing-prototypes -Wmissing-declarations -Wdeclaration-after-statement -Wold-style-definition -fno-builtin-strlen -finline-limit=0 -fomit-frame-pointer -ffunction-sections -fdata-sections -fno-guess-branch-probability -funsigned-char -static-libgcc -falign-functions=1 -falign-jumps=1 -falign-labels=1 -falign-loops=1 -Os -march=i386 -mpreferred-stack-boundary=2 -static -o busybox_unstripped -Wl,--sort-common -Wl,--sort-section,alignment -Wl,--start-group applets/built-in.o archival/lib.a archival/libunarchive/lib.a console-tools/lib.a coreutils/lib.a coreutils/libcoreutils/lib.a debianutils/lib.a e2fsprogs/lib.a editors/lib.a findutils/lib.a init/lib.a libbb/lib.a libpwdgrp/lib.a loginutils/lib.a mailutils/lib.a miscutils/lib.a modutils/lib.a networking/lib.a networking/libiproute/lib.a networking/udhcp/lib.a printutils/lib.a procps/lib.a runit/lib.a selinux/lib.a shell/lib.a sysklogd/lib.a util-linux/lib.a util-linux/volume_id/lib.a archival/built-in.o archival/libunarchive/built-in.o console-tools/built-in.o coreutils/built-in.o coreutils/libcoreutils/built-in.o debianutils/built-in.o e2fsprogs/built-in.o editors/built-in.o findutils/built-in.o init/built-in.o libbb/built-in.o libpwdgrp/built-in.o loginutils/built-in.o mailutils/built-in.o miscutils/built-in.o modutils/built-in.o networking/built-in.o networking/libiproute/built-in.o networking/udhcp/built-in.o printutils/built-in.o procps/built-in.o runit/built-in.o selinux/built-in.o shell/built-in.o sysklogd/built-in.o util-linux/built-in.o util-linux/volume_id/built-in.o -Wl,--end-group -Wl,--start-group -lcrypt -lm -Wl,--end-group
==========
/usr/bin/ld: cannot find -lcrypt
collect2: ld returned 1 exit status
make: *** [busybox_unstripped] Error 1
The Solution is:
yum install glibc-static


Wednesday, March 17, 2010

ln: creating symbolic link `/media/cf1//bin/addgroup': Operation not permitted

Segu Venkatesh (itsvenky86@gmail.com) came across this error:

[root@localhost busybox-1.16.0]# make CONFIG_PREFIX=/media/cf1/ install
/media/cf1//bin/addgroup -> busybox
ln: creating symbolic link `/media/cf1//bin/addgroup': Operation not permitted
make: *** [install] Error 1

Solution:
You are using a vfat file system on the media which will not allow you to create system links. It is a limitation on the vfat system side I guess.

Tuesday, March 16, 2010

/usr/bin/ld: cannot find -lc

Segu Venkatesh (itsvenky86@gmail.com) forwarded me this error, Which is more of a common nature:

make[1]: Entering directory `/home/stars/buildroot-2010.02/output/toolchain/module-init-tools-3.2.2'
/usr/lib/ccache/gcc -g -O2 -Wunused -Wall -o lsmod lsmod.o
/usr/lib/ccache/gcc -g -O2 -Wunused -Wall -o insmod insmod.o
/usr/lib/ccache/gcc -g -O2 -Wunused -Wall -o modprobe modprobe.o zlibsupport.o
/usr/lib/ccache/gcc -g -O2 -Wunused -Wall -o rmmod rmmod.o
/usr/lib/ccache/gcc -g -O2 -Wunused -Wall -o depmod depmod.o moduleops.o tables.o zlibsupport.o
/usr/lib/ccache/gcc -g -O2 -Wunused -Wall -o modinfo modinfo.o zlibsupport.o
/usr/lib/ccache/gcc -g -O2 -Wunused -Wall -o insmod.static -static insmod.o
/usr/bin/ld: cannot find -lc
collect2: ld returned 1 exit status
make[1]: *** [insmod.static] Error 1
make[1]: *** Waiting for unfinished jobs....
make[1]: Leaving directory `/home/stars/buildroot-2010.02/output/toolchain/module-init-tools-3.2.2'
make: *** [/home/stars/buildroot-2010.02/output/toolchain/module-init-tools-3.2.2/depmod] Error 2


The solution is simple:
In the command window:
$ set CC=gcc