Compiling Linux

49 views
Skip to first unread message

Donna

unread,
Oct 9, 2011, 5:05:59 AM10/9/11
to linuxstamp
Hey guys,

Thanks again fro helping me get my board going, I have been having fun
with it. I want to make a wireless USB modem work on it. So far I have
been using the pre-compiled kernel and FS I dowloaded from
http://linuxstamp.budgetdedicated.com/, it seems pretty good but my
USB device is not working (the usbserial is not compiled as a module I
think which makes it not modswitchable ? or at least that is what I
think from various postings around).

I am thinking maybe I should learn how to compile my own linux and
kernel. I tried to follow the steps and I downloaded that crosstool
http://kegel.com/crosstool/. I have a laptop with Ubuntu 10 on it, I
was trying to load it on there, it seemed promising, but it complains
about some version numbers of as and ld in binutils.

I am wondering what you guys are using ? I googled around and there
are a lot of packages out there, it is hard to know which direction to
go.

Any advice for the newbie ?

Thank you !

Michael

unread,
Oct 10, 2011, 6:49:13 PM10/10/11
to linuxstamp
You should only have to worry about this for compiling crosstool
itself. We have scripts which automate things like that, and they use
the following 'binutils.sh' script to set up the prerequisites for
crosstool and undo them at the end of the crosstool make (i.e. put
them back to normal for you system). Anyhow, here is our binutils.sh
script:

##################################################################

#!/bin/bash

# Turn on or off the backlevel binutils (as and ld) in the /usr/bin
# folder via symlink manipulation. If the necessary precursors are
# not yet in place, install them. If the precursors are already in
# place but binutils has been reinstalled, /usr/bin/as will not be
# a symlink, so we need to re-snapshot the 'new' utilities.

if [ -f '/usr/bin/as-orig' ]; then
if [ ! -h '/usr/bin/as' ]; then
echo '### Reinstallation of binutils detected - updating!'
sudo cp -p /usr/bin/as /usr/bin/as-orig
if [ -f '/usr/bin/ld.bfd' ]; then
sudo cp -p /usr/bin/ld.bfd /usr/bin/ld-orig
else
sudo cp -p /usr/bin/ld /usr/bin/ld-orig
fi
fi
else
echo '### Switchable binutils not found - reinstalling!'
sudo cp -p /usr/bin/as /usr/bin/as-orig
if [ -f '/usr/bin/ld.bfd' ]; then
sudo cp -p /usr/bin/ld.bfd /usr/bin/ld-orig
else
sudo cp -p /usr/bin/ld /usr/bin/ld-orig
fi
sudo cp -p $homedir/bin/as-2.18 /usr/bin
sudo cp -p $homedir/bin/ld-2.18 /usr/bin
sudo cp -p $homedir/bin/lib* /usr/lib
fi

if [ "$1" = 'old' ]; then
echo 'Backlevel binutils now active'
sudo ln -sf /usr/bin/as-2.18 /usr/bin/as
sudo ln -sf /usr/bin/ld-2.18 /usr/bin/ld
else
echo 'Original binutils now active'
sudo ln -sf /usr/bin/as-orig /usr/bin/as
sudo ln -sf /usr/bin/ld-orig /usr/bin/ld
fi

##################################################################

To use it, before trying to compile crosstool, issue:

./binutils.sh old

Then afterwards issue;

./binutils.sh

Hope this helps you to at least get a handle on this issue.


- Michael

On Oct 9, 5:05 am, Donna <donna.pol...@gmail.com> wrote:
> Hey guys,
>
> Thanks again fro helping me get my board going, I have been having fun
> with it. I want to make a wireless USB modem work on it. So far I have
> been using the pre-compiled kernel and FS I dowloaded fromhttp://linuxstamp.budgetdedicated.com/, it seems pretty good but my
> USB device is not working (the usbserial is not compiled as a module I
> think which makes it not modswitchable ? or at least that is what I
> think from various postings around).
>
> I am thinking maybe I should learn how to compile my own linux and
> kernel. I tried to follow the steps and I downloaded that crosstoolhttp://kegel.com/crosstool/. I have a laptop with Ubuntu 10 on it, I

Michael

unread,
Oct 10, 2011, 6:53:23 PM10/10/11
to linuxstamp
Just looked at the script, and realized that it depends on you having
in your home directory a folder named 'bin' which contains the 2.18
versions of the ld and as binaries and their prerequisite lib* files.
You should be able to get those from any of various repositories.

