Transplantation of uclinux (2.6 kernel) on B0-general Linux technology-Linux programming and kernel information. The following is a detailed description. During the summer vacation, an ev40 lab box in the lab was taken home to prepare for some experiments.
First, we will introduce the hardware information of my experiment box related to transplantation:
Cpu: Samsung 44b0x
Nor flash: SST39vf160 (1 M x 16bit)
Nand flash: K9F2808
Sdram: HY57V65160B (4 M x 16bit)
Network Chip: RTL8019AS
1. download the relevant kernel source code
UClinux-dist-20040408.tar.gz
Linux-2.6.9.tar.bz2
Linux-2.6.9-hsc0.patch.gz
Decompress the source code:
Tar xzvf uClinux-dist-20040408.tar.gz
Tar jxvf linux-2.6.9.tar.bz2
Gunzip linux-2.6.9-hsc0.patch.gz
Patch-p0 <linux-2.6.9-hsc0.patch
Music linux-2.6.9 uClinux-dist
Cd uClinux-dist
Rm-rf linux-2.6.x
Mv linux-2.6.9 linux-2.6.x
2. download and install the cross-compilation environment
Arm-uclinux-tools-base-gcc3.4.0-20040713.sh
Installation:
/Arm-uclinux-tools-base-gcc3.4.0-20040713.sh
Mv arm-uclinux-tools/usr/local
In ~ /. Add the PATH of the compilation tool to the bash_profile file.
3. Modify the files related to the compilation tool in the source code:
Modify the file vendor/config/armnommu/config. arch
MACHINE = arm
ARCH = armnommu
CROSS_COMPILE = arm-uclinux-
CROSS = $ (CROSS_COMPILE)
Modify the Makefile file under the linux-2.6.x directory and add the following:
ARCH = armnommu
CROSS_COMPILE = arm-uclinux-
4. Add 44b0x related directories and files:
Cd vendors/Samsung
Mkdir 44b0x
Copy all files under Samsung/4510B (except config. linux-2.4.x and config. vendor-2.4.x) to the 44b0x directory.
Cp linux-2.6.x/arch/armnommu/configs/jx44b0x_defconfig vendors/Samsung/44b0x/config. linux-2.6.x
Modify the 44b0x/rc file, change ram0 in rows 2nd and 4th to ram1, and modify other rows as appropriate based on the board.
6, modify the uClinux-dist/linux-2.6.x/include/asm-armnommu/system. h file (some boards need to be changed, while my ev40 board does not need to be changed)
Change vectors_base to (CONFIG_DRAM_BASE + 0x8)
My ev40 board does not need to change the vectors_base value. Its value is CONFIG_DRAM_BASE (the PID error will occur after the change, and it will die in the PID line)
7. added a serial driver. Only the 44b0 serial port driver is included in the kernel source code. You need to write the serial driver yourself:
(1) Add files. (For the file, refer to the serial port driver of 4510. If you need it, please contact me)
Linux-2.6.x/drivers/serial/serial_jx44b0.c
Linux-2.6.x/include/asm-armnommu/arch-s3c44b0x/uart. h
(2), modify linux-2.6.x/drivers/serial/Kconfig, add 44B0X serial port related content
Config serial_jx44b0x
Bool '44b0x Serial Support'
Default y
Select SERIAL_CORE
Help
Samsung s344b0x Chips has built-in serial controler
Config serial_jx44b0x_console
Bool "Support for console on initi44b0x Serial port"
Depends on serial_jx44b0x = y
Select SERIAL_CORE_CONSOLE
Help
Allow selection of the s3c2444b0x on-board serial ports for use
An virtual console.
(3), modify linux-2.6.x/drivers/serial/Makefile, add 44B0x related content:
Obj-$ (config_serial_jx44b0x) + = serial_cloud44b0.o
(4), modify the linux-2.6.x/include/linux/serial_core.h, add the port_initi44b0 definition in it:
# Define port_jx44b0 62
(5), modify the Makefile and Kconfig file in the linux-2.6.x/arch/armnommu/mach-s3c44b0x/driver, comment out the original content related to the simple serial port.
(6), linux-2.6.x/drivers/serial/serial_jx44b0.c will have
Change config_serial_initi44b0_console to config_serial_initi44b0x_console.
And set the baud rate to the correct value.
(7) Remember to configure the value of the Register in the static void _ jx44b0_init (struct uart_port * port, int baud) function of serial_cloud44b0.c according to your own board.
8. added the NIC Driver. My network chip uses RTL8019AS. Without an accident, all 44B0 boards on the market use this chip, but some use 8 bits and some use 16 bits, the driver must be modified accordingly. I use the 8bit mode.
Here, we will only talk about the network card interrupt number, interrupt initialization, and the base address of the network card.
After the NIC Driver is enabled, Configure NFS and FTP to test the network.
(1). Configure the kernel:
Choose File Systems> Network file systems>:
NFS file system support
Provide NFSv3 client support
(2). Configure user options
Select the Network Applications ---> option:
Portmap
Go to BusyBox ---> Select Options:
Mount
Mount: support NFS mounts
Umount
(3) Configure NFS server on a linux host
(1) edit the/etc/exportfs file and add the following content:
/Test * (rw, sync, no_root_squash)
(2) enter the following command:
# Service portmap start
# Service nfs start
# Exportfs-rv (share the directory in/etc/exports again)
# Showmount-e (view all shared directories)
(4) Compile the kernel and download it to the Development Board for running. Use the following method to mount NFS:
Run the following command:
# Portmap & (remember to run this command, otherwise the NFS client cannot find the directory shared from the NFS server)
# Mount? T nfs 192.168.0.110:/test/mnt
# Ls/mnt
After the NIC Driver is complete, test ftp. the following error occurs:
During the ftp test, after logging in, run the ls command and other commands, the network will become very slow, and an error will occur after the bye command:
Skput: over: 0c01e530: 80 put: dev: eth0221 Goodbye. Then, use the ping command to test the network. The network latency will become long.
9. Port The boa web server.
(1) When configuring user options, go to Network Applications ---> Option Selection: boa
Enter the lib option and select build libZ
(2) modify the uClinux-dist/user/boa/src/defines. h file and add the definition # define SERVER_ROOT "/home/web"
(3) modify the uClinux-dist/user/boa/examples/boa. conf file.
Port 80
User 0
Group 0
ServerAdmin root @ localhost
DocumentRoot/home/web/html
UserDir public_html
DirectoryIndex index.html
KeepAliveMax 100
KeepAliveTimeout 10
MimeTypes/home/web/mime. types
DefaultType text/plain
ScriptAlias/cgi-bin/home/web/cgi-bin
ScriptAlias/index.html/home/web/html/index.html
The above is the simplest configuration of boa. conf. All others can be blocked, and some contents cannot be blocked, causing errors.
(4) modify the romfs/etc/inittab file and add the following content:
Boa: unknown:/bin/boa-c/home/web
(5) copy the uClinux-dist/user/boa/examples/boa. conf and mime. types files to romfs/home/web.
After this configuration, all the html files are put in the/home/web/html folder, and the cgi files are put in the/homt/web/cgi-bin folder, you can set the html and cgi-bin folders to the nfs file system, so that you can immediately test the webpage program. (Mount-t nfs 192.168.0.100:/web/home/web/html)
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.
A Free Trial That Lets You Build Big!
Start building with 50+ products and up to 12 months usage for Elastic Compute Service