CRI Radio

May 22, 2007

uClinux&skyeye Step

How to run uClinux kernel―base 20040408?

-------------------------------------------------------------------------

 

Step 0 : Install GNU Tools chain
1. download http://www.uclinux.org/pub/uClinux/arm-elf-tools/arm-elf-tools-20030314.sh
2. chmod 755 arm-elf-tools-20030314.sh
3. su root ./arm-elf-tools-20030314.sh
4. arm-elf-gcc -v
Step 1 : Compile uClinux Kernel
1. download http://www.uclinux.org/pub/uClinux/dist/uClinux-dist-20040408.tar.gz
2. tar xvzf uClinux-dist-20040408.tar.gz
3. cd uClinux-dist
4. vi linux-2.4.x/arch/armnommu/vmlinux-armv.lds.in

   Line 66

        *(got)  /* Global Offset table */

        #+++++++++++++

        romfs_data = .;

        romfs.o

        romfs_data_end = .;

        #+++++++++++++

5. vi vendors/Samsung/4510B/Makefile

   Line 66

image:

     [ -d $(IMAGEDIR) ] || mkdir -p $(IMAGEDIR)

     genromfs -v -V "ROMdisk" -f $(ROMFSIMG) -d $(ROMFSDIR)

     #+++++++++++++

     arm-elf-ld -r -o $(ROOTDIR)/$(LINUXDIR)/romfs.o -b binary $(ROMFSIMG)

     #+++++++++++++

     $(CROSS_COMPILE)objcopy -O binary --remove-section=.romvec \

     --remove-section=.text --remove-section=.ramvec \

     --remove-section=.init \

     --remove-section=.bss --remove-section=.eram \

     $(ROOTDIR)/$(LINUXDIR)/linux $(IMAGEDIR)/linux.data

 

6. make menuconfig

   Vendor/Product Selection  --->

 --- Select the Vendor you wish to target  

 (Samsung) Vendor

 --- Select the Product you wish to target

 (4510B) Samsung Products

                           

   Kernel/Library/Defaults Selection  --->

 (linux-2.4.x) Kernel Version                               

 (uClibc) Libc Version  

 

7. make dep
8. make lib_only
9. make user_only

vi config/.config

Line 25

     CONFIG_USER_LOGIN_LOGIN=y

     # CONFIG_USER_OLD_PASSWORDS=y <- - CONFIG_USER_OLD_PASSWORDS=y

     # CONFIG_USER_ONLY_ROOT is not set

