Presentation is loading. Please wait.

Presentation is loading. Please wait.

COMPUTER SYSTEM LABORATORY Lab8 - Debugging II. Lab 8 Experimental Goal Learn how to debug Linux in source-level by Domingo and diagnose target boards.

Similar presentations


Presentation on theme: "COMPUTER SYSTEM LABORATORY Lab8 - Debugging II. Lab 8 Experimental Goal Learn how to debug Linux in source-level by Domingo and diagnose target boards."— Presentation transcript:

1 COMPUTER SYSTEM LABORATORY Lab8 - Debugging II

2 Lab 8 Experimental Goal Learn how to debug Linux in source-level by Domingo and diagnose target boards. 2013/11/5/ 262

3 Lab 8 Environment Host System Windows XP Build System VirtualBox + Ubuntu 8.04 Target System Creator XScale PXA270 Software Domingo Linux kernel Microtime diag program You can download all software from RSWiki CSL Course SoftwareRSWiki CSL Course Software 2013/11/5/ 263

4 Lab 8 Introduction to Debugging Debugging is a methodical process of finding and reducing the number of bugs, or defects, in a computer program or a piece of electronic hardware, thus making it behave as expected. In Lab1 and Lab2, we introduce Domingo, which is an integrated development environment developed by Microtime Computer Inc. Domingo can be used to not only transfer binaries to RAM but also debug in source-level. In this lab, we will introduce how to debug Linux kernel in source-level. 2013/11/5/ 264 reference: wikipedia - debugging, http://en.wikipedia.org/wiki/Debugginghttp://en.wikipedia.org/wiki/Debugging

5 Lab 8 Prepare Linux Kernel and Source Codes We prepare a Linux kernel with some bugs for this Lab. Step1: download Linux source codes (linux-2.6.15.3.lab8.tar.gz).linux-2.6.15.3.lab8.tar.gz Step2: please refer to Lab5 to configure creator_pxa270_partitions[] for your filesystem. Step3: compile the new Linux kernel. Step4: convert to U-Boot bootable image. You can set image name in mkimage to identify different kernel images. Step5: copy to PXA270. 2013/11/5/ 265

6 Lab 8 Install Samba Server (1/4) Before using Domingo, you should make sure that you can access your Linux source codes in Windows. However, we can not directly extract Linux source codes in Windows because there are many symbolic links in the source codes. To preserved these links, the source codes are usually extracted in Linux, e.g., in build system, Ubuntu8.04. Therefore, to access Linux source codes in Windows, we need to set up a samba server in the build system. 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 ( 網路芳鄰 ). 2013/11/5/ 266 reference: wikipedia - samba, http://en.wikipedia.org/wiki/Samba_%28software%29http://en.wikipedia.org/wiki/Samba_%28software%29

7 Lab 8 Install Samba Server (2/4) Step1: install samba server in the build system. % sudo apt-get install samba Step2: add an user account for samba service. % sudo smbpasswd –a You can use the Linux account created in Lab1. Or add a new account to Linux by useradd before executing smbpasswd. 2013/11/5/ 267

8 Lab 8 Install Samba Server (3/4) Step3: suppose your Linux source codes are in (slide5) and the shared folder is, you can add a new entry in /etc/samba/smb.conf.slide5 [ ] path = browseable = yes read only = no create mask = 0664 directory mask = 0755 security = share 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 “ 我的電腦 ”  “ 內容 ”  “ 電腦名稱 ”. 2013/11/5/ 268

9 Lab 8 Install Samba Server (4/4) Step4: restart the samba service. % sudo /etc/init.d/samba restart 2013/11/5/ 269

10 Lab 8 Map Network Drive in Windows (1/3) Step1: refer to Lab7 to set up LAN IP address for Windows XP and Ubuntu8.04. Step2: check whether you can see Ubuntu in “ 網路芳鄰 ” or not. “ 我的電腦 ”  “ 網路上的芳鄰 ”  “ 檢視工作群組電腦 ” Or type \\ \ in the file browser. 2013/11/5/ 2610

11 Lab 8 Map Network Drive in Windows (2/3) If you can not see the shared folder, you can: Check network configuration in Ubuntu and VirtualBox. (Refer to Lab7) Check firewall in Windows XP. Restart virtual machine and PC. Step3: open command line in Windows XP. “ 開始 ”  “ 執行...” Type cmd and execute. Step4: map the directory to S: drive. % net use s: \\ \ /persistent:yes /user: is the IP of Ubuntu8.04. is the same as in slide8.slide8 and are the same as slide7.slide7 2013/11/5/ 2611

12 Lab 8 Map Network Drive in Windows (3/3) You can check the drive status by: % net use Or delete the drive by: % net use s: /DELETE Or read the usage of net use command by: % net use /? 2013/11/5/ 2612

