http://wiki.linuxmce.org/api.php?action=feedcontributions&user=Gerry&feedformat=atomLinuxMCE - User contributions [en]2024-03-28T22:15:50ZUser contributionsMediaWiki 1.24.1http://wiki.linuxmce.org/index.php?title=Mini2440&diff=18717Mini24402009-05-02T01:46:52Z<p>Gerry: </p>
<hr />
<div>[[Category: Hardware]]<br />
[[Image:Mini2440.jpg|thumb|200px|mini2440]]<br />
<br />
= About =<br />
This is a howto install uboot and a new kernel on the mini2440. Big thanks to BusError for the instructions and guidance. DISCLAIMER: This worked for me, if it eats your cat or burns your kitchen sink, don't blame me.<br />
<br />
= Preparations =<br />
== Toolchain ==<br />
I used this one: http://www.codesourcery.com/sgpp/lite/arm/portal/package3696/public/arm-none-linux-gnueabi/arm-2008q3-72-arm-none-linux-gnueabi-i686-pc-linux-gnu.tar.bz2<br />
<br />
Add the bin dir to the $PATH. If you have a toolchain with another prefix (like arm-linux-) adapt the CROSS_COMPILE environment variable in the next steps.<br />
<br />
= Setting up the bootloader =<br />
== Compiling uboot ==<br />
Clone the git tree:<br />
mkdir uboot ; cd uboot<br />
git clone git://repo.or.cz/u-boot-openmoko/mini2440.git<br />
Setup cross compiling:<br />
export CROSS_COMPILE=arm-none-linux-gnueabi-<br />
or edit your .bashrc eg. <br />
export CROSS_COMPILE=arm-none-linux-gnueabi-<br />
export PS1="\[\033[1;34m\]\u \[\033[0m\]\w:\$: \[\033[0m\]"<br />
#export PS1="\u:\w\$>"<br />
LS_OPTIONS="--color=auto"<br />
alias ls="ls $LS_OPTIONS"<br />
Prepare the mini2440 target:<br />
cd mini2440<br />
make mini2440_config<br />
Compile:<br />
make all<br />
This will give you a "u-boot.bin". If you get an error about a missing whatever-gcc, verifiy if there is a hardcoded CROSS_COMPILE setting in the Makefile<br />
<br />
== Flashing uboot ==<br />
We use the installed vivi bootloader to load uboot via usb. Power the board off, set the NOR switch to on, power the board on. You'll get the vivi output on the serial console. Press 'q' to go to the shell and do the "load flash" on address 0 with the size of "u-boot.bin" (238232 bytes in this example):<br />
<br />
<pre><br />
[q] Goto shell of vivi <br />
Enter your selection: q <br />
Supervivi> load flash 0 238232 u <br />
USB host is connected. Waiting a download. <br />
</pre><br />
<br />
Use the "s3c2410_boot_usb" utility (http://mini2440.googlecode.com/files/s3c2410_boot_usb-20060807.tar.bz2) to upload the "u-boot.bin" via usb:<br />
./s3c2410_boot_usb u-boot.bin <br />
You'll see something like this as output, ignore the error message:<br />
<pre><br />
csum = 0x9a6e<br />
send_file: addr = 0x33f80000, len = 0x0003a298<br />
Error downloading program<br />
</pre><br />
and this on the serial console:<br />
<pre><br />
Now, Downloading [ADDRESS:30000000h,TOTAL:238242] <br />
RECEIVED FILE SIZE: 238242 (232KB/S, 1S) <br />
Downloaded file at 0x30000000, size = 238232 bytes <br />
Found block size = 0x0003c000 <br />
Erasing... ... done <br />
Writing... ... done <br />
Written 238232 bytes <br />
Supervivi><br />
</pre><br />
<br />
Then you see<br />
MINI2440 # saveenv<br />
<br />
Saving Environment to NAND...<br />
<br />
Erasing Nand...nand_erase: attempt to erase a bad block at page 0x00000260<br />
<br />
Try<br />
MINI2440 # nand scrub<br />
...<br />
Really scrub this NAND flash? <y/N><br />
press y and enter. After erasing make<br />
MINI2440 # nand createbbt<br />
press y and enter. Now you can save the environment<br />
MINI2440 # saveenv<br />
<br />
Now power off the board, set the NOR switch back to off, and power on the board. We verify the version and then prepare config storage in flash:<br />
<pre><br />
MINI2440 # version <br />
<br />
U-Boot 1.3.2-dirty-moko12 (Mar 8 2009 - 13:50:19) <br />
<br />
MINI2440 # dynenv set 40000 <br />
device 0 offset 0x40000, size 0x3fc0000 <br />
45 4e 56 30 - 00 00 04 00 <br />
<br />
MINI2440 # saveenv <br />
Saving Environment to NAND... <br />
Erasing Nand...Writing to Nand... done <br />
<br />
MINI2440 # reset <br />
</pre><br />
== Configure uboot ==<br />
do a "printenv" to show active settings. Adjust the IP for uboot and the tftp server. We need proper IP connectivity to load the kernel with tftp. "setenv" is your friend. "saveenv" stores the setting to flash.<br />
<br />
= Kernel =<br />
== Compilation ==<br />
Fetch from git:<br />
mkdir kernel ; cd kernel<br />
git clone git://repo.or.cz/linux-2.6/mini2440.git<br />
cd mini2440<br />
mkdir -p ../kernel-bin<br />
Generate .config from mini2440 template:<br />
CROSS_COMPILE=arm-none-linux-gnueabi- ARCH=arm make O=../kernel-bin/ mini2440_defconfig<br />
Compile kernel and modules:<br />
CROSS_COMPILE=arm-none-linux-gnueabi- ARCH=arm make O=../kernel-bin/<br />
Generate "uImage" with the "mkimage" tool:<br />
../uboot/mini2440/tools/mkimage -A arm -O linux -T kernel -C none -a 0x30008000 -e 0x30008000 -d ../kernel-bin/arch/arm/boot/zImage /tftpboot/uImage<br />
<br />
== Flash kernel ==<br />
Verify partitions, we need the offset for the kernel partition (probably 0x60000):<br />
mtdparts<br />
Erase the kernel partition:<br />
nand erase 60000 <padded size><br />
Load the kernel with uboot into ram:<br />
tftp 0x32000000 uImage<br />
Note the size, pad it to 512 byte and use the nand write command to flash it:<br />
nand write 32000000 60000 <padded size>.<br />
== Configure uboot ==<br />
We use a nfs chroot for now:<br />
setenv bootargs console=ttySAC0,115200 noinitrd init=/sbin/init mini2440=1tb ip=192.168.80.12 root=/dev/nfs rw nfsroot=192.168.80.1:/home/public/arm<br />
This is helpful for automatic booting:<br />
setenv bootcmd 'nboot.e kernel ; bootm'<br />
= Setting up embedian =<br />
Follow this nice howto from BusError http://code.google.com/p/mini2440/wiki/Emdebian<br />
<br />
= Troubleshooting =<br />
== Write errors ==<br />
When you have bad blocks in NAND, you'll get write errors. This gives more information: http://wiki.openmoko.org/wiki/NAND_bad_blocks<br />
<br />
Clear the flash (do not reset the board till uboot is reinstalled, or you need to use NOR/vivi to reinstall uboot via usb):<br />
nand scrub<br />
Create new bad blocks table:<br />
nand createbbt<br />
Reflash uboot (use the size in the output from the tftp command and pad it to hit 512 byte boundaries for the nand write command)<br />
tftp 0x32000000 u-boot.bin<br />
nand write 32000000 0 <size of u-boot.bin><br />
reset<br />
Create dynamic partitions:<br />
dynpart<br />
dynenv set u-boot_env<br />
saveenv<br />
reset<br />
And then use write.e to write to the mtdparts, e.g.:<br />
tftp 0x32000000 uImage<br />
nand write.e 32000000 kernel<br />
nboot.e kernel<br />
= Links =<br />
http://bliterness.blogspot.com/<br />
<br />
http://code.google.com/p/mini2440/<br />
<br />
http://blog.cor-net.org/ (Qt 4.5 on mini2440)</div>Gerryhttp://wiki.linuxmce.org/index.php?title=Mini2440&diff=18716Mini24402009-05-02T01:46:12Z<p>Gerry: </p>
<hr />
<div>[[Category: Hardware]]<br />
[[Image:Mini2440.jpg|thumb|200px|mini2440]]<br />
<br />
= About =<br />
This is a howto install uboot and a new kernel on the mini2440. Big thanks to BusError for the instructions and guidance. DISCLAIMER: This worked for me, if it eats your cat or burns your kitchen sink, don't blame me.<br />
<br />
= Preparations =<br />
== Toolchain ==<br />
I used this one: http://www.codesourcery.com/sgpp/lite/arm/portal/package3696/public/arm-none-linux-gnueabi/arm-2008q3-72-arm-none-linux-gnueabi-i686-pc-linux-gnu.tar.bz2<br />
<br />
Add the bin dir to the $PATH. If you have a toolchain with another prefix (like arm-linux-) adapt the CROSS_COMPILE environment variable in the next steps.<br />
<br />
= Setting up the bootloader =<br />
== Compiling uboot ==<br />
Clone the git tree:<br />
mkdir uboot ; cd uboot<br />
git clone git://repo.or.cz/u-boot-openmoko/mini2440.git<br />
Setup cross compiling:<br />
export CROSS_COMPILE=arm-none-linux-gnueabi-<br />
or edit your .bashrc eg. <br />
export CROSS_COMPILE=arm-none-linux-gnueabi-<br />
export PS1="\[\033[1;34m\]\u \[\033[0m\]\w:\$: \[\033[0m\]"<br />
#export PS1="\u:\w\$>"<br />
LS_OPTIONS="--color=auto"<br />
alias ls="ls $LS_OPTIONS"<br />
Prepare the mini2440 target:<br />
cd mini2440<br />
make mini2440_config<br />
Compile:<br />
make all<br />
This will give you a "u-boot.bin". If you get an error about a missing whatever-gcc, verifiy if there is a hardcoded CROSS_COMPILE setting in the Makefile<br />
<br />
== Flashing uboot ==<br />
We use the installed vivi bootloader to load uboot via usb. Power the board off, set the NOR switch to on, power the board on. You'll get the vivi output on the serial console. Press 'q' to go to the shell and do the "load flash" on address 0 with the size of "u-boot.bin" (238232 bytes in this example):<br />
<br />
<pre><br />
[q] Goto shell of vivi <br />
Enter your selection: q <br />
Supervivi> load flash 0 238232 u <br />
USB host is connected. Waiting a download. <br />
</pre><br />
<br />
Use the "s3c2410_boot_usb" utility (http://mini2440.googlecode.com/files/s3c2410_boot_usb-20060807.tar.bz2) to upload the "u-boot.bin" via usb:<br />
./s3c2410_boot_usb u-boot.bin <br />
You'll see something like this as output, ignore the error message:<br />
<pre><br />
csum = 0x9a6e<br />
send_file: addr = 0x33f80000, len = 0x0003a298<br />
Error downloading program<br />
</pre><br />
and this on the serial console:<br />
<pre><br />
Now, Downloading [ADDRESS:30000000h,TOTAL:238242] <br />
RECEIVED FILE SIZE: 238242 (232KB/S, 1S) <br />
Downloaded file at 0x30000000, size = 238232 bytes <br />
Found block size = 0x0003c000 <br />
Erasing... ... done <br />
Writing... ... done <br />
Written 238232 bytes <br />
Supervivi><br />
</pre><br />
<br />
Then you see<br />
MINI2440 # saveen<br />
<br />
Saving Environment to NAND...<br />
<br />
Erasing Nand...nand_erase: attempt to erase a bad block at page 0x00000260<br />
<br />
Try<br />
MINI2440 # nand scrub<br />
...<br />
Really scrub this NAND flash? <y/N><br />
press y and enter. After erasing make<br />
MINI2440 # nand createbbt<br />
press y and enter. Now you can save the environment<br />
MINI2440 # saveenv<br />
<br />
Now power off the board, set the NOR switch back to off, and power on the board. We verify the version and then prepare config storage in flash:<br />
<pre><br />
MINI2440 # version <br />
<br />
U-Boot 1.3.2-dirty-moko12 (Mar 8 2009 - 13:50:19) <br />
<br />
MINI2440 # dynenv set 40000 <br />
device 0 offset 0x40000, size 0x3fc0000 <br />
45 4e 56 30 - 00 00 04 00 <br />
<br />
MINI2440 # saveenv <br />
Saving Environment to NAND... <br />
Erasing Nand...Writing to Nand... done <br />
<br />
MINI2440 # reset <br />
</pre><br />
== Configure uboot ==<br />
do a "printenv" to show active settings. Adjust the IP for uboot and the tftp server. We need proper IP connectivity to load the kernel with tftp. "setenv" is your friend. "saveenv" stores the setting to flash.<br />
<br />
= Kernel =<br />
== Compilation ==<br />
Fetch from git:<br />
mkdir kernel ; cd kernel<br />
git clone git://repo.or.cz/linux-2.6/mini2440.git<br />
cd mini2440<br />
mkdir -p ../kernel-bin<br />
Generate .config from mini2440 template:<br />
CROSS_COMPILE=arm-none-linux-gnueabi- ARCH=arm make O=../kernel-bin/ mini2440_defconfig<br />
Compile kernel and modules:<br />
CROSS_COMPILE=arm-none-linux-gnueabi- ARCH=arm make O=../kernel-bin/<br />
Generate "uImage" with the "mkimage" tool:<br />
../uboot/mini2440/tools/mkimage -A arm -O linux -T kernel -C none -a 0x30008000 -e 0x30008000 -d ../kernel-bin/arch/arm/boot/zImage /tftpboot/uImage<br />
<br />
== Flash kernel ==<br />
Verify partitions, we need the offset for the kernel partition (probably 0x60000):<br />
mtdparts<br />
Erase the kernel partition:<br />
nand erase 60000 <padded size><br />
Load the kernel with uboot into ram:<br />
tftp 0x32000000 uImage<br />
Note the size, pad it to 512 byte and use the nand write command to flash it:<br />
nand write 32000000 60000 <padded size>.<br />
== Configure uboot ==<br />
We use a nfs chroot for now:<br />
setenv bootargs console=ttySAC0,115200 noinitrd init=/sbin/init mini2440=1tb ip=192.168.80.12 root=/dev/nfs rw nfsroot=192.168.80.1:/home/public/arm<br />
This is helpful for automatic booting:<br />
setenv bootcmd 'nboot.e kernel ; bootm'<br />
= Setting up embedian =<br />
Follow this nice howto from BusError http://code.google.com/p/mini2440/wiki/Emdebian<br />
<br />
= Troubleshooting =<br />
== Write errors ==<br />
When you have bad blocks in NAND, you'll get write errors. This gives more information: http://wiki.openmoko.org/wiki/NAND_bad_blocks<br />
<br />
Clear the flash (do not reset the board till uboot is reinstalled, or you need to use NOR/vivi to reinstall uboot via usb):<br />
nand scrub<br />
Create new bad blocks table:<br />
nand createbbt<br />
Reflash uboot (use the size in the output from the tftp command and pad it to hit 512 byte boundaries for the nand write command)<br />
tftp 0x32000000 u-boot.bin<br />
nand write 32000000 0 <size of u-boot.bin><br />
reset<br />
Create dynamic partitions:<br />
dynpart<br />
dynenv set u-boot_env<br />
saveenv<br />
reset<br />
And then use write.e to write to the mtdparts, e.g.:<br />
tftp 0x32000000 uImage<br />
nand write.e 32000000 kernel<br />
nboot.e kernel<br />
= Links =<br />
http://bliterness.blogspot.com/<br />
<br />
http://code.google.com/p/mini2440/<br />
<br />
http://blog.cor-net.org/ (Qt 4.5 on mini2440)</div>Gerryhttp://wiki.linuxmce.org/index.php?title=Mini2440&diff=18715Mini24402009-05-02T01:37:11Z<p>Gerry: </p>
<hr />
<div>[[Category: Hardware]]<br />
[[Image:Mini2440.jpg|thumb|200px|mini2440]]<br />
<br />
= About =<br />
This is a howto install uboot and a new kernel on the mini2440. Big thanks to BusError for the instructions and guidance. DISCLAIMER: This worked for me, if it eats your cat or burns your kitchen sink, don't blame me.<br />
<br />
= Preparations =<br />
== Toolchain ==<br />
I used this one: http://www.codesourcery.com/sgpp/lite/arm/portal/package3696/public/arm-none-linux-gnueabi/arm-2008q3-72-arm-none-linux-gnueabi-i686-pc-linux-gnu.tar.bz2<br />
<br />
Add the bin dir to the $PATH. If you have a toolchain with another prefix (like arm-linux-) adapt the CROSS_COMPILE environment variable in the next steps.<br />
<br />
= Setting up the bootloader =<br />
== Compiling uboot ==<br />
Clone the git tree:<br />
mkdir uboot ; cd uboot<br />
git clone git://repo.or.cz/u-boot-openmoko/mini2440.git<br />
Setup cross compiling:<br />
export CROSS_COMPILE=arm-none-linux-gnueabi-<br />
or edit your .bashrc eg. <br />
export CROSS_COMPILE=arm-none-linux-gnueabi-<br />
export PS1="\[\033[1;34m\]\u \[\033[0m\]\w:\$: \[\033[0m\]"<br />
#export PS1="\u:\w\$>"<br />
LS_OPTIONS="--color=auto"<br />
alias ls="ls $LS_OPTIONS"<br />
Prepare the mini2440 target:<br />
cd mini2440<br />
make mini2440_config<br />
Compile:<br />
make all<br />
This will give you a "u-boot.bin". If you get an error about a missing whatever-gcc, verifiy if there is a hardcoded CROSS_COMPILE setting in the Makefile<br />
<br />
== Flashing uboot ==<br />
We use the installed vivi bootloader to load uboot via usb. Power the board off, set the NOR switch to on, power the board on. You'll get the vivi output on the serial console. Press 'q' to go to the shell and do the "load flash" on address 0 with the size of "u-boot.bin" (238232 bytes in this example):<br />
<br />
<pre><br />
[q] Goto shell of vivi <br />
Enter your selection: q <br />
Supervivi> load flash 0 238232 u <br />
USB host is connected. Waiting a download. <br />
</pre><br />
<br />
Use the "s3c2410_boot_usb" utility (http://mini2440.googlecode.com/files/s3c2410_boot_usb-20060807.tar.bz2) to upload the "u-boot.bin" via usb:<br />
./s3c2410_boot_usb u-boot.bin <br />
You'll see something like this as output, ignore the error message:<br />
<pre><br />
csum = 0x9a6e<br />
send_file: addr = 0x33f80000, len = 0x0003a298<br />
Error downloading program<br />
</pre><br />
and this on the serial console:<br />
<pre><br />
Now, Downloading [ADDRESS:30000000h,TOTAL:238242] <br />
RECEIVED FILE SIZE: 238242 (232KB/S, 1S) <br />
Downloaded file at 0x30000000, size = 238232 bytes <br />
Found block size = 0x0003c000 <br />
Erasing... ... done <br />
Writing... ... done <br />
Written 238232 bytes <br />
Supervivi><br />
</pre><br />
<br />
Now power off the board, set the NOR switch back to off, and power on the board. We verify the version and then prepare config storage in flash:<br />
<pre><br />
MINI2440 # version <br />
<br />
U-Boot 1.3.2-dirty-moko12 (Mar 8 2009 - 13:50:19) <br />
<br />
MINI2440 # dynenv set 40000 <br />
device 0 offset 0x40000, size 0x3fc0000 <br />
45 4e 56 30 - 00 00 04 00 <br />
<br />
MINI2440 # saveenv <br />
Saving Environment to NAND... <br />
Erasing Nand...Writing to Nand... done <br />
<br />
MINI2440 # reset <br />
</pre><br />
== Configure uboot ==<br />
do a "printenv" to show active settings. Adjust the IP for uboot and the tftp server. We need proper IP connectivity to load the kernel with tftp. "setenv" is your friend. "saveenv" stores the setting to flash.<br />
<br />
= Kernel =<br />
== Compilation ==<br />
Fetch from git:<br />
mkdir kernel ; cd kernel<br />
git clone git://repo.or.cz/linux-2.6/mini2440.git<br />
cd mini2440<br />
mkdir -p ../kernel-bin<br />
Generate .config from mini2440 template:<br />
CROSS_COMPILE=arm-none-linux-gnueabi- ARCH=arm make O=../kernel-bin/ mini2440_defconfig<br />
Compile kernel and modules:<br />
CROSS_COMPILE=arm-none-linux-gnueabi- ARCH=arm make O=../kernel-bin/<br />
Generate "uImage" with the "mkimage" tool:<br />
../uboot/mini2440/tools/mkimage -A arm -O linux -T kernel -C none -a 0x30008000 -e 0x30008000 -d ../kernel-bin/arch/arm/boot/zImage /tftpboot/uImage<br />
<br />
== Flash kernel ==<br />
Verify partitions, we need the offset for the kernel partition (probably 0x60000):<br />
mtdparts<br />
Erase the kernel partition:<br />
nand erase 60000 <padded size><br />
Load the kernel with uboot into ram:<br />
tftp 0x32000000 uImage<br />
Note the size, pad it to 512 byte and use the nand write command to flash it:<br />
nand write 32000000 60000 <padded size>.<br />
== Configure uboot ==<br />
We use a nfs chroot for now:<br />
setenv bootargs console=ttySAC0,115200 noinitrd init=/sbin/init mini2440=1tb ip=192.168.80.12 root=/dev/nfs rw nfsroot=192.168.80.1:/home/public/arm<br />
This is helpful for automatic booting:<br />
setenv bootcmd 'nboot.e kernel ; bootm'<br />
= Setting up embedian =<br />
Follow this nice howto from BusError http://code.google.com/p/mini2440/wiki/Emdebian<br />
<br />
= Troubleshooting =<br />
== Write errors ==<br />
When you have bad blocks in NAND, you'll get write errors. This gives more information: http://wiki.openmoko.org/wiki/NAND_bad_blocks<br />
<br />
Clear the flash (do not reset the board till uboot is reinstalled, or you need to use NOR/vivi to reinstall uboot via usb):<br />
nand scrub<br />
Create new bad blocks table:<br />
nand createbbt<br />
Reflash uboot (use the size in the output from the tftp command and pad it to hit 512 byte boundaries for the nand write command)<br />
tftp 0x32000000 u-boot.bin<br />
nand write 32000000 0 <size of u-boot.bin><br />
reset<br />
Create dynamic partitions:<br />
dynpart<br />
dynenv set u-boot_env<br />
saveenv<br />
reset<br />
And then use write.e to write to the mtdparts, e.g.:<br />
tftp 0x32000000 uImage<br />
nand write.e 32000000 kernel<br />
nboot.e kernel<br />
= Links =<br />
http://bliterness.blogspot.com/<br />
<br />
http://code.google.com/p/mini2440/<br />
<br />
http://blog.cor-net.org/ (Qt 4.5 on mini2440)</div>Gerryhttp://wiki.linuxmce.org/index.php?title=Mini2440&diff=18714Mini24402009-05-02T01:36:34Z<p>Gerry: </p>
<hr />
<div>[[Category: Hardware]]<br />
[[Image:Mini2440.jpg|thumb|200px|mini2440]]<br />
<br />
= About =<br />
This is a howto install uboot and a new kernel on the mini2440. Big thanks to BusError for the instructions and guidance. DISCLAIMER: This worked for me, if it eats your cat or burns your kitchen sink, don't blame me.<br />
<br />
= Preparations =<br />
== Toolchain ==<br />
I used this one: http://www.codesourcery.com/sgpp/lite/arm/portal/package3696/public/arm-none-linux-gnueabi/arm-2008q3-72-arm-none-linux-gnueabi-i686-pc-linux-gnu.tar.bz2<br />
<br />
Add the bin dir to the $PATH. If you have a toolchain with another prefix (like arm-linux-) adapt the CROSS_COMPILE environment variable in the next steps.<br />
<br />
= Setting up the bootloader =<br />
== Compiling uboot ==<br />
Clone the git tree:<br />
mkdir uboot ; cd uboot<br />
git clone git://repo.or.cz/u-boot-openmoko/mini2440.git<br />
Setup cross compiling:<br />
export CROSS_COMPILE=arm-none-linux-gnueabi-<br />
or edit you .bashrc eg. <br />
export CROSS_COMPILE=arm-none-linux-gnueabi-<br />
export PS1="\[\033[1;34m\]\u \[\033[0m\]\w:\$: \[\033[0m\]"<br />
#export PS1="\u:\w\$>"<br />
LS_OPTIONS="--color=auto"<br />
alias ls="ls $LS_OPTIONS"<br />
Prepare the mini2440 target:<br />
cd mini2440<br />
make mini2440_config<br />
Compile:<br />
make all<br />
This will give you a "u-boot.bin". If you get an error about a missing whatever-gcc, verifiy if there is a hardcoded CROSS_COMPILE setting in the Makefile<br />
<br />
== Flashing uboot ==<br />
We use the installed vivi bootloader to load uboot via usb. Power the board off, set the NOR switch to on, power the board on. You'll get the vivi output on the serial console. Press 'q' to go to the shell and do the "load flash" on address 0 with the size of "u-boot.bin" (238232 bytes in this example):<br />
<br />
<pre><br />
[q] Goto shell of vivi <br />
Enter your selection: q <br />
Supervivi> load flash 0 238232 u <br />
USB host is connected. Waiting a download. <br />
</pre><br />
<br />
Use the "s3c2410_boot_usb" utility (http://mini2440.googlecode.com/files/s3c2410_boot_usb-20060807.tar.bz2) to upload the "u-boot.bin" via usb:<br />
./s3c2410_boot_usb u-boot.bin <br />
You'll see something like this as output, ignore the error message:<br />
<pre><br />
csum = 0x9a6e<br />
send_file: addr = 0x33f80000, len = 0x0003a298<br />
Error downloading program<br />
</pre><br />
and this on the serial console:<br />
<pre><br />
Now, Downloading [ADDRESS:30000000h,TOTAL:238242] <br />
RECEIVED FILE SIZE: 238242 (232KB/S, 1S) <br />
Downloaded file at 0x30000000, size = 238232 bytes <br />
Found block size = 0x0003c000 <br />
Erasing... ... done <br />
Writing... ... done <br />
Written 238232 bytes <br />
Supervivi><br />
</pre><br />
<br />
Now power off the board, set the NOR switch back to off, and power on the board. We verify the version and then prepare config storage in flash:<br />
<pre><br />
MINI2440 # version <br />
<br />
U-Boot 1.3.2-dirty-moko12 (Mar 8 2009 - 13:50:19) <br />
<br />
MINI2440 # dynenv set 40000 <br />
device 0 offset 0x40000, size 0x3fc0000 <br />
45 4e 56 30 - 00 00 04 00 <br />
<br />
MINI2440 # saveenv <br />
Saving Environment to NAND... <br />
Erasing Nand...Writing to Nand... done <br />
<br />
MINI2440 # reset <br />
</pre><br />
== Configure uboot ==<br />
do a "printenv" to show active settings. Adjust the IP for uboot and the tftp server. We need proper IP connectivity to load the kernel with tftp. "setenv" is your friend. "saveenv" stores the setting to flash.<br />
<br />
= Kernel =<br />
== Compilation ==<br />
Fetch from git:<br />
mkdir kernel ; cd kernel<br />
git clone git://repo.or.cz/linux-2.6/mini2440.git<br />
cd mini2440<br />
mkdir -p ../kernel-bin<br />
Generate .config from mini2440 template:<br />
CROSS_COMPILE=arm-none-linux-gnueabi- ARCH=arm make O=../kernel-bin/ mini2440_defconfig<br />
Compile kernel and modules:<br />
CROSS_COMPILE=arm-none-linux-gnueabi- ARCH=arm make O=../kernel-bin/<br />
Generate "uImage" with the "mkimage" tool:<br />
../uboot/mini2440/tools/mkimage -A arm -O linux -T kernel -C none -a 0x30008000 -e 0x30008000 -d ../kernel-bin/arch/arm/boot/zImage /tftpboot/uImage<br />
<br />
== Flash kernel ==<br />
Verify partitions, we need the offset for the kernel partition (probably 0x60000):<br />
mtdparts<br />
Erase the kernel partition:<br />
nand erase 60000 <padded size><br />
Load the kernel with uboot into ram:<br />
tftp 0x32000000 uImage<br />
Note the size, pad it to 512 byte and use the nand write command to flash it:<br />
nand write 32000000 60000 <padded size>.<br />
== Configure uboot ==<br />
We use a nfs chroot for now:<br />
setenv bootargs console=ttySAC0,115200 noinitrd init=/sbin/init mini2440=1tb ip=192.168.80.12 root=/dev/nfs rw nfsroot=192.168.80.1:/home/public/arm<br />
This is helpful for automatic booting:<br />
setenv bootcmd 'nboot.e kernel ; bootm'<br />
= Setting up embedian =<br />
Follow this nice howto from BusError http://code.google.com/p/mini2440/wiki/Emdebian<br />
<br />
= Troubleshooting =<br />
== Write errors ==<br />
When you have bad blocks in NAND, you'll get write errors. This gives more information: http://wiki.openmoko.org/wiki/NAND_bad_blocks<br />
<br />
Clear the flash (do not reset the board till uboot is reinstalled, or you need to use NOR/vivi to reinstall uboot via usb):<br />
nand scrub<br />
Create new bad blocks table:<br />
nand createbbt<br />
Reflash uboot (use the size in the output from the tftp command and pad it to hit 512 byte boundaries for the nand write command)<br />
tftp 0x32000000 u-boot.bin<br />
nand write 32000000 0 <size of u-boot.bin><br />
reset<br />
Create dynamic partitions:<br />
dynpart<br />
dynenv set u-boot_env<br />
saveenv<br />
reset<br />
And then use write.e to write to the mtdparts, e.g.:<br />
tftp 0x32000000 uImage<br />
nand write.e 32000000 kernel<br />
nboot.e kernel<br />
= Links =<br />
http://bliterness.blogspot.com/<br />
<br />
http://code.google.com/p/mini2440/<br />
<br />
http://blog.cor-net.org/ (Qt 4.5 on mini2440)</div>Gerryhttp://wiki.linuxmce.org/index.php?title=Mini2440&diff=18713Mini24402009-05-02T01:31:31Z<p>Gerry: </p>
<hr />
<div>[[Category: Hardware]]<br />
[[Image:Mini2440.jpg|thumb|200px|mini2440]]<br />
<br />
= About =<br />
This is a howto install uboot and a new kernel on the mini2440. Big thanks to BusError for the instructions and guidance. DISCLAIMER: This worked for me, if it eats your cat or burns your kitchen sink, don't blame me.<br />
<br />
= Preparations =<br />
== Toolchain ==<br />
I used this one: http://www.codesourcery.com/sgpp/lite/arm/portal/package3696/public/arm-none-linux-gnueabi/arm-2008q3-72-arm-none-linux-gnueabi-i686-pc-linux-gnu.tar.bz2<br />
<br />
Add the bin dir to the $PATH. If you have a toolchain with another prefix (like arm-linux-) adapt the CROSS_COMPILE environment variable in the next steps.<br />
<br />
= Setting up the bootloader =<br />
== Compiling uboot ==<br />
Clone the git tree:<br />
mkdir uboot ; cd uboot<br />
git clone git://repo.or.cz/u-boot-openmoko/mini2440.git<br />
Setup cross compiling:<br />
export CROSS_COMPILE=arm-none-linux-gnueabi- <br />
Prepare the mini2440 target:<br />
cd mini2440<br />
make mini2440_config<br />
Compile:<br />
make all<br />
This will give you a "u-boot.bin". If you get an error about a missing whatever-gcc, verifiy if there is a hardcoded CROSS_COMPILE setting in the Makefile<br />
<br />
== Flashing uboot ==<br />
We use the installed vivi bootloader to load uboot via usb. Power the board off, set the NOR switch to on, power the board on. You'll get the vivi output on the serial console. Press 'q' to go to the shell and do the "load flash" on address 0 with the size of "u-boot.bin" (238232 bytes in this example):<br />
<br />
<pre><br />
[q] Goto shell of vivi <br />
Enter your selection: q <br />
Supervivi> load flash 0 238232 u <br />
USB host is connected. Waiting a download. <br />
</pre><br />
<br />
Use the "s3c2410_boot_usb" utility (http://mini2440.googlecode.com/files/s3c2410_boot_usb-20060807.tar.bz2) to upload the "u-boot.bin" via usb:<br />
./s3c2410_boot_usb u-boot.bin <br />
You'll see something like this as output, ignore the error message:<br />
<pre><br />
csum = 0x9a6e<br />
send_file: addr = 0x33f80000, len = 0x0003a298<br />
Error downloading program<br />
</pre><br />
and this on the serial console:<br />
<pre><br />
Now, Downloading [ADDRESS:30000000h,TOTAL:238242] <br />
RECEIVED FILE SIZE: 238242 (232KB/S, 1S) <br />
Downloaded file at 0x30000000, size = 238232 bytes <br />
Found block size = 0x0003c000 <br />
Erasing... ... done <br />
Writing... ... done <br />
Written 238232 bytes <br />
Supervivi><br />
</pre><br />
<br />
Now power off the board, set the NOR switch back to off, and power on the board. We verify the version and then prepare config storage in flash:<br />
<pre><br />
MINI2440 # version <br />
<br />
U-Boot 1.3.2-dirty-moko12 (Mar 8 2009 - 13:50:19) <br />
<br />
MINI2440 # dynenv set 40000 <br />
device 0 offset 0x40000, size 0x3fc0000 <br />
45 4e 56 30 - 00 00 04 00 <br />
<br />
MINI2440 # saveenv <br />
Saving Environment to NAND... <br />
Erasing Nand...Writing to Nand... done <br />
<br />
MINI2440 # reset <br />
</pre><br />
== Configure uboot ==<br />
do a "printenv" to show active settings. Adjust the IP for uboot and the tftp server. We need proper IP connectivity to load the kernel with tftp. "setenv" is your friend. "saveenv" stores the setting to flash.<br />
<br />
= Kernel =<br />
== Compilation ==<br />
Fetch from git:<br />
mkdir kernel ; cd kernel<br />
git clone git://repo.or.cz/linux-2.6/mini2440.git<br />
cd mini2440<br />
mkdir -p ../kernel-bin<br />
Generate .config from mini2440 template:<br />
CROSS_COMPILE=arm-none-linux-gnueabi- ARCH=arm make O=../kernel-bin/ mini2440_defconfig<br />
Compile kernel and modules:<br />
CROSS_COMPILE=arm-none-linux-gnueabi- ARCH=arm make O=../kernel-bin/<br />
Generate "uImage" with the "mkimage" tool:<br />
../uboot/mini2440/tools/mkimage -A arm -O linux -T kernel -C none -a 0x30008000 -e 0x30008000 -d ../kernel-bin/arch/arm/boot/zImage /tftpboot/uImage<br />
<br />
== Flash kernel ==<br />
Verify partitions, we need the offset for the kernel partition (probably 0x60000):<br />
mtdparts<br />
Erase the kernel partition:<br />
nand erase 60000 <padded size><br />
Load the kernel with uboot into ram:<br />
tftp 0x32000000 uImage<br />
Note the size, pad it to 512 byte and use the nand write command to flash it:<br />
nand write 32000000 60000 <padded size>.<br />
== Configure uboot ==<br />
We use a nfs chroot for now:<br />
setenv bootargs console=ttySAC0,115200 noinitrd init=/sbin/init mini2440=1tb ip=192.168.80.12 root=/dev/nfs rw nfsroot=192.168.80.1:/home/public/arm<br />
This is helpful for automatic booting:<br />
setenv bootcmd 'nboot.e kernel ; bootm'<br />
= Setting up embedian =<br />
Follow this nice howto from BusError http://code.google.com/p/mini2440/wiki/Emdebian<br />
<br />
= Troubleshooting =<br />
== Write errors ==<br />
When you have bad blocks in NAND, you'll get write errors. This gives more information: http://wiki.openmoko.org/wiki/NAND_bad_blocks<br />
<br />
Clear the flash (do not reset the board till uboot is reinstalled, or you need to use NOR/vivi to reinstall uboot via usb):<br />
nand scrub<br />
Create new bad blocks table:<br />
nand createbbt<br />
Reflash uboot (use the size in the output from the tftp command and pad it to hit 512 byte boundaries for the nand write command)<br />
tftp 0x32000000 u-boot.bin<br />
nand write 32000000 0 <size of u-boot.bin><br />
reset<br />
Create dynamic partitions:<br />
dynpart<br />
dynenv set u-boot_env<br />
saveenv<br />
reset<br />
And then use write.e to write to the mtdparts, e.g.:<br />
tftp 0x32000000 uImage<br />
nand write.e 32000000 kernel<br />
nboot.e kernel<br />
= Links =<br />
http://bliterness.blogspot.com/<br />
<br />
http://code.google.com/p/mini2440/<br />
<br />
http://blog.cor-net.org/ (Qt 4.5 on mini2440)</div>Gerry