- Michael

Michael

unread,
Oct 10, 2011, 6:56:27 PM10/10/11
to linuxstamp
And of course the calling script had this in it which I also forgot to
mention:

homedir=`pwd`

The joys of nested dependencies...

- Michael

Donna

unread,
Oct 11, 2011, 12:24:21 AM10/11/11
to linuxstamp
Cool, thank you, I will try this, but I don't care about undoing it
back, I am running the Ubuntu on Virtualbox so I dont care, once it is
set up to do the cross compile then that will be my little cross
compiler virtual machine :)
> > Thank you !- Hide quoted text -
>
> - Show quoted text -

Donna

unread,
Oct 11, 2011, 1:29:35 AM10/11/11
to linuxstamp
Well, that helped, so here's where I am now, this is the output:
------------------------------------------------------
donna@donna-ubuntu:~/Desktop/linuxstamp/linux-2.6.36$ make -B ARCH=arm
CROSS_COMPILE=arm-linux drivers serial
make: arm-linuxgcc: Command not found
# Do not try to update included dependency files
# Do not try to update included dependency files
# Do not try to update included dependency files
# Do not try to update included dependency files
# Do not try to update included dependency files
# Do not try to update included dependency files
# Do not try to update included dependency files
# Do not try to update included dependency files
# Do not try to update included dependency files
# Do not try to update included dependency files
# Do not try to update included dependency files
# Do not try to update included dependency files
SHIPPED scripts/kconfig/zconf.tab.c
SHIPPED scripts/kconfig/lex.zconf.c
SHIPPED scripts/kconfig/zconf.hash.c
HOSTCC scripts/kconfig/zconf.tab.o
HOSTLD scripts/kconfig/conf
scripts/kconfig/conf -s arch/arm/Kconfig
make: arm-linuxgcc: Command not found
CHK include/linux/version.h
Generating include/asm-arm/mach-types.h
CHK include/linux/utsrelease.h
SYMLINK include/asm -> include/asm-arm
CC kernel/bounds.s
/bin/sh: arm-linuxgcc: not found
make[1]: *** [kernel/bounds.s] Error 127
make: *** [prepare0] Error 2
donna@donna-ubuntu:~/Desktop/linuxstamp/linux-2.6.36$ ^C
donna@donna-ubuntu:~/Desktop/linuxstamp/linux-2.6.36$
------------------------------------------------------

Seems like maybe it can not find "arm-linuxgcc"

Here is the crosstoolconfig.sh I am running, I run this right before
doing the make command:
Maybe I do not have something set right.

------------------------------------------------------
AR=
BINUTILS_DIR=binutils-2.15
BINUTILS_EXTRA_CONFIG=
BUILD=i686-pc-linux-gnu
BUILD_DIR=/home/donna/Desktop/linuxstamp/crosstool-0.43/build/arm-
linux/gcc-3.4.5-glibc-2.3.6
CC=
DEJAGNU=
EXTRA_TARGET_CFLAGS=
GCC_BUILD=
GCC_CORE_DIR=gcc-3.4.5
GCC_DIR=gcc-3.4.5
GCC_EXTRA_CONFIG=
GCC_HOST=
GCC_LANGUAGES=c,c++
GDB_DIR=
GLIBC_ADDON_OPTIONS==linuxthreads,
GLIBC_DIR=glibc-2.3.6
GLIBC_EXTRA_CC_ARGS=
GLIBC_EXTRA_CONFIG=
GLIBC_EXTRA_ENV=
JUST_DOWNLOAD=
KERNELCONFIG=/home/donna/Desktop/linuxstamp/crosstool-0.43/arm.config
LINUX_DIR=linux-2.6.8
LINUX_SANITIZED_HEADER_DIR=linux-libc-headers-2.6.12.0
NO_DOWNLOAD=
PREFIX=/opt/crosstool/gcc-3.4.5-glibc-2.3.6/arm-linux
PTXDIST_DIR=
SHARED_MODE=--enable-shared
SRC_DIR=/home/donna/Desktop/linuxstamp/linux-2.6.36
TARBALLS_DIR=/home/donna/Downloads
TARGET=arm-linux
TARGET_CFLAGS=-O
TOP_DIR=/home/donna/Desktop/linuxstamp/crosstool-0.43/build/arm-linux/
gcc-3.4.5-glibc-2.3.6
USE_SYSROOT=
------------------------------------------------------

