u-boot.bin - RSWiki

Download Report

Transcript u-boot.bin - RSWiki

Lab2 - Environment Setup
Lab 2
2014/9/30
Department of Computer Science and Information Engineering
National Taiwan University
1 / 30
 Install build system and setup network configuration.
 Learn how to copy (burn) files to flash on Creator XScale PXA270.
Local network
Lab 2
2014/9/30
Department of Computer Science and Information Engineering
National Taiwan University
2 / 30
 Host System
 Windows XP
 Build System
 VirtualBox + Ubuntu 8.04
 Target System
 Creator XScale PXA270
 Software
 VirtualBox
 Ubuntu 8.04
 Domingo
 Bootloader (U-Boot)
 Microtime diag program
 You can find all software on RSWiki CSL Course Software.
Lab 2
2014/9/30
Department of Computer Science and Information Engineering
National Taiwan University
3 / 30
PXA270
JTAG
Lab 2
2014/9/30
Ethernet cable
power supply
(PXA270)
ICE
power supply
(ICE)
Department of Computer Science and Information Engineering
National Taiwan University
RS232 null cable
parallel cable
4 / 30
 Connect RS232 null cable and parallel cable to your PC.
 You should connect ICE to your PC with parallel cable before turning on the PC.
 Connect Ethernet cable to your PC.
 Connect PXA270 and ICE via JTAG.
Ethernet cable
RS232
Lab 2
parallel cable
2014/9/30
Department of Computer Science and Information Engineering
National Taiwan University
5 / 30
Host System (Windows XP)
192.168.0.101
debug
Target System
(Creator XScale PXA270)
192.168.0.100
ICE and JTAG
CPU, RAM
Domingo
VirtualBox
Build System
(Ubuntu 8.04)
192.168.0.10
Samba server
TFTP server
Lab 2
2014/9/30
file sharing
Network
Neighborhood
download
Department of Computer Science and Information Engineering
National Taiwan University
TFTP client
6 / 30
 Please download VirtualBox from https://www.virtualbox.org/ or course
website (VirtualBox-4.3.16-95972-Win.exe).
 Install VirtualBox.
 Using default settings is fine.
 Note that the network will be disconnected temporarily during the installation.
 The related networking drivers should be installed.
Lab 2
2014/9/30
Department of Computer Science and Information Engineering
National Taiwan University
7 / 30
 Step 1: click “新增(N)” in “Oracle VM VirtualBox 管理員”.
 Step 2: create a Linux Ubuntu (32 bit) virtual machine (VM).
 The size of memory needs at least 512 MB.
 The size of disk needs at least 20 GB.
 Step 3: add an additional network adapter to the VM.
 “設定值(S)”  “網路”  “介面卡 2”  “啟用網路卡(E)”
 “附加到(A)” = “「僅限主機」介面卡”
Lab 2
2014/9/30
Department of Computer Science and Information Engineering
National Taiwan University
8 / 30
 Step 4: download Ubuntu 8.04 (ubuntu-8.04.4-desktop-i386.iso) from
course website.
 Step 5: start your virtual machine and choose the Ubuntu image file for
booting from CD/DVD.
 “裝置”  “CD/DVD 裝置”  “選擇虛擬 CD/DVD 磁碟檔案”
 Step 6: install Ubuntu 8.04.
 English version is more stable.
 Change time zone to “Asia”  “Taipei”.
 When finishing installation, press “ENTER” to reboot.
 Please remember the account <user name>
to login Linux.
 Tips:
 To uncaptured the keyboard and the mouse from virtual machine to Windows XP,
please press the host key, right ctrl key by default.
Lab 2
2014/9/30
Department of Computer Science and Information Engineering
National Taiwan University
9 / 30
 Step 1: open a terminal in Ubuntu 8.04.
 “Applications”  “Accessories”  “Terminal”
 You can execute commands with root privilege by typing “sudo <command>”.
 E.g., % sudo mkdir /etc/test
 Step 2: install guest additions in Ubuntu 8.04.
 “裝置”  “插入 Guest Additions CD 映像…”
 Execute the script in Ubuntu 8.04.
 % sudo /media/cdrom/VBoxLinuxAdditions.run
 Step 3: restart Ubuntu 8.04.
 % sudo reboot
 Tips:
 After complete installation of guest additions, you can also share clipboard
between Windows XP and Ubuntu.
 In VirtualBox:
 “機器”  “設定值”  “一般”  “進階”
 Change the setting of “共用剪貼簿” from “停用” to “雙向”.
Lab 2
2014/9/30
Department of Computer Science and Information Engineering
National Taiwan University
10 / 30
 Step 1: bridge the two network LAN, “VirtualBox Host-Only Network” and
“區域網路” which connects PXA270, together.
 Step 2: set IP address of the bridge on Windows XP to configure LAN
