If I could solve this once and for all I would be golden:
Internal error: Oops - undefined instruction: 0 [#6]
Modules linked in:
CPU: 0
PC is at __link_path_walk+0x13c/0x1014
LR is at nfs_permission+0x1f0/0x20c
pc : [<c0093ac0>] lr : [<c00dcda0>] Not tainted
sp : c03c3d78 ip : c27b9001 fp : c03c3dc4
Here are my steps:
My development system was RedHat 2.1AS
1. Gather the bits needed
download ltib package and mount iso or burn a CD. This came
from the Freescale site:
imx31_ads_20070128-rel3-ltib.iso
I burned it to a CD and then mounted it on my linux development
box:
mount -t iso9660 -o ro /dev/cdrom /cdrom
download the patches from this site, thanks to Hasan Yilmaz:
http://mx31.lbox.ca/download/
save as /tmp/linux-2.6.16-mx31-lite1.patch
save as /tmp/smsc911x.patch
get the device file:
http://www.arm.linux.org....achines/download.php
save as /tmp/mach-types
get the second stage device loader (also thanks to Hasan!):
http://mx31.lbox.ca/download/bootloader.tar.gz
save to /tmp/bootloader.tar.gz
2. build main bitset
install iso bits (run ./install)
* Note you run "install" as a non-root user
* I installed to /scratch
build bits (cd /scratch/ltib-XXX; ./ltib -c)
* Note, again run as a non-root user. You will be prompted
to give this user sudo privledges.
* Also when prompted, check the boxes for
Leave sources after building
which will force kernel extraction and compilation. Let
build run from here, taking any defaults.
3. apply the patches, insert new mach-types file
cd /scratch/ltib-XXX/rpm/BUILD/linux-2.6.19.2
patch -p1 < /tmp/linux-2.6.16-mx31-lite1.patch
With the first patch you'll get errors. Look at the patch itself and edit
the files directly. You can determine which files had issues by doing
a find on "*.rej" files. ONLY RUN THE PATCH ONCE and then just fix
the files. You can always see the original version of the file (*.orig)
to compare to what's supposed to be happening.
I had to fix:
arch/arm/mach-mx3/Makefile
include/asm-arm/arch-mxc/hardware.h
drivers/ide/arm/mxc_ide.c
patch -p1 < /tmp/smsc911x.patch
(This second patch should have no issues)
cd ../linux/arch/arm/tools
cp mach-types mach-types.orig
cp /tmp/mach-types .
4. recompile the kernel using ltib environment
cd /scratch/ltib-XXX
./ltib -c
choose at the FIRST menu:
Configure the kernel
and make sure you are still leaving the source!
choose at the second menu:
System Type -->
Freescale MXC Implementations -->
MX3 Options -->
and when given a chance enable "MX31lite", disable "MX31ADS"
additionally, I had to comment out some of the includes in
arch/arm/mach-mx3/mx31lite.c
arch/arm/mach-mx3/usb_lite.c
after the recompile failed because the patch created these files and
they made reference to include files that do not exist beyond 2.6.16
also, since I chose to disable the ADS and only enable the LITE, I
had to move some of the values found only in include/asm-arm/arch-mxc
board-mx31ads.h to board-mx31lite.h, the build will complain when it
can't find some value. Otherwise, just enable the "MX31ADS" but be
prepared for a LOT of warnings.
This is also where I edited the values for network setup,
name of NTP server, etc. I did not use DHCP but a static IP.
I also had to turn on the ethernet device driver for SMSC911X
family, which is what the lite board uses (eth0)
5. build second stage device loader
mkdir /scratch/bootloader
cd /scratch/bootloader
mv /tmp/bootloader.tar.gz .
gzip -d bootloader.tar.gz
tar -xvf bootloader.tar
vi Makefile
fix path for CC, LD, AS. My path to the bin subdir was
/opt/freescale/usr/local/gcc-4.1.1-glibc-2.4-nptl-6/arm-none-linux-gnueabi/arm-none-linux-gnueabi/bin
also fix LIBGCC path, which is same as above except ends in
"lib" instead of "bin"
vi bootloaderstg2.c
change COMMAND_LINE to the values you want. Mine looks like
this:
#define COMMAND_LINE "console=ttymxc0 root=/dev/nfs
nfsroot=129.148.25.210:/tftpboot/rootfs rw init=/linuxrc
ip=129.148.25.28::129.148.25.98:255.255.255.0 noalign"
129.148.25.210 is my RedHat build/distro machine
129.148.25.28 is the IP of my lite board
129.148.25.98 is my gateway
255.255.255.0 is my netmask
make loader
cp loader /tftpboot
6. Housecleaning on the development/deployment system
shut off firewall if it's on
install tftp server and nfs server (I used "serviceconf")
mkdir /tftpboot
ln -s /scratch/ltib-XXX/rootfs /tftpboot/rootfs
cp /scratch/ltib-XXX/rootfs/boot/* /tftpboot
vi /etc/exports and add this line:
/tftpboot/rootfs 129.148.25.28(rw,no_root_squash,async)
vi /etc/xinetd.d/tftp and make it look like this:
service tftp
{
disable = no
socket_type = dgram
protocol = udp
wait = yes
user = root
server = /usr/sbin/in.tftpd
server_args = /tftpboot
}
/etc/init.d/xinetd restart
/etc/init.d/nfsserver restart
(or /usr/sbin/exportfs)
7. Connect i.MX31 board to network/tip
tip in to board by whatever style you prefer. I used a Sun serial
port, with baud=115200
at console prompt:
losh> ifconfig sm0 129.148.25.28 255.255.255.0 129.148.25.98
8. load up the images
first load the "loader" by figuring out it's starting address and
size. Like so:
# objdump -f /tftpboot/loader
/tftpboot/loader: file format elf32-littlearm
architecture: arm, flags 0x00000112:
EXEC_P, HAS_SYMS, D_PAGED
start address 0x800d03a8
# ls -al /tftpboot/loader
-rwxr-xr-x 1 root wheel 35342 Mar 21 12:39 /tftpboot/loader
note the size is 35342, starting address is 0x800d03a8.
Load this on the ARM device:
losh> load raw 0x800d03a8 35342 /tftp/129.148.25.210:/tftpboot/loader
and you should see this:
loading from /tftp/129.148.25.210:/tftpboot/loader:
loading raw binary to 0x800d03a8 (ram) len 00008a0e:
........done
file loaded
losh> ls
R : load 35342
D : tftp 0
D : etc 0
D : dev 0
losh>
Now load the linux image. Determine it's size, the loading address
is already determined by the loader.c code above.
# ls -al /tftpboot/zImage
-rwxr-xr-x 1 root wheel 1629660 Mar 27 11:40 /tftpboot/zImage
load it on the ARM device
losh> load raw 0x81000000 1629660 /tftp/129.148.25.210:/tftpboot/zImage
loading from /tftp/129.148.25.210:/tftpboot/zImage:
loading raw binary to 0x81000000 (ram) len 0018dd98:
.............................................................
.............................................................
.............................................................
...................done
file loaded
losh> ls
R : load 1629660
D : tftp 0
D : etc 0
D : dev 0
losh>
0x81000000 was what Hasan told me to use
zImage is the "kernel image that can be loaded with Redboot"
Once this is done, you "exec" the image.
losh> exec 0x800d03a8 -
I got some warnings but eventually I saw the "freescale" hostname
appear. I could log in (if I first zapped the password in the
rootfs/etc/shadow file for root, no idea what that was!) and could
set the password but eventually I would get something like the
following and the kernel would crash:
BUG: warning at kernel/softirq.c:120/_local_bh_enable()
Unable to handle kernel NULL pointer dereference at virtual address 00000000
pgd = c0004000
[00000000] *pgd=00000000
Internal error: Oops: 817 [#2]
Modules linked in:
CPU: 0
PC is at preempt_return+0xc/0x24
LR is at preempt_return+0x0/0x24
sooooo close!
Randy (
randy.crihfield@sun.com)