13 Lab 8 Domingo Configuration (1/2) Step1: create a new project for PXA270. Step2: configure “OS support”. “Config”  “OS support”  “Linux 2.6” Step3: configure Linux path. “Linux 2.6”  “Linux Path Setting...” Linux Debug Information (vmlinux) = the path of vmlinux Linux dist Path = the path of linux directory Device Driver Path = the path of device drivers 2013/11/5/ 2613

14 Lab 8 Domingo Configuration (2/2) Step4: since the path of Linux source codes in Ubuntu is different from Windows XP, we need to configure “ELF path substitution” to replace the path. “Debug”  “Default ELF Path Substitution...” Path Prefix = your path of kernel compilation Replace As = S:\ 2013/11/5/ 2614

15 Lab 8 Download Linux in Domingo (1/3) Step1: connect to your PXA270 in Domingo. Step2: load debug module. “Debug”  “Load Module...” Choose vmlinux. Step3-1: configure the module. ModuleFormat = Elf for ARM Options = ELF path substitution Download Raw Data = unchecked Goto Main Address = 0xa0008000;start_kernel Linux - Dynamic Loaded Module = checked 2013/11/5/ 2615

16 Lab 8 Download Linux in Domingo (2/3) Step3-2: Additional Modules... = Set the path of zImage, i.e., \arch\arm\boot\zImage. Set the start address to P;a0008000. Step4: execute “UART View” or putty to access the console of PXA270. Step5: click “Ok” to start downloading Linux. 2013/11/5/ 2616

17 Lab 8 Download Linux in Domingo (3/3) After downloading is complete, you will see the Linux is stopped at start_kernel() function. Now, you can start debugging the Linux kernel. 2013/11/5/ 2617

18 Lab 8 Troubleshooting If you can not download the Linux image, you may refer to the following settings (TA’s): Workgroup = MSHOME = 192.168.0.101 = /home/lab202/CSL/10201/lab8/pxa270/ = Creator Path of linux directory = /home/lab202/CSL/10201/lab8/pxa270/linux Path of vmlinux = /home/lab202/CSL/10201/lab8/pxa270/linux/vmlinux Path of Linux device drivers = /home/lab202/CSL/10201/lab8/pxa270/linux/drivers 2013/11/5/ 2618

19 Lab 8 Debug Linux in Domingo (1/3) You can select specific functions on the menu bar for debugging. M: images. F: source files in the specific image M. L: functions in the specific source file F. 2013/11/5/ 2619

20 Lab 8 Debug Linux in Domingo (2/3) You can set breakpoints by clicking the line number. Breakpoints can be cancelled by clicking again. After setting breakpoints, you can continue the program by following operations. 2013/11/5/ 2620 breakpoints

21 Lab 8 Debug Linux in Domingo (3/3) You can see register values in register window. You also can watch variables in watch list. Please refer to Domingo tutorial for more information. “View”  “Tutorial” 2013/11/5/ 2621

22 Lab 8 Debug Linux Kernel Please use Domingo to find out why the values of memory clock and system bus clock are zero. 2013/11/5/ 2622 ?

23 Lab 8 Diagnose Target Boards (1/2) 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. Step1: download diag (diag_ram.bin).diag_ram.bin Step2: copy diag_ram.bin to flash address 0x40000 on PXA270. The erased end address is 0x7ffff (2 sectors). Please refer to Lab5 to configure creator_pxa270_partitions[] for diag. Step3: modify bootcmd environment variable in U-Boot. u-boot$ setenv bootcmd run diag u-boot$ saveenv You can change bootcmd back to “ run linux ” for booting Linux. 2013/11/5/ 2623

24 Lab 8 Diagnose Target Boards (2/2) Step4: reset PXA270 and then you will see the menu of diag on the LCD. You can select the menu item by pressing keys on the 4x4 keypad. You can check LEDs, LCD, keypads, and CMOS for coming Labs. 2013/11/5/ 2624 LCD 4x4 Keypad

25 Lab 8 Diagnose Target Boards (Optional) Furthermore, Microtime provides a whole image which includes bootloader, diag, Linux kernel, and root filesystem. It also can help developers to restore factory default. Step1: download the image (som-pxa270-u4-v2.0.bin).som-pxa270-u4-v2.0.bin Step2: copy som-pxa270-u4-v2.0.bin to flash address 0x0 on PXA270. The erased end address is 0x167ffff (183 sectors). It will take about 18 minutes. U-Boot will execute diag in default setting. 2013/11/5/ 2625 Memory Layout of the Image

26 Lab 8 Lab Requirement & Bonus Show how you find and correct the bug of Linux kernel we gave. Bonus: There is no Bonus here. Please send your report to both TAs. csiedatou@gmail.com, meenchen79@gmail.com csiedatou@gmail.commeenchen79@gmail.com Please use this title format: [CSL] G# Lab# Ver# E.g., [CSL] G13 Lab8 Ver1 2013/11/5/ 2626


Download ppt "COMPUTER SYSTEM LABORATORY Lab8 - Debugging II. Lab 8 Experimental Goal Learn how to debug Linux in source-level by Domingo and diagnose target boards."

Similar presentations


Ads by Google