environment.
 IP address = 192.168.0.101
 Netmask = 255.255.255.0
 Step 3: set IP address on Ubuntu.
 % sudo nano /etc/network/interfaces
auto lo
iface lo inet loopback
auto eth0
iface eth0 inet dhcp
auto eth1
iface eth1 inet static
address 192.168.0.10
netmask 255.255.255.0
 % sudo /etc/init.d/networking restart
Lab 2
2014/9/30
Department of Computer Science and Information Engineering
National Taiwan University
11 / 30
 Unfortunately, Ubuntu 8.04 is now out of support and no longer receiving
updates and security patches. There are repositories available at
http://old-releases.ubuntu.com.
 Step 1: update apt repositories.
 % sudo sed -i -e 's/tw.archive.ubuntu.com\|security.ubuntu.com/old-
releases.ubuntu.com/g' /etc/apt/sources.list
 Be careful of the area which was set during the installation. If you chose the area other
than Taiwan, you have to modify the command to the correct one.
 You can type “man sed” to see more information.
 Step 2: upgrade the sources list.
 % sudo apt-get update
Lab 2
2014/9/30
Department of Computer Science and Information Engineering
National Taiwan University
12 / 30
 Samba is a free implementation of the SMB/CIFS networking protocol
originally developed by Andrew Tridgell.
 Through SMB/CIFS protocol, we can share files between Windows XP and
Linux by network neighborhood (網路芳鄰).
 Step 1: install samba server in Ubuntu.
 % sudo apt-get install samba
 Step 2: set the samba password of your user account for samba service.
 % sudo smbpasswd <user name>
Reference: Wikipedia - Samba, http://en.wikipedia.org/wiki/Samba_%28software%29
Lab 2
2014/9/30
Department of Computer Science and Information Engineering
National Taiwan University
13 / 30
 Step 3: share your home directory by adding a new entry <share> in
/etc/samba/smb.conf.
[<share>]
path = /home/<user name>
browseable = yes
read only = no
create mask = 0664
directory mask = 0755
security = share
 Step 4: restart the samba service.
 % sudo /etc/init.d/samba restart
 Please also set the workgroup in [global] entry to the workgroup of host
system (Windows XP), e.g., MSHOME, etc.
 You can check the workgroup in Windows XP by right-clicking on
“我的電腦”  “內容”  “電腦名稱”.
Lab 2
2014/9/30
Department of Computer Science and Information Engineering
National Taiwan University
14 / 30
 Step 1: open “我的電腦”.
 Step 2: click “工具”  “連線網路磁碟機”
 Step 3: input the samba server name.
 “磁碟機” = S:
 “資料夾” = \\192.168.0.10\<share>
 Now, you can access files on Ubuntu from Windows.
Lab 2
2014/9/30
Department of Computer Science and Information Engineering
National Taiwan University
15 / 30
 Step 1: install TFTP server in Ubuntu.
 % sudo apt-get install xinetd tftpd tftp
 Step 2: create /etc/xinetd.d/tftp and put the following settings.
 % sudo nano /etc/xinetd.d/tftp
service tftp
{
protocol
port
socket_type
wait
user
server
server_args
disable
}
Lab 2
2014/9/30
=
=
=
=
=
=
=
=
udp
69
dgram
yes
nobody
/usr/sbin/in.tftpd
/home/<user name>/<root path>
no
Department of Computer Science and Information Engineering
National Taiwan University
16 / 30
 Step 3: create TFTP Server root directory.
 % cd ~
 % sudo mkdir <root path>
 % sudo chmod -R 777 <root path>
 % sudo chown -R nobody <root path>
 Step 4: restart the xinetd service.
 % sudo /etc/init.d/xinetd restart
 Step 5: test the TFTP server
 % cd ~/<root path>
 % nano test.txt
 Input some texts in this file.
 % cd /tmp
 % tftp 192.168.0.10
 tftp> get test.txt
 tftp> quit
Lab 2
2014/9/30
Department of Computer Science and Information Engineering
National Taiwan University
17 / 30
 Domingo is an integrated development environment (IDE) developed by
Microtime Computer Inc..
 Domingo adopts visual project management which integrates with editor,
compiler, and debugger. It lets you manage project just from a single
environment.
Lab 2
2014/9/30
Department of Computer Science and Information Engineering
National Taiwan University
18 / 30
 Step 1: download domingo (DomingoforLinux_V131923.iso) from our
course website.
 Step 2: directly extract this image by WinRAR.
 Step 3: click autorun.exe in CD to install.
 We will use this to manage ICE.