Paul Thomas

unread,
Oct 11, 2011, 1:58:28 AM10/11/11
to linux...@googlegroups.com
You'll want to add the result of what crosstool builds to your path,
something like:
export PATH=$PATH:/opt/arm-unknown-linux-gnueabi/bin/

Then you need to make sure arm-linux is the correct prefix, the one I use is:
ARCH=arm CROSS_COMPILE=arm-unknown-linux-gnueabi-

where arm-unknown-linux-gnueabi-gcc is in /opt/arm-unknown-linux-gnueabi/bin/

thanks,
Paul

> --
> You received this message because you are subscribed to the Google Groups "linuxstamp" group.
> To post to this group, send email to linux...@googlegroups.com.
> To unsubscribe from this group, send email to linuxstamp+...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/linuxstamp?hl=en.
>
>

Donna

unread,
Oct 11, 2011, 2:00:41 AM10/11/11
to linuxstamp
ALso I tried this:
donna@donna-ubuntu:~/Desktop/linuxstamp/linux-2.6.36$ sudo make -B
ARCH=arm CROSS_COMPILE=arm-linux- modules
make: arm-linux-gcc: Command not found
# Do not try to update included dependency files
# Do not try to update included dependency files
.
.
.
.

Мал Скрылёв

unread,
Oct 11, 2011, 3:42:04 AM10/11/11
to linux...@googlegroups.com
2011/10/11 Donna <donna....@gmail.com>:

> ALso I tried this:
> donna@donna-ubuntu:~/Desktop/linuxstamp/linux-2.6.36$ sudo make -B
> ARCH=arm CROSS_COMPILE=arm-linux- modules
> make: arm-linux-gcc: Command not found

Donna, please provie us with a result of the following command:

$ find / -name "arm-linux-gcc"

--
Малъ Зануда, Скрылёвъ сынъ

Donna

unread,
Oct 11, 2011, 1:23:32 PM10/11/11
to linuxstamp
Thank you for your help, here is the result of that command, I wonder
if there is an environment variable that needs to point to one of
these locations ?

donna@donna-ubuntu:~$ sudo find / -name "arm-linux-gcc"
[sudo] password for donna:

/home/donna/Desktop/linuxstamp/crosstool-0.43/build/arm-linux/
gcc-3.4.5-glibc-2.3.6/bin/arm-linux-gcc
/home/donna/Desktop/linuxstamp/crosstool-0.43/build/arm-linux/
gcc-3.4.5-glibc-2.3.6/distributed/bin/arm-linux-gcc
/home/donna/Desktop/linuxstamp/sw/gcc-3.4.5-glibc-2.3.6/arm-linux/
distributed/bin/arm-linux-gcc
/home/donna/.local/share/Trash/files/distributed/bin/arm-linux-gcc
/opt/crosstool/gcc-3.4.5-glibc-2.3.6/arm-linux/bin/arm-linux-gcc
donna@donna-ubuntu:~$


On Oct 11, 12:42 am, Мал Скрылёв <3ah...@gmail.com> wrote:
> 2011/10/11 Donna <donna.pol...@gmail.com>:

Paul Thomas

unread,
Oct 11, 2011, 1:28:07 PM10/11/11
to linux...@googlegroups.com
Yes, you can add it to your path with something like:
export PATH=$PATH:/home/donna/Desktop/linuxstamp/crosstool-0.43/build/arm-linux/gcc-3.4.5-glibc-2.3.6/bin/arm-linux-gcc

Just to test it you can type 'arm-linux-gcc' and you should get
something back like 'arm-linux-gcc: no input files'

thanks,
Paul

2011/10/11 Donna <donna....@gmail.com>:

Donna

unread,
Oct 11, 2011, 2:27:25 PM10/11/11
to linuxstamp
Thanks Paul, that helped, also had to chmod a few of the folders. Now
I get this, it seems like now it is not finding as, probably the path
to binutils I am guessing. I will search around and see if I can track
this one down.


