1 / 26

Computer System Laboratory

Computer System Laboratory. Lab8 - Debugging II. Experimental Goal. Learn how to debug Linux in source-level by Domingo and diagnose target boards . Environment. Host System Windows XP Build System VirtualBox + Ubuntu 8.04 Target System Creator XScale PXA270 Software Domingo

elom
Download Presentation

Computer System Laboratory

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Computer System Laboratory Lab8 - Debugging II

  2. Experimental Goal • Learn how to debug Linux in source-level by Domingo and diagnose target boards. / 26

  3. Environment • Host System • Windows XP • Build System • VirtualBox + Ubuntu 8.04 • Target System • Creator XScale PXA270 • Software • Domingo • Linux kernel • Microtimediag program • You can download all software from RSWiki CSL Course Software / 26

  4. 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. reference: wikipedia - debugging, http://en.wikipedia.org/wiki/Debugging / 26

  5. 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). • 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. / 26

  6. 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 (網路芳鄰). reference: wikipedia - samba, http://en.wikipedia.org/wiki/Samba_%28software%29 / 26

  7. 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. • % sudosmbpasswd –a <user name> • You can use the Linux account created in Lab1. Or add a new account <user name> to Linux by useradd before executing smbpasswd. / 26

  8. Install Samba Server (3/4) • Step3: suppose your Linux source codes are in <path of Linux>(slide5) and the shared folder is <share>, you can add a new entry in /etc/samba/smb.conf. [<share>] path = <path of Linux> 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“我的電腦” “內容” “電腦名稱”. / 26

  9. Install Samba Server (4/4) • Step4: restart the samba service. • % sudo /etc/init.d/samba restart / 26

  10. 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 \\<build-system-ip>\ in the file browser. / 26

  11. 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: \\<build-system-ip>\<share> /persistent:yes /user:<user><password> • <build-system-ip> is the IP of Ubuntu8.04. • <share> is the same as in slide8. • <user> and <password> are the same as slide7. / 26

  12. 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 /? / 26

  13. 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 / 26

  14. 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:\ / 26

  15. 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 / 26

  16. Download Linux in Domingo (2/3) • Step3-2: • Additional Modules... = • Set the path of zImage, i.e., <linux directory>\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. / 26

  17. 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. / 26

  18. Troubleshooting • If you can not download the Linux image, you may refer to the following settings (TA’s): • Workgroup = MSHOME • <build-system-ip> = 192.168.0.101 • <path of Linux> = /home/lab202/CSL/10201/lab8/pxa270/ • <share> = 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 / 26

  19. 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. / 26

  20. 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. breakpoints / 26

  21. 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” / 26

  22. Debug Linux Kernel • Please use Domingo to find out why the values of memory clock and system bus clock are zero. ? / 26

  23. 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). • 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$ setenvbootcmd run diag • u-boot$ saveenv • You can change bootcmd back to “run linux” for booting Linux. / 26

  24. 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. LCD 4x4 Keypad / 26

  25. 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). • 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. Memory Layout of the Image / 26

  26. 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 • Please use this title format: [CSL] G# Lab# Ver# • E.g., [CSL] G13 Lab8 Ver1 / 26

More Related