Lab 2
2014/9/30
Department of Computer Science and Information Engineering
National Taiwan University
19 / 30
 Step 1: after complete installation, execute “Domingo for Linux 1.3”.
 Step 2: choose “New Project”.
 Step 3: configure “TargetMachine” and “Processor”.
 TargetMachine = Carrier ICE/WINeZ/WIN2K ARM
 Processor = PXA270
 Step 4: configure “peripheral configuration manager (PCM)”.
 Import “creator_pxa270.pcm”.
 Click “To Initialize PCM when Connect” and “Ok”.
Lab 2
2014/9/30
Department of Computer Science and Information Engineering
National Taiwan University
20 / 30
 Step 1: check the hardware connection between PXA270 and ICE.
 Be careful to connect parallel cable before turning on the PC.
 Step 2: click “Debug”  “Connect” or “connect the IDE to WINICE” to
connect PXA270.
 Now, you can see related register value and instructions.
Lab 2
2014/9/30
Department of Computer Science and Information Engineering
National Taiwan University
21 / 30
U-Boot
0x00000000
0xA0000000
0x00040000
diag
0x00080000
U-Boot (TFTP)
U-Boot (Domingo)
Flash
Lab 2
2014/9/30
0x02000000
RAM
Department of Computer Science and Information Engineering
National Taiwan University
0xA1080000
0xA3F80000
0xA4000000
22 / 30
 Step 1: download “u-boot.bin” from our course website.
 Step 2: click “Debug”  “Load Module ...” in Domingo.
 Step 3: load u-boot.bin and configure “Option” to P;A3F80000.
 Step 4: Click “Ok”.
Lab 2
2014/9/30
Department of Computer Science and Information Engineering
National Taiwan University
23 / 30
 Step 5: connect to the serial console on PXA270 via putty.
 Please execute the putty which is installed in Lab1.
 Step 6: configure com port and speed.
 Connection Type = Serial
 Serial line = COM1
 Speed = 9600
 Step 7: click “Open”.
Lab 2
2014/9/30
Department of Computer Science and Information Engineering
National Taiwan University
24 / 30
 Step 8: change PC value to A3F80000 in register window.
 Please press enter to commit the change.
 Step 9: click “Debug”  “Free Go”, and then you will see the message on
putty.
 Remember to hit any key to stop U-Boot autoboot.
Lab 2
2014/9/30
Department of Computer Science and Information Engineering
National Taiwan University
25 / 30
 Step 1: put u-boot.bin into the folder <root path> in Ubuntu.
 Step 2: execute “tftp” command in U-Boot to get file.
 u-boot$ tftp a1080000 u-boot.bin
 By default, u-boot will find the TFTP server in 192.168.0.10.
size of u-boot.bin
Lab 2
2014/9/30
Department of Computer Science and Information Engineering
National Taiwan University
26 / 30
 Suppose we want to copy (burn) a file with 0x1a6c0 byes from RAM
address 0xA1080000 to flash address 0x0, i.e., the u-boot.bin.
 Step 1: erase the specified range (0x0 to 0x7FFFF).
 Flash should be erased before copying files.
 u-boot$ protect off 0 7ffff
 u-boot$ erase 0 7ffff
 Step 2: copy the file from RAM to flash.
 u-boot$ cp.b a1080000 0 1a6c0
 Step 3: now, you can reset PXA270 and check the message of U-Boot.
 Also, you can remove the JTAG from PXA270 because now you have a U-Boot
program on your PXA270 and there is no need to use Domingo.
 In case your U-Boot is broken, please use Domingo to copy a new one.
Lab 2
2014/9/30
Department of Computer Science and Information Engineering
National Taiwan University
27 / 30
 Microtime provides a program “diag” that can help developers diagnose
peripheral devices on PXA270, e.g., SDRAM, flash, LED, CCD, LCD, etc.
You can diagnose the target board by yourself first if you think it is
broken.
 Step 1: download diag_ram.bin (diag_ram.bin).
 u-boot$ tftp a1080000 diag_ram.bin
 Step 2: copy diag_ram.bin to flash address 0x40000 on PXA270.
 u-boot$ cp.b a1080000 40000 <size>
 Step 3: reset PXA270 and then you will
see the menu of diag on the LCD.
Lab 2
2014/9/30
Department of Computer Science and Information Engineering
National Taiwan University
28 / 30
 We collect some common commands in Linux and questions in course
website.
 http://rswiki.csie.org/dokuwiki/courses:103_1:csl_common_ins_errors
 If you have any problems, please refer to the document first.
Lab 2
2014/9/30
Department of Computer Science and Information Engineering
National Taiwan University
29 / 30
 Show that you can share some data between Windows and Ubuntu.
 Please hand in your lab report to the FTP.
 Server: 140.112.90.174
 Username: csl2014
 Password: csl2014HomeWork
 Directory: lab2
 Please use this format for filename: “G# Ver#”, where G# is your group id and
Ver# is revision version number.
 E.g., G1 Ver2
Lab 2
2014/9/30
Department of Computer Science and Information Engineering
National Taiwan University
30 / 30