rm user/boa/src/*.o

make user_only

10. Sh>make romfs
11. Sh>make

vi linux-2.4.x/arch/armnommu/mm/init.c

Line 662

    void free_initmem(void)

    {

    if (!machine_is_integrator() &&

    !machine_is_p52() &&

    !machine_is_cx821xx() &&

    !machine_is_atmel() &&

    !machine_is_netarm() &&

    //          !machine_is_ta7v() && <- - !machine_is_ta7v() &&

    !machine_is_ta7s()) {

    free_area((unsigned long)(&__init_begin),

    (unsigned long)(&__init_end),

    "init");

make

12. Sh>make image

make romfs

make

make image

12. ls images/* -l
13. ls linux-2.4.x/linux -l
14. date

 

Step 2: Add MyApplication
1. cd ../uClinux-dist
2. cd user
3. mkdir myapp
4. cd myapp
5. vi demo.c

 

#include <stdlib.h>

#include <stdio.h>

 

int main(void)

{

        printf("Hello world! \n");

        return 0;

}

 
6. vi Makefile

EXEC = demo

OBJS = demo.o

 

all: $(EXEC)

$(EXEC): $(OBJS)

        $(CC) $(LDFLAGS) -o $@ $(OBJS) $(LDLIBS)

 

romfs:

        $(ROMFSINST) /bin/$(EXEC)

 

clean:

        rm -f  $(EXEC) *.elf *.gdb *.o

 
7. cd ../..

vi user/Makefile

   Line 324

 

#+++++++++++++

dir_$(CONFIG_USER_MYAPP_DEMO)        += myapp

    #+++++++++++++

 
8. Sh>vi config/config.in

 

Append at tail

#+++++++++++++

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

 

mainmenu_option next_comment

comment 'My New Application'

 

bool 'demo'   CONFIG_USER_MYAPP_DEMO

comment "My New Application"

 

endmenu

 

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

#+++++++++++++

 

 
9. make menuconfig

   make dep

   make clean

   make lib_only

   make user_only

   make romfs

   make image

   make

 
10. download kernel

ls bin/demo

 

Step 3: Install SkyEye on RedHat 9.0
1. download http://gro.clinux.org/frs/download.php/912/skyeye-0.8.6.tar.bz2
2. tar xjvf skyeye-0.8.6.tar.bz2
3. cd skyeye
4. ./configure --target=arm-elf --prefix=/usr/local
5. make
6. make install
Step4: S3C4510B uClinux simulating on SkyEye
1. cp ../uClinux-dist/linux-2.4.x/linux .
2. vi Makefile

image.ram:

arm-elf-objcopy -O binary -R .note -R .comment -S linux image.ram
3. vi skyeye.conf

#skyeye config file sample

cpu: arm7tdmi

 

mach: s3c4510b

 

mem_bank: map=M, type=RW, addr=0x00000000, size=0x00800000

mem_bank: map=I, type=RW, addr=0x03ff0000, size=0x00100000

net: state=on, mac=0:4:3:2:1:f, ethmod=tun, hostip=192.108.10.2
4. ls �Cl
5. skyeye linux

target sim

load

run

Type Ctrl+C to Skyeye

Step5: GDB/Skyeye uClinux run on SkyEye
1. http://www.uclinux.org/pub/uClinux/dist/uClinux-dist-20041215.tar.gz
2. tar -zxvf uClinux-dist-20041215.tar.gz
3. cd uClinux-dist
4. make menuconfig

Vendor/Product Selection―>

      --select the vendor you wish to target

(GDB)vender

--Select the produet you wish to target

(skyeye)GDB produers

kernel/llibrary/defaults selctionà

     (linux-2.4.x)kernel version

     (uClibc)Lib version

Network device supportà

     --IMQneeds CONFIG_NETFILTER enabled

      [*]Universal TUN/TAP device driver support

      Ethernet(10 or 100Mbit)à

           [*]skyeye net2k ethernet support(for ArMulator)

Network Applicationà

[*]ifconfig

[*]ping
5. make process

   make dep

   make clean

   make lib_only

   make user_only

   make romfs

   make image

   make
7. cd ..
8. mkdir skyeye
9. cd skyeye
10. vi skyeye.conf

#skyeye config file sample

cpu: arm7tdmi

mach: at91

mem_bank: map=M, type=RW, addr=0x00000000, size=0x00004000

mem_bank: map=M, type=RW, addr=0x01000000, size=0x00400000

mem_bank: map=M, type=R,  addr=0x01400000, size=0x00400000, file=boot.rom

mem_bank: map=M, type=RW, addr=0x02000000, size=0x00400000

mem_bank: map=M, type=RW, addr=0x02400000, size=0x00008000

mem_bank: map=M, type=RW, addr=0x04000000, size=0x00400000

mem_bank: map=I, type=RW, addr=0xf0000000, size=0x10000000

#set nic info state=on/off  mac=xx:xx:xx:xx:xx:xx  ethmod=tuntap/vnet hostip= dd.dd.dd.dd

net: state=on, mac=0:4:3:2:1:f, ethmod=tuntap, hostip=192.168.10.5
11. cp ../uClinux-dist/linux-2.4.x/linux .
12. ln -s ../uClinux-dist/images/romfs.img boot.rom
13. skyeye linux

target sim

load

run

Type Ctrl+C to Skyeye