Compilation for UBOOT
=====================
Pre-request: User should install the corresponding cross tool chain in advance.
It is a very simple procedures, user has to choose the target platform first.
user:/home/user/u-boot-arm/make ARCH=arm CROSS_COMPILE=arm-marvel-linux-gnueabi- aspenite_config
Then user should able to build the uboot as below.
user:/home/user/u-boot-arm/make ARCH=arm CROSS_COMPILE=arm-marvel-linux-gnueabi-
(PS:The output binary is placed in the same directory.)
CPU directory
=============
uboot is starting from \u-boot-arm\cpu\pxa\start.s & it defined the standard arm reset vector table
as below.
.globl _start
_start: b reset
ldr pc, _undefined_instruction
ldr pc, _software_interrupt
ldr pc, _prefetch_abort
ldr pc, _data_abort
ldr pc, _not_used
ldr pc, _irq
ldr pc, _fiq
_undefined_instruction: .word undefined_instruction
_software_interrupt: .word software_interrupt
_prefetch_abort: .word prefetch_abort
_data_abort: .word data_abort
_not_used: .word not_used
_irq: .word irq
_fiq: .word fiq
.balignl 16,0xdeadbeef
Below codes are impoerant & defined control by u-boot-arm\board\pxa\aspenite\u-boot.lds
_TEXT_BASE:
.word TEXT_BASE
.globl _armboot_start
_armboot_start:
.word _start
/*
* These are defined in the board-specific linker script.
*/
.globl _bss_start
_bss_start:
.word __bss_start
.globl _bss_end
_bss_end:
.word _end
Then it is the actual reset codes.
reset:
mrs r0,cpsr /* set the CPU to SVC32 mode */
bic r0,r0,#0x1f /* (superviser mode, M=10011) */
orr r0,r0,#0x13
msr cpsr,r0
Then it will call cpu_init_crit & performing very low level init stuffs. Normally, user no need to touch
these pieces of codes. It init clock, timer, interrupts & then determmine copy itself from flash into RAM (relocation) for execution.
The stack is setup as below.
_TEXT_BASE:
.word TEXT_BASE
.globl _armboot_start
_armboot_start:
.word _start
/*
* These are defined in the board-specific linker script.
*/
.globl _bss_start
_bss_start:
.word __bss_start
.globl _bss_end
_bss_end:
.word _end
Finally, it will jump to the C codes (Congrtulation ^_^)
ldr pc, _start_armboot
The start_armboot function is defined in lib_arm/board.c
cpu.c
It is defined those I-D caches function & doing IRQ setup if necessary.
interrupt.c
The pxa u-boot doesn't setup any interrupts.
serial.c
It is the serial port init, pxa_setbrg_dev().
Board directory
===============
Board directory mainly includes all the board specify stuffs.
u-boot.lds //linker script
aspenite_pxa168.c // development board init.
board_init() in the aspenite_pxa168.c is important, it enables clock, init gpio, regulator ...etc.
lib_arm directory
=================
start.s will finally call start_armboot and it is defined in /lib_arm/board.c
It is mainly call the mem_malloc_init function and all the peripherials init functions.
Conclusion
==========
The uboot is very powerful & it has many features to be explored.
Thursday, January 21, 2010
Tuesday, January 19, 2010
Uboot for PXA (1)
UBOOT is a loader based on PPC boot loader.
The file structure is simply shown as below:
u-boot-arm
|_board
|_common
|_cpu
|_disk
|_doc
|_drivers
|_examples
|_fs
|_include
|_lib_arm
|_lib_avr32
|_lib_blackfin
|_lib_generic
|_lib_i386
|_lib_m68k
|_lib_microblaze
|_lib_mips
|_lib_nios
|_lib_nios2
|_lib_ppc
|_lib_sh
|_lib_sparc
|_libfdt
|_nand_spl
|_net
|_nenand_ipl
|_post
|_tools
...
...
...
board: All supporting target boards ard defined in this directory. For example \u-boot-arm\board\pxa\aspenite
A board_init function is defined in aspenite_168.c
cpu: All supoorting CPU type are defined in this directory. For example \u-boot-arm\cpu\pxa
All CPU env init including interrupts are defined. start.s is the first pieces of codes running
in the system. Its main task is to copy the whole uboot from flash into ram & start execution.
common: This is the directory stored all the uboot commands. We normally look at cmb_boot.c & cmd_bootm.c
It has the function to verify the kernel & doing decompression.)
drivers: This directory provides all the interface drivers.
fs: This directory provides all the supporting file system.
lib_arm: This directory providing all the common libraries for arm platform.
include: All headers are placed in this directory. For example u-boot-arm\include\asm-arm\arch-pxa & u-boot-arm\include\asm-arm\arch-pxa168
The file structure is simply shown as below:
u-boot-arm
|_board
|_common
|_cpu
|_disk
|_doc
|_drivers
|_examples
|_fs
|_include
|_lib_arm
|_lib_avr32
|_lib_blackfin
|_lib_generic
|_lib_i386
|_lib_m68k
|_lib_microblaze
|_lib_mips
|_lib_nios
|_lib_nios2
|_lib_ppc
|_lib_sh
|_lib_sparc
|_libfdt
|_nand_spl
|_net
|_nenand_ipl
|_post
|_tools
...
...
...
board: All supporting target boards ard defined in this directory. For example \u-boot-arm\board\pxa\aspenite
A board_init function is defined in aspenite_168.c
cpu: All supoorting CPU type are defined in this directory. For example \u-boot-arm\cpu\pxa
All CPU env init including interrupts are defined. start.s is the first pieces of codes running
in the system. Its main task is to copy the whole uboot from flash into ram & start execution.
common: This is the directory stored all the uboot commands. We normally look at cmb_boot.c & cmd_bootm.c
It has the function to verify the kernel & doing decompression.)
drivers: This directory provides all the interface drivers.
fs: This directory provides all the supporting file system.
lib_arm: This directory providing all the common libraries for arm platform.
include: All headers are placed in this directory. For example u-boot-arm\include\asm-arm\arch-pxa & u-boot-arm\include\asm-arm\arch-pxa168
Thursday, June 18, 2009
A report for 2009 Java Certification Day
The event mainly introduce the updates of the Java technology. There are some interesting stuffs I would like to share with you ^_^
JavaFX:
The JavaFX technologies is great & it is a real cross platform environment. Developers can focus on the applications and no need to concern on the porting issues. JavaFX applications developed on PC could be moved to Mobile phone, MID or even TV very easily. More information could be found in http://www.javafx.com/
http://kenai.com/
It is a service where you can host your open source projects and code, as well as find and collaborate with developers of like mind. The presenter just demostrat a few steps to clone & creatre a facebook application & it is real interesting. As you don't need to understand PHP or some other coding language — such as Ruby on Rails, JavaScript, or Python — especially one that has a client library for our API.
http://www.java.com/en/store/index.jsp
In future, Java developers can sell the applications just similar to the iPhone developer. ^_^ It is another platform to support freelance developer.
http://zembly.com/
It is a super great service. It inspire the developer to collaborate with other developers of like mind. It is an excellent collaboration of the software development flow. NetBean 6.7 IDE will support this service. ^_^
LeJOS:
LeJOS (Lego Java OS) is an open source project. It allow you to program LEGO MINDSTORMS NXT in Java. For information could be found in http://lejos.sourceforge.net/index.php
What next?
SUN & Oracle is going to be merge & some new big things are coming. Let see what happen ^_^
JavaFX:
The JavaFX technologies is great & it is a real cross platform environment. Developers can focus on the applications and no need to concern on the porting issues. JavaFX applications developed on PC could be moved to Mobile phone, MID or even TV very easily. More information could be found in http://www.javafx.com/
http://kenai.com/
It is a service where you can host your open source projects and code, as well as find and collaborate with developers of like mind. The presenter just demostrat a few steps to clone & creatre a facebook application & it is real interesting. As you don't need to understand PHP or some other coding language — such as Ruby on Rails, JavaScript, or Python — especially one that has a client library for our API.
http://www.java.com/en/store/index.jsp
In future, Java developers can sell the applications just similar to the iPhone developer. ^_^ It is another platform to support freelance developer.
http://zembly.com/
It is a super great service. It inspire the developer to collaborate with other developers of like mind. It is an excellent collaboration of the software development flow. NetBean 6.7 IDE will support this service. ^_^
LeJOS:
LeJOS (Lego Java OS) is an open source project. It allow you to program LEGO MINDSTORMS NXT in Java. For information could be found in http://lejos.sourceforge.net/index.php
What next?
SUN & Oracle is going to be merge & some new big things are coming. Let see what happen ^_^
Tuesday, June 2, 2009
First trial to compile Android (Part 2)
1) To install the cross compiler for your target device.
e.g. arm-2008q1-126-arm-none-linux-gnueabi-i686-pc-linux-gnu.tar.bz2
It can be downloaded from codesourcery.com
2) Download the Linux kernel linux-2.6.25-android-1.0_r1.tar
$ tar -xf linux-2.6.25-android-1.0_r1.tar
3) Downlaod the Linux version Android SDK android-sdk-linux_x86-1.5_r2
4) To assemble the root file system.
i) To download the busybox under linux environment. http://benno.id.au/blog/2007/11/14/android-busybox
ii) To run the emulator from the SDK & acquire the root file system.
$./tools/emulator &
iii) The Android should be launched & user should go to the Settings & enable the folloing options.
Wait for debugger.
Show running processes.
Show screen updates
iv) Under the console, user should install the busybox as following.
$./adb push ./busybox /data
$./adb shell
$/data/busybox tar -czf system.tar.gz /system
$/data/busybox tar -czf data.tar.gz /data
$/data/busybox tar -czf etc.tar.gz /etc
$/data/busybox tar -czf sbin.tar.gz /sbin
$exit
$./adb pull /system.tar.gz ./
$./adb pull /data.tar.gz ./
$./adb pull /etc.tar.gz ./
$./adb pull /sbin.tar.gz ./
$./adb pull /init ./
5) To create the rootdisk
$ mkdir ram_disk
$ cd ram_disk
$ mkdir cache dev proc root sys tmp var
$tar -xf ./system.tar.gz
$tar -xf ./data.tar.gz
$tar -xf ./etc.tar.gz
$tar -xf ./sbin.tar.gz
$cp ./init ./
The root disk is ready now ^_^
7) The android kenel may not support the target board, user has to change the build configuration & add the platform depend codes accordingly.
e.g. /arch/arm/mach-s3c6410
8) Debug & cross compile the kernel & the rootdisk accordingly.
9) Good luck & have fun ^_^
e.g. arm-2008q1-126-arm-none-linux-gnueabi-i686-pc-linux-gnu.tar.bz2
It can be downloaded from codesourcery.com
2) Download the Linux kernel linux-2.6.25-android-1.0_r1.tar
$ tar -xf linux-2.6.25-android-1.0_r1.tar
3) Downlaod the Linux version Android SDK android-sdk-linux_x86-1.5_r2
4) To assemble the root file system.
i) To download the busybox under linux environment. http://benno.id.au/blog/2007/11/14/android-busybox
ii) To run the emulator from the SDK & acquire the root file system.
$./tools/emulator &
iii) The Android should be launched & user should go to the Settings & enable the folloing options.
Wait for debugger.
Show running processes.
Show screen updates
iv) Under the console, user should install the busybox as following.
$./adb push ./busybox /data
$./adb shell
$/data/busybox tar -czf system.tar.gz /system
$/data/busybox tar -czf data.tar.gz /data
$/data/busybox tar -czf etc.tar.gz /etc
$/data/busybox tar -czf sbin.tar.gz /sbin
$exit
$./adb pull /system.tar.gz ./
$./adb pull /data.tar.gz ./
$./adb pull /etc.tar.gz ./
$./adb pull /sbin.tar.gz ./
$./adb pull /init ./
5) To create the rootdisk
$ mkdir ram_disk
$ cd ram_disk
$ mkdir cache dev proc root sys tmp var
$tar -xf ./system.tar.gz
$tar -xf ./data.tar.gz
$tar -xf ./etc.tar.gz
$tar -xf ./sbin.tar.gz
$cp ./init ./
The root disk is ready now ^_^
7) The android kenel may not support the target board, user has to change the build configuration & add the platform depend codes accordingly.
e.g. /arch/arm/mach-s3c6410
8) Debug & cross compile the kernel & the rootdisk accordingly.
9) Good luck & have fun ^_^
Sunday, May 31, 2009
First trial to compile Android (Part 1)
1) To install the ubuntu-9.04-desktop-i386 system.
2) To install some building packages & utilities.
$ sudo apt-get install flex bison gperf libsdl-dev libesd0-dev libwxgtk2.6-dev build-essential zip curl
$ sudo apt-get install valgrind
$ sudo apt-get install sun-java6-jdk
4) To add some system variables.
export LANG=c
export PATH=~/bin:$PATH:.
export JAVA_HOME=/usr/lib/jvm/java-6-sun-1.6.0.07
export ANDROID_JAVA_HOME=$JAVA_HOME
3) It must install the Git & Repo, please read the link in detail. http://source.android.com/download/using-repo
$ sudo apt-get install git-core gnupg
$ curl http://android.git.kernel.org/repo >~/bin/repo
$ chmod a+x ~/bin/repo
$ mkdir myAndroid
$ cd myAndroid
$ repo init -u git://android.git.kernel.org/platform/manifest.git
4) User can download the Android codes now.
$ repo sync
5) To compile the Android.
$make
6) Checking the result in myAndroid/out.
Have fun ^_^
2) To install some building packages & utilities.
$ sudo apt-get install flex bison gperf libsdl-dev libesd0-dev libwxgtk2.6-dev build-essential zip curl
$ sudo apt-get install valgrind
$ sudo apt-get install sun-java6-jdk
4) To add some system variables.
export LANG=c
export PATH=~/bin:$PATH:.
export JAVA_HOME=/usr/lib/jvm/java-6-sun-1.6.0.07
export ANDROID_JAVA_HOME=$JAVA_HOME
3) It must install the Git & Repo, please read the link in detail. http://source.android.com/download/using-repo
$ sudo apt-get install git-core gnupg
$ curl http://android.git.kernel.org/repo >~/bin/repo
$ chmod a+x ~/bin/repo
$ mkdir myAndroid
$ cd myAndroid
$ repo init -u git://android.git.kernel.org/platform/manifest.git
4) User can download the Android codes now.
$ repo sync
5) To compile the Android.
$make
6) Checking the result in myAndroid/out.
Have fun ^_^
Friday, July 18, 2008
Ubuntu 8.04 Kernel Compilation
1) To prepare the necessary tooling, kernel-package libncurese-dev
>sudo apt-get install kernel-package libncurses5-dev
2) To download kernel source from kernel.org.
>cd /usr/src
>sudo wget http://ww.kernel.org/pub/linux/lernel/v2.6/linux-2.6.24.7.tar.bz2
3) To de-compress the kernel sources.
>sudo tar jxvf linux-2.6.24.7.tar.bz2
4) To create a soft link to the kernel source.
>sudo ln -s linux-2.6.24.7 linux
5) To copy the kernel configuration.
> cd linux
>sudo cp /boot/config-'uname -r' .config
6) To config the kernel.
>sudo make menuconfig
7) To clean up the old stuffs first.
> sudo make distclean
8) Exciting now, start to build the kernel source.
> sudo make-kpkg --initrd kernel_image kernel_headers
9) To install the kernel.
>sudo dpkg -i linux-image-2.6.24.7_2.6.24.7-10.00.Custom_i386.deb linux-headers-2.6.24.7_2.6.24.7-10.00.Custom_i386.deb
10) Aftter installation, user can check /boot/grub/menu.lst to ensure the kernel was added to the menu.
11) Reboot. ^_^
>sudo apt-get install kernel-package libncurses5-dev
2) To download kernel source from kernel.org.
>cd /usr/src
>sudo wget http://ww.kernel.org/pub/linux/lernel/v2.6/linux-2.6.24.7.tar.bz2
3) To de-compress the kernel sources.
>sudo tar jxvf linux-2.6.24.7.tar.bz2
4) To create a soft link to the kernel source.
>sudo ln -s linux-2.6.24.7 linux
5) To copy the kernel configuration.
> cd linux
>sudo cp /boot/config-'uname -r' .config
6) To config the kernel.
>sudo make menuconfig
7) To clean up the old stuffs first.
> sudo make distclean
8) Exciting now, start to build the kernel source.
> sudo make-kpkg --initrd kernel_image kernel_headers
9) To install the kernel.
>sudo dpkg -i linux-image-2.6.24.7_2.6.24.7-10.00.Custom_i386.deb linux-headers-2.6.24.7_2.6.24.7-10.00.Custom_i386.deb
10) Aftter installation, user can check /boot/grub/menu.lst to ensure the kernel was added to the menu.
11) Reboot. ^_^
Thursday, July 17, 2008
Setup a VMImage based on Ubuntu 8.04 for ARM Linux development.
Below is my blog to setup a VMImage based on Ubuntu 8.04 for accio development.
1) Install the VMWare workstation version 6.x or above. Please use the Bridge for network setting.
2) Since I am using static IP instead of the DHCP, please change the network setting of /etc/network/interfaces accordingly.
auto lo
iface lo inet loopback
#The primary network interface
auto eth0
#iface eth0 inet dhcp
iface eth0 inet static
address "your IP"
netmask 255.255.255.0
network ""
broadcast ""
gateway ""
3) To install the ftp server.
sudo apt-get install proftpd
(PS: Please select to run proftp server from standalone.)
(reference link: http://www.ubuntugeek.com/settingup-an-ftp-server-on-ubuntu-with-proftpd.html)
4) To install the samba server.
sudo apt-get install samba (reference link: http://ubuntuforums.org/showthread.php?t=202605)
5) To install gcc.
sudo apt-get install build-essential (reference link: http://www.linuxforums.org/forum/ubuntu-help/104156-gcc-installation-ubuntu.html)
if internet can't connect, please try.
sudo apt-cdrom add
sudo apt-get update
sudo apt-get install build-essential
6) To install ncurses. (It is for kernel menuconfig.)
sudo apt-get install build-essentials
sudo apt-get install libncurses5-dev
(reference link: http://ubuntuforums.org/showthread.php?t=296224)
7) To install gcc compiler version 3.4.6 for ARM9 Linux Platform
i) Download the arm-linux-gcc-3.4.6-ssl-0.1.2.tar.bz2 to /tmp directory
ii) Unzip the arm-linux-gcc-3.4.6-ssl-0.1.2.tar.bz2
- cd /tmp
- tar jvxf /tmp/ arm-linux-gcc-3.4.6-ssl-0.1.2.tar.bz2 –C /
iii) Set the environment variable of the user.
- Edit ~/.bashrc
- Add the line
ARM_GCC_TOOLS=/usr/local/arm/3.4.6/bin
PATH=$ARM_GCC_TOOLS:$PATH
8) TO install CVS client.
sudo apt-get install cvs
(reference link: http://sanatio.blogspot.com/2005/12/cvs-server-on-ubuntu.html)
(PS: User manual for ubuntu could be found here http://ubuntuguide.org/wiki/Ubuntu:Hardy)
1) Install the VMWare workstation version 6.x or above. Please use the Bridge for network setting.
2) Since I am using static IP instead of the DHCP, please change the network setting of /etc/network/interfaces accordingly.
auto lo
iface lo inet loopback
#The primary network interface
auto eth0
#iface eth0 inet dhcp
iface eth0 inet static
address "your IP"
netmask 255.255.255.0
network ""
broadcast ""
gateway ""
3) To install the ftp server.
sudo apt-get install proftpd
(PS: Please select to run proftp server from standalone.)
(reference link: http://www.ubuntugeek.com/settingup-an-ftp-server-on-ubuntu-with-proftpd.html)
4) To install the samba server.
sudo apt-get install samba (reference link: http://ubuntuforums.org/showthread.php?t=202605)
5) To install gcc.
sudo apt-get install build-essential (reference link: http://www.linuxforums.org/forum/ubuntu-help/104156-gcc-installation-ubuntu.html)
if internet can't connect, please try.
sudo apt-cdrom add
sudo apt-get update
sudo apt-get install build-essential
6) To install ncurses. (It is for kernel menuconfig.)
sudo apt-get install build-essentials
sudo apt-get install libncurses5-dev
(reference link: http://ubuntuforums.org/showthread.php?t=296224)
7) To install gcc compiler version 3.4.6 for ARM9 Linux Platform
i) Download the arm-linux-gcc-3.4.6-ssl-0.1.2.tar.bz2 to /tmp directory
ii) Unzip the arm-linux-gcc-3.4.6-ssl-0.1.2.tar.bz2
- cd /tmp
- tar jvxf /tmp/ arm-linux-gcc-3.4.6-ssl-0.1.2.tar.bz2 –C /
iii) Set the environment variable of the user.
- Edit ~/.bashrc
- Add the line
ARM_GCC_TOOLS=/usr/local/arm/3.4.6/bin
PATH=$ARM_GCC_TOOLS:$PATH
8) TO install CVS client.
sudo apt-get install cvs
(reference link: http://sanatio.blogspot.com/2005/12/cvs-server-on-ubuntu.html)
(PS: User manual for ubuntu could be found here http://ubuntuguide.org/wiki/Ubuntu:Hardy)
Subscribe to:
Posts (Atom)
