A collection of QAs a long time ago.
This is a collection of QAs from many sources I used about 1 year ago.I put
it here just for latter reference.
--------------------------------------------------------------------------------
#How to get linux kernel?
--------------------------------------------------------------------------------
1).Get the newest kernel
bash$ export CVSROOT=:pserver:anoncvs@anoncvs.handhelds.org:/cvs
bash$ cvs login
password: anoncvs
bash$ cvs checkout linux/kernel26
2).To fetch a particular release branch:
bash$ cvs checkout -r RELEASE_TAG linux/kernel26
3).To fetch the latest versions on a given date:
bash$ cvs checkout -D YYYY-MM-DD linux/kernel26
4).In particular before editing files, you should always update your local copy as follows:
bash$ cvs update -dP
--------------------------------------------------------------------------------
#How to make u-boot-1.1.4 compile with arm-linux-gcc 3.4.1?
--------------------------------------------------------------------------------
1).When there is "cc1: error: invalid option `abi=apcs-gnu'" problem,do:
replace the line in u-boot-1.1.4/cpu/arm1136/config.mk
#PLATFORM_CPPFLAGS +=$(call cc-option,-mapcs-32,-mabi=apcs-gnu)
with
PLATFORM_CPPFLAGS +=$(call cc-option,-mapcs-32,$(call cc-option,-mabi=apcs-gnu),)
2).When there is "/arm-linux/3.4.1/libgcc.a(_divsi3.oS) uses hardware FP, whereas u-boot uses software FP" problem,do:
chage the line in u-boot-1.1.4/cpu/arm1136/config.mk to remove -msoft-float option.
PLATFORM_RELFLAGS += -fno-strict-aliasing -fno-common -ffixed-r8 #\
#-msoft-float
3).Should do the following to make a valid u-boot.lds:
cp board/integratorcp/u-boot.lds.template board/integratorcp/u-boot.lds
then edit the CPU_FILE to be
cpu/arm1136/start.o
4)The way to configure and make u-boot:
make cp1136_config
make u-boot
--------------------------------------------------------------------------------
#Repair filesystem [mounting proc filesystem dup2]
--------------------------------------------------------------------------------
Title: Sharing my problem solving experience.
On an ugly morning I received the following message when
booting my NIS server:
mounting proc filesystem [ ERROR ]
dup2: bad file descriptor
My Nis server (TUX) would not boot any further and therefore the
rest of my servers that are dependent on TUX wouldn't boot/respond
either.
After a while of googling I found the following solution
which made me, all of the sudden, very happy and releived:
Begin quote:
How to fix "dup2: bad file descriptor" on Linux
This error is actually happen because the /dev/null entry in the device inode
permission is screwed up
when the system is showing:
mounting proc filesystem [ ERROR ]
dup2: bad file descriptor,
Note: The following step will fix the error:
Proceed with login to repair filesystem (provide root password)
Next mount your root filesystem
mount -n -o remount,rw /dev/hdxx (where hdxx or sdxx is your root partition)
Remove the /dev/null entry
rm -rf /dev/null
Since we've already remove the /dev/null, we have to create a new writeable entry
mknod -m 666 /dev/null c 1 3
Reboot the system using shutdown -r now or shutdown -h now, the filesystem should be
correctly mounted the next round of booting.
--------------------------------------------------------------------------------------------
#How to configure RVDS 3.0 on linux?
--------------------------------------------------------------------------------------------
1)how to install?
Just insert the CD ROM,then go:
mount /dev/cdrom /mnt/cdrom
cd /mnt/cdrom
./setuplinux.bin
2)how to set environment?
just use the command 'source' to set RVDS30env.sh in to PATH
source /opt/ARM/RVDS30Env.sh
3)how to set up flexm license server?
cd /root
vi .flexlmrc
then insert the folowing
ARMLMD_LICENSE_FILE=8224@10.16.10.245
then the rvdebug can be used.
--------------------------------------------------------------------------------------------
#How to set root password for Hiweed Debian linux?
--------------------------------------------------------------------------------------------
1)Use the commands below:
sudo passwd root
then enter your current user's passord
then you need to input the password for the root twice.
--------------------------------------------------------------------------------------------
how to fix a build error that say:
Error: internal_relocation (type: OFFSET_IMM) not fixed up?
--------------------------------------------------------------------------------------------
1)Try using -O1 as the C flasgs.
--------------------------------------------------------------------------------------------
QUESTION
My ARM application does not work. When I run it in the simulator or with my JTAG debugger (ULINK),
I see that the program counter (R15) jumps to the label DAbt_Handler?A. What does that mean? How can
I find the location where my application crashes?
--------------------------------------------------------------------------------------------
ANSWER
This is the default Data Abort exception handler. Your application is trying to read or write an illegal memory
location. You can calculate the illegal memory location using by subtracting 8 from the value in R14 (link register).
Subtracting 8 adjusts for the instruction queue giving you the address of the instruction that caused this exception.
For example:
* R14 value is 0x0000021e
* 0x0000021e - 8 = 0x00000216. The instruction which caused the exception is at address 0x00000216
* The disassembly window shows the instruction STRB R3,[R1,#0x00] at this address with R1=0x000001bc.
The value in R1 points to an on-chip flash area (Philips LPC2000) and cannot be written. In the assembly
window, right click on this line and select Show Source Code for current Address to display your source code.
Probably a pointer was loaded with a bad address.
--------------------------------------------------------------------------------------------
QUESTION
How to build a ARMV6 u-boot target image using arm-linux-gcc 3.4.1 cross compiler?
--------------------------------------------------------------------------------------------
ANSWER
1)Edit file u-boot/cpu/arm1136/config.mk to change the line
PLATFORM_CPPFLAGS += -march=armv6j
note that we should add a 'j' after armv6.
2)Note that upto 3.4.1 of the tool chain,it still produce code which will encounter " CP15 Unimplemented behaviour
hit: MCR p15,0,R0,c15,c2,4" problem(seen from Realview ICE shell),this may because it is not actually support all
ARMV6 instructions.so,you might swithc to use the tool chain found here:
http://www.codesourcery.com/gnu_toolchains/arm/index_html,
but you can make your own (with some skills).
--------------------------------------------------------------------------------------------
QUESTION
How to use CodeSorc GNU cross compiler to buid linux kernel?
--------------------------------------------------------------------------------------------
# let's say the G500 directory is our prefered directory these times...
cd G500
# unpack the codesourcery toolchain and update PATH
tar xjf arm-2006q1-6-arm-none-linux-gnueabi-i686-pc-linux-gnu.tar.bz2
export PATH=$PATH:$PWD/bin
# unpack the linux kernel
tar xjf linux-2.6.16.11.tar.bz2
# configure and build the kernel
cd linux-2.6.16.11
make mrproper
make ARCH=arm CROSS_COMPILE=arm-none-linux-gnueabi- menuconfig
make ARCH=arm CROSS_COMPILE=arm-none-linux-gnueabi-
# TODO : add some light documentation on busybox and a small initrd building
--------------------------------------------------------------------------------------------
QUESTION
How to fix "Source object XX has EABI version 0, but target has EABI version 4" when build u-boot with
codesourcery 2006Q1 GUN cross compiler release?
--------------------------------------------------------------------------------------------
ANSWER
It seems that swith the cC option -mabi to -mabi=aapcs will fix the problem.
--------------------------------------------------------------------------------------------
QUESTION
How to fix `__aeabi_unwind_cpp_pr0' problem?
--------------------------------------------------------------------------------------------
nueabi/4.1.0 -lgcc \
-Map u-boot.map -o u-boot
/usr/local/arm/codesourcery/bin/../lib/gcc/arm-none-linux-gnueabi/4.1.0/libgcc.a(_dvmd_lnx.o): In function `__div0':
/scratch/paul/release/src/gcc-2006q1/gcc/config/arm/lib1funcs.asm:(.text+0x8): undefined reference to `raise'
/usr/local/arm/codesourcery/bin/../lib/gcc/arm-none-linux-gnueabi/4.1.0/libgcc.a(_divdi3.o):(.ARM.exidx+0x0): undefined reference to `__aeabi_unwind_cpp_pr0'
/usr/local/arm/codesourcery/bin/../lib/gcc/arm-none-linux-gnueabi/4.1.0/libgcc.a(_udivdi3.o):(.ARM.exidx+0x0): undefined reference to `__aeabi_unwind_cpp_pr0'
make: *** [u-boot] Error 1
--------------------------------------------------------------------------------------------
QUESTION
how to build cross compiler using crosstool?
--------------------------------------------------------------------------------------------
First of all, I would like to thank Dan for its so useful crosstool.
I'm developing an embedded board which is based on Freescale iMX31, so a
very nice ARM1136 core. I've got a development board with this chip
which has Linux, and while our prototype is being built, I'm playing
with it.
I've used crosstool-0.42 to build a simple arm toolchain using my simple
script that I past here (just in case):
> #!/bin/sh
> set -ex
> TARBALLS_DIR=$HOME/downloads
> export TARBALLS_DIR
> mkdir -p TARBALLS_DIR
>
> RESULT_TOP=/opt/crosstool
> export RESULT_TOP
> mkdir -p RESULT_TOP
>
> GCC_LANGUAGES="c,c++"
> export GCC_LANGUAGES
>
> KERNELCONFIG=$PWD/arm.config
> export KERNELCONFIG
>
> TARGET=arm-linux
> export TARGET
> TARGET_CFLAGS="-O"
> export TARGET_CFLAGS
>
> BINUTILS_DIR=binutils-2.15
> GCC_DIR=gcc-3.4.2
> GLIBC_DIR=glibc-2.3.3
> GLIBCTHREADS_FILENAME=glibc-linuxthreads-2.3.3
> LINUX_DIR=linux-2.6.10
> export BINUTILS_DIR GCC_DIR GLIBC_DIR GLIBCTHREADS_FILENAME LINUX_DIR
>
> eval sh all.sh --notest
>
> echo Done.
>
--------------------------------------------------------------------------------
Very Simple Guide for Building Cross Compilers Tips
--------------------------------------------------------------------------------
The following is steps to build cross compilers. So far, I tried only for PowerPC and MIPS.
Basically, all you have to do is to follow the following 9 steps.
Download sources
Set environment variables
Build binutils
Build bootstrap gcc
Build newlib
Build gcc again with newlib
GDB with PSIM
Compile your code
Run
--------------------------------------------------------------------------------
1. What do you need?
First, you have to obtain the following source codes
binutils http://www.gnu.org/software/binutils/
GCC http://www.gnu.org/software/gcc/gcc.html
newlib http://sources.redhat.com/newlib/
GDB http://www.gnu.org/software/gdb/gdb.html
2. Set environment variables
First, choose your taget such as powerpc-eabi, powerpc-elf, mips-elf, and so on
For bash simply type
% export TARGET=arm-eabi
% export PREFIX=/usr/local/arm/$TARGET
% export PATH=$PATH:$PREFIX/bin
3. Build binutils
% tar xjfv binutils-2.16.tar.bz2
% mkdir build-binutils
% cd build-binutils
% ../binutils-2.16/configure --target=$TARGET --prefix=$PREFIX --disable-nls --disable-werror
% make all
% make install
4. Build bootstrap GCC
% tar xjfv gcc-3.4.4.tar.bz2
% mkdir build-gcc
% cd build-gcc
% ../gcc-3.4.4/configure --target=$TARGET --prefix=$PREFIX --without-headers --with-newlib --with-gnu-as --with-gnu-ld
% make all-gcc
% make install-gcc
--with-gnu-as --with-gnu-ld prevents native assembler on certain architectures. (for others, these do not have any effects)
5. Build newlib
Newlib provides standard C library for embedded systems
% tar xzfv newlib-1.13.0.tar.gz
% mkdir build-newlib
% cd build-newlib
% ../newlib-1.13.0/configure --target=$TARGET --prefix=$PREFIX
% make all
% make install
6. Build GCC again with newlib
% cd build-gcc
% ../gcc-3.4.4/configure --target=$TARGET --prefix=$PREFIX --with-newlib --with-gnu-as --with-gnu-ld
% make all
% make install
7. GDB with PSIM
% tar xjfv gdb-6.3.tar.bz2
% mkdir build-gdb
% cd build-gdb
% ../gdb-6.3/configure --target=$TARGET --prefix=$PREFIX --enable-sim-powerpc
--enable-sim-stdio
% make all
% make install
Congratulations! You build your tool chain
8. Compile your code
Now, it's time to compile your code.
% powerpc-eabi-gcc -mcpu=405 hello.c -o hello -msim
% mips-elf-gcc -Tidt.ld -mips4 hello.c -o hello
-T option specifies libraries that include start code.
To Compile with specific Memory map
% powerpc-eabi-gcc -Wl,-Ttext,0x4000,-Tdata,0xf000 hello.c -msim
(-Wl,-Ttext,0x4000,-Tdata,0x10000)
9. Run
% powerpc-eabi-run hello
% mips-elf-run hello
--------------------------------------------------------------------------------
configure flags: --build=i686-pc-linux-gnu --host=i686-pc-linux-gnu \
--target=arm-none-eabi --enable-languages=c,c++ --enable-shared --enable-threads \
--disable-libmudflap --disable-libssp --disable-libgomp --disable-libstdcxx-pch --disable-libunwind-exceptions \
--with-gnu-as --with-gnu-ld --prefix=/opt/codesourcery --with-newlib \
--with-versuffix='CodeSourcery ARM Sourcery G++ 2006q3-18' --with-bugurl=mailto:arm-gnu@codesourcery.com \
--disable-nls --with-sysroot=/opt/codesourcery/arm-none-eabi \
--with-build-sysroot=/scratch/gcc/nightly-2006-09-01-csl-arm/arm-none-eabi/build_gcc/install/arm-none-eabi
> > While configuring the gcc which you will use to build glibc you should
> > use this configure option--disable-libunwind-exceptions (assuming you
> > are using GCC 4.1)
> > and set libc_cv_forced_unwind=yes in config.cache while building glibc.
--------------------------------------------------------------------------------
QUESTION
When building binutils,a problem occured:
`@value{srcdir}/../libiberty/at-file.texi': No such file or directory.
How to fix it?
--------------------------------------------------------------------------------
ANSWER
Just delete the line in binutils.texi line 3522
#@include @value{top_srcdir}/../libiberty/at-file.texi
and as.texinfo line 454
#@include @value{top_srcdir}/../libiberty/at-file.texi
ld.texinfo line 345
#@include @value{top_srcdir}/../libiberty/at-file.texi
gcc/doc/invoke.texi line 1060
#@include @value{srcdir}/../libiberty/at-file.texi
See below
Hello!
> Mark Mitchell's @file documentation change adds a @set directive to
> gcc-vers.texi in the build directory, but that file only depends on
> DEV-PHASE and BASE-VER, so it will never be correctly rebuilt using
> the new make rule. Just deleting it will remedy the problem.
Another problem is in the fact that value references in @include commands are
expanded only from texinfo version 4.4 and newer. This means, that version 4.4
or higher of texinfo is _required_ to build the documentation.
Interested people could check texinfo's ChangeLog.46 for the changeset:
2003-01-12
...
* makeinfo/cmds.c (handle_include): call text_expansion on the
filename, so @value constructs are expanded.
* doc/texinfo.txi (verbatiminclude, Using Include Files): mention
@value expansion.
...
Using texinfo 4.2, bootstrap fails with:
if [ xinfo = xinfo ]; then \
makeinfo --split-size=5000000 --split-size=5000000 --no-split -I . -I
../../gcc-svn/trunk/gcc/doc \
-I ../../gcc-svn/trunk/gcc/doc/include -o doc/gcc.info
../../gcc-svn/trunk/gcc/doc/gcc.texi; \
fi
../../gcc-svn/trunk/gcc/doc/invoke.texi:1057: @include
`@value{srcdir}/../libiberty/at-file.texi': No such file or directory.
makeinfo: Removing output file `doc/gcc.info' due to errors; use --force to
preserve.
gmake[2]: *** [doc/gcc.info] Error 2
Attached (untested) diff should update the required version of texinfo.
----------------------------------------------------------------------------
QUESTION
How to fix u-boot S29GL128N CFI flash can not erase and write problem?
----------------------------------------------------------------------------
Hi all,
Does anybody test the cfi flash driver (cfi_flash.c) with a x8/x16
flash configured in x8 mode ? I'm trying to port U-Boot for a Lite5200B
with a S29GL128N flash (CFI compliant) using the cfi flash driver.
U-Boot detects the flash correctly but It's unable to erase or write the
flash. In my case the following patch fix the bug but I'm not completly
sure If It's only a bug with my configuration. Any suggestions? Could
anybody test the patch in other architecture?
My configuration for the cfi driver is:
#define CFG_MAX_FLASH_BANKS 2 /* max num of memory banks */
#define CFG_MAX_FLASH_SECT 128 /* max num of sects on one chip */
#undef CONFIG_FLASH_16BIT /* Flash is 8-bit */
#define CFG_FLASH_CFI_DRIVER
#define CFG_FLASH_CFI
#define CFG_FLASH_BANKS_LIST {CFG_CS1_START,CFG_CS0_START}
And the patch:
--- ../tmp/u-boot/drivers/cfi_flash.c 2006-01-12 12:22:08.000000000 +0100
+++ drivers/cfi_flash.c 2006-01-12 13:35:11.000000000 +0100
@@ -107,9 +107,19 @@
#define AMD_STATUS_TOGGLE 0x40
#define AMD_STATUS_ERROR 0x20
+
+#if 0
#define AMD_ADDR_ERASE_START 0x555
#define AMD_ADDR_START 0x555
#define AMD_ADDR_ACK 0x2AA
+#else
+int amd_addr_erase_start = 0x555;
+int amd_addr_start = 0x555;
+int amd_addr_ack = 0x2AA;
+#define AMD_ADDR_ERASE_START amd_addr_erase_start
+#define AMD_ADDR_START amd_addr_start
+#define AMD_ADDR_ACK amd_addr_ack
+#endif
#define FLASH_OFFSET_CFI 0x55
#define FLASH_OFFSET_CFI_RESP 0x10
@@ -1111,6 +1121,9 @@ ulong flash_get_size (ulong base, int ba
info->flash_id = FLASH_MAN_CFI;
if ((info->interface == FLASH_CFI_X8X16) && (info->chipwidth ==
FLASH_CFI_BY8)) {
info->portwidth >>= 1; /* XXX - Need to test on x8/x16
in parallel. */
+ amd_addr_erase_start = 0xAAA;
+ amd_addr_start = 0xAAA;
+ amd_addr_ack = 0x555;
}
}
Best regards,
Jose Maria Lopez.

0 Comments:
Post a Comment
<< Home