donna@donna-ubuntu:~/Desktop/linuxstamp/linux-2.6.36$ make ARCH=arm
CROSS_COMPILE=arm-linux- modules
CHK include/linux/version.h
make[1]: `include/asm-arm/mach-types.h' is up to date.
CHK include/linux/utsrelease.h
SYMLINK include/asm -> include/asm-arm
CALL scripts/checksyscalls.sh
<stdin>:1097:2: warning: #warning syscall fadvise64 not implemented
<stdin>:1265:2: warning: #warning syscall migrate_pages not
implemented
<stdin>:1321:2: warning: #warning syscall pselect6 not implemented
<stdin>:1325:2: warning: #warning syscall ppoll not implemented
<stdin>:1365:2: warning: #warning syscall epoll_pwait not implemented
HOSTCC scripts/mod/file2alias.o
gcc: error trying to exec 'as': execvp: No such file or directory
make[2]: *** [scripts/mod/file2alias.o] Error 1
make[1]: *** [scripts/mod] Error 2
make: *** [scripts] Error 2


On Oct 11, 10:28 am, Paul Thomas <pthomas8...@gmail.com> wrote:
> Yes, you can add it to your path with something like:
> export PATH=$PATH:/home/donna/Desktop/linuxstamp/crosstool-0.43/build/arm-linux/gcc-3.4.5-glibc-2.3.6/bin/arm-linux-gcc
>
> Just to test it you can type 'arm-linux-gcc' and you should get
> something back like 'arm-linux-gcc: no input files'
>
> thanks,
> Paul
>
> 2011/10/11 Donna <donna.pol...@gmail.com>:

Paul Thomas

unread,
Oct 11, 2011, 2:48:21 PM10/11/11
to linux...@googlegroups.com
You should have a arm-linux-as in the same path with the same
permissions as arm-linux-gcc.

thanks,
Paul

2011/10/11 Donna <donna....@gmail.com>:

Donna

unread,
Oct 11, 2011, 3:43:41 PM10/11/11
to linuxstamp
it is, but look at this, it is trying to compile file2alias.o which is
in scripts/mod, those all are script commands that need to be compiled
as x86 to run on the host not the target, I think that is where it is
bombing. It seems like maybe there is a dicotomy, it needs the up to
date binutils to compile the script utilities but the old binutils to
compile the arm target hmmm.

Frustrating....

<stdin>:1365:2: warning: #warning syscall epoll_pwait not implemented
HOSTCC scripts/mod/file2alias.o
gcc: error trying to exec 'as': execvp: No such file or directory

On Oct 11, 11:48 am, Paul Thomas <pthomas8...@gmail.com> wrote:
> You should have a arm-linux-as in the same path with the same
> permissions as arm-linux-gcc.
>
> thanks,
> Paul
>
> 2011/10/11 Donna <donna.pol...@gmail.com>:

Donna

unread,
Oct 11, 2011, 3:48:44 PM10/11/11
to linuxstamp
I ran that binchange script that Michael provided again and that
seemed to do the trick !!

Now, the question is, how do I get it to build the usbserial.ko
module ?

Is there a file someplace that you tell it which ones to make ?


On Oct 11, 11:48 am, Paul Thomas <pthomas8...@gmail.com> wrote:
> You should have a arm-linux-as in the same path with the same
> permissions as arm-linux-gcc.
>
> thanks,
> Paul
>
> 2011/10/11 Donna <donna.pol...@gmail.com>:

Donna

unread,
Oct 11, 2011, 4:25:24 PM10/11/11
to linuxstamp
I changed this in the arch/arm/configs/ecbat91_defconfig
CONFIG_USB_SERIAL=y

Then ran this
make ARCH=arm ecbat91_defconfig

and this
make ARCH=arm CROSS_COMPILE=arm-linux- modules

But do not see any new .ko files


On Oct 11, 12:48 pm, Donna <donna.pol...@gmail.com> wrote:
> I ran that binchange script that Michael provided again and that
> seemed to do the trick !!
>
> Now, the question is, how do I get it to build the usbserial.ko
> module ?
>
> Is there a file someplace that you tell it which ones to make ?
>
> On Oct 11, 11:48šam, Paul Thomas <pthomas8...@gmail.com> wrote:
>
>
>
>
>
>
>
> > You should have a arm-linux-as in the same path with the same
> > permissions as arm-linux-gcc.
>
> > thanks,
> > Paul
>
> > 2011/10/11 Donna <donna.pol...@gmail.com>:
>
> > > Thanks Paul, that helped, also had to chmod a few of the folders. Now
> > > I get this, it seems like now it is not finding as, probably the path
> > > to binutils I am guessing. I will search around and see if I can track
> > > this one down.
>
> > > donna@donna-ubuntu:~/Desktop/linuxstamp/linux-2.6.36$ make ARCH=arm
> > > CROSS_COMPILE=arm-linux- modules
> > > šCHK š š include/linux/version.h
> > > make[1]: `include/asm-arm/mach-types.h' is up to date.
> > > šCHK š š include/linux/utsrelease.h
> > > šSYMLINK include/asm -> include/asm-arm
> > > šCALL š šscripts/checksyscalls.sh
> > > <stdin>:1097:2: warning: #warning syscall fadvise64 not implemented
> > > <stdin>:1265:2: warning: #warning syscall migrate_pages not
> > > implemented
> > > <stdin>:1321:2: warning: #warning syscall pselect6 not implemented
> > > <stdin>:1325:2: warning: #warning syscall ppoll not implemented
> > > <stdin>:1365:2: warning: #warning syscall epoll_pwait not implemented
> > > šHOSTCC šscripts/mod/file2alias.o
> > > gcc: error trying to exec 'as': execvp: No such file or directory
> > > make[2]: *** [scripts/mod/file2alias.o] Error 1
> > > make[1]: *** [scripts/mod] Error 2
> > > make: *** [scripts] Error 2
>
> > > On Oct 11, 10:28šam, Paul Thomas <pthomas8...@gmail.com> wrote:
> > >> Yes, you can add it to your path with something like:
> > >> export PATH=$PATH:/home/donna/Desktop/linuxstamp/crosstool-0.43/build/arm-linux/gcc-3.4.5-glibc-2.3.6/bin/arm-linux-gcc
>
> > >> Just to test it you can type 'arm-linux-gcc' and you should get
> > >> something back like 'arm-linux-gcc: no input files'
>
> > >> thanks,
> > >> Paul
>
> > >> 2011/10/11 Donna <donna.pol...@gmail.com>:
>
> > >> > Thank you for your help, here is the result of that command, I wonder
> > >> > if there is an environment variable that needs to point to one of
> > >> > these locations ?
>
> > >> > donna@donna-ubuntu:~$ sudo find / -name "arm-linux-gcc"
> > >> > [sudo] password for donna:
>
> > >> > /home/donna/Desktop/linuxstamp/crosstool-0.43/build/arm-linux/
> > >> > gcc-3.4.5-glibc-2.3.6/bin/arm-linux-gcc
> > >> > /home/donna/Desktop/linuxstamp/crosstool-0.43/build/arm-linux/
> > >> > gcc-3.4.5-glibc-2.3.6/distributed/bin/arm-linux-gcc
> > >> > /home/donna/Desktop/linuxstamp/sw/gcc-3.4.5-glibc-2.3.6/arm-linux/
> > >> > distributed/bin/arm-linux-gcc
> > >> > /home/donna/.local/share/Trash/files/distributed/bin/arm-linux-gcc
> > >> > /opt/crosstool/gcc-3.4.5-glibc-2.3.6/arm-linux/bin/arm-linux-gcc
> > >> > donna@donna-ubuntu:~$
>
> > >> > On Oct 11, 12:42šam, íÁÌ óËÒÙÌ£× <3ah...@gmail.com> wrote:
> > >> >> 2011/10/11 Donna <donna.pol...@gmail.com>:
>
> > >> >> > ALso I tried this:
> > >> >> > donna@donna-ubuntu:~/Desktop/linuxstamp/linux-2.6.36$ sudo make -B
> > >> >> > ARCH=arm CROSS_COMPILE=arm-linux- modules
> > >> >> > make: arm-linux-gcc: Command not found
>
> > >> >> Donna, please provie us with a result of the following command:
>
> > >> >> $ find / -name "arm-linux-gcc"
>
> > >> >> --
> > >> >> íÁÌß úÁÎÕÄÁ, óËÒÙÌ£×ß ÓÙÎß

Donna

unread,
Oct 11, 2011, 5:28:03 PM10/11/11
to linuxstamp
Success! well, at least I finally got usbserial.ko to compile. There
was a bunch of USBSerial stuff in another config file
"ateb9200_defconfig", I just copied that over into ecbat91_defconfig
and compiled modules and that worked.

Of course, we do not know yet if the module works on the board.

We are thinking of calling this project Lucy (like Lucy from Charlie
Brown :))
Reply all
Reply to author
Forward
0 new messages