跳到主要內容

臺灣博碩士論文加值系統

(18.97.9.175) 您好!臺灣時間:2024/12/08 10:18
字體大小: 字級放大   字級縮小   預設字形  
回查詢結果 :::

詳目顯示

我願授權國圖
: 
twitterline
研究生:李志遠
研究生(外文):Chih-Yuen Li
論文名稱:Linux核心程式之移植與除錯
論文名稱(外文):On the Porting and Debugging of Linux Kernel
指導教授:江明朝
指導教授(外文):Mi-Choc Chiang
學位類別:碩士
校院名稱:國立中山大學
系所名稱:資訊工程學系研究所
學門:工程學門
學類:電資工程學類
論文種類:學術論文
論文出版年:2006
畢業學年度:94
語文別:英文
論文頁數:85
中文關鍵詞:除錯嵌入式作業系統移植
外文關鍵詞:debugging with ICEembedded linuxaccess register/procporting
相關次數:
  • 被引用被引用:0
  • 點閱點閱:277
  • 評分評分:
  • 下載下載:0
  • 收藏至我的研究室書目清單書目收藏:4
近年來,由於Linux結合了可靠性高,效能佳,有良好的工具,具有
遷移性,組態自由度高等優點,已經有愈來愈多廠商採用Linux做為
電子產品內部的作業系統。然而因為Linux核心程式非常複雜,加上
各種產品可能皆有各自不同的平台。因此Linux常常需要被移植到不
同的平台上。

在本篇論文中,我們詳述如何將Linux 移植到一個類似舊有,但目前
核心沒有支援的新平台。此外,我們提出二種除錯技巧來解決我們在
本篇論文中所遇到的問題。其中一種能讓我們更容易地利用ICE來
追蹤模組;另一種則能讓我們能透過/proc檔案系統來存取處理器的
內部暫存器,而不用每次都為了除錯去寫程式來存取內部暫存器
的資料。

透過這二種除錯技巧,我們能夠有效地降低系統開發
與除錯的時間。
In recent years, more and more vendors adopt Linux to be the embedded operating
system for their electronic products because of its combination of reliability, performance,
good tool chains, portability, and configurability. However, Linux kernel is complex, and
different electronic products may use different platforms. For this reason, it often requires
that Linux be ported to different platforms.

In this thesis, we describe the details of how we port Linux to a new platform which is
similar to but not exactly the same as another platform and thus is not currently supported by
the kernel. Moreover, we propose two robust debugging techniques to solve the problems we
had encountered in this thesis. One is to make it easier to trace a module with ICE; the other is
to allow us to access the internal registers of the processor through the /proc filesystem rather
than write a program every time we need to access those internal registers for the purpose of,
say, debugging.

By using these techniques, we show that the time required to port and debug a Linux
kernel can be definitely reduced.
Contents
Acknowledgments iv
List of Tables iii
List of Figures iv
List of Listings v

Chapter 1 Introduction 1
1.1 Embedded Linux System . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
1.2 Motivations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
1.3 Organization of the Thesis . . . . . . . . . . . . . . . . . . . . . . . . . . . 3

Chapter 2 Platform 4
2.1 Evaluation Board . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
2.2 Linux Kernel . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
2.3 Toolchain . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6

Chapter 3 Porting Linux 8
3.1 Boot . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
3.1.1 head.s . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
3.1.2 Boot Parameters . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
3.2 Machine Registration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
3.3 Serial Console . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
3.4 GPIO . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
3.5 Root Filesystem . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
3.6 Device Driver . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
3.7 Result . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25
3.8 NFS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27
3.8.1 Result . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29

Chapter 4 A Tiny Tool for Simplifying Tracing Modules with ICE 31
4.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31
4.2 Design and Implementation . . . . . . . . . . . . . . . . . . . . . . . . . . . 32
4.2.1 Methodology . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32
4.2.2 The Inline Functions . . . . . . . . . . . . . . . . . . . . . . . . . . 33
4.2.3 Verification . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36

Chapter 5 Controlling Machine State via the /proc Filesystem 38
5.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38
5.2 Design and Implementation . . . . . . . . . . . . . . . . . . . . . . . . . . . 39
5.2.1 The /proc Filesystem . . . . . . . . . . . . . . . . . . . . . . . . . . 39
5.2.2 The ioremap() Function . . . . . . . . . . . . . . . . . . . . . . . . 39
5.2.3 Read/Write on the /proc Filesystem . . . . . . . . . . . . . . . . . . 40
5.2.4 Multi-registers Access . . . . . . . . . . . . . . . . . . . . . . . . . 43
5.2.5 Verification . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49

Chapter 6 Conclusion and Future Works 51

Appendix A Building A Root Filesystem from Scratch 56
Appendix B Complete Source Code for the Tool Described in Chapter 4 62
Appendix C Complete Source Code for the Module Described in Chapter 5 65

List of Tables
A.1 Programs for the target platform . . . . . . . . . . . . . . . . . . . . . . . . 58
A.2 Libraries for the target platform . . . . . . . . . . . . . . . . . . . . . . . . 61

List of Figures
1.1 Embedded Linux architecture . . . . . . . . . . . . . . . . . . . . . . . . . . 2
2.1 Block diagram of Creator . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
2.2 Block diagram of the CPU board . . . . . . . . . . . . . . . . . . . . . . . . 6
3.1 Files modified . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
3.2 Linker will insert head-s3c2410 into the head.o . . . . . . . . . . . . . . . . 11
3.3 PORT-H control registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
3.4 Network filesystem . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27
4.1 Disable interrupt then trace module with ICE . . . . . . . . . . . . . . . . . 32
4.2 Program status register format . . . . . . . . . . . . . . . . . . . . . . . . . 34
4.3 Snapshot of ICE debug mode . . . . . . . . . . . . . . . . . . . . . . . . . . 37
5.1 Diagram of MMU . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39
5.2 IO REG2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42
5.3 Diagram showing our mechanism . . . . . . . . . . . . . . . . . . . . . . . 44
[1] Create ARM920T-S3C2410 User’s Guide (1.2 ed.), Microtime Computer Inc., 2005.
[2] K. Yaghmour, Building Embedded Linux Systems, O’Reilly, 2003.
[3] Microtime Computer Inc., Embedded Linux3ARM9 S3C2410 (PreSOCes)î@®,
Chwa Taiwan Inc., 2005.
[4] Microtime Computer Inc., ARM9 S3C2410¶áPSOC@®, Chwa Taiwan Inc., 2005.
[5] S. Welsh and P. Knaggs, ARM Assembly Language Programming, BSc (Hons) Computing,
2003.
[6] J. Corbet, A. Rubini, and G. Kroah-Hartman, Linux Device Drivers, 3rd ed., O’Reilly,
2005.
[7] Danel P. Bovet and Marco Cesati, Understanding the Linux Kernel, O’Reilly, 2001.
[8] Andrew Morton, Linux Kernel Development, Novell, 2005.
[9] Brain W. Kernighan and Dennis M. Ritchie, The C programming Language, Prentice
Hall, 1988.
[10] Wookey and Tak-Shing, Porting the Linux Kernel to a New ARM Platform,
http://www.aleph1.co.uk, 2002.
[11] F. Vahid and T. Givargis, Embedded System Design: A Unified Hardware/Software Introduction,
New York, Wiley, 2002.
[12] Janos Sztipanovits, Gautam Biswas, Ken Frampton, Aniruddha Gokhale, Larry Howard,
Gabor Karsai, T. John Koo, Xenofon Koutsoukos, and Douglas C. Schmidt, Introducing
Embedded Software and Systems Education and Advanced Learning Technology
in an Engineering Curriculum, ACM Transactions on Embedded Computing Systems
(TECS), ACM, 2005.
[13] Norman Ramsey, Embedding an Interpreted Language Using Higher-order Functions
and Types, Proceedings of the 2003 workshop on Interpreters, virtual machines and
emulators, ACM, 2003.
[14] Ann Gordon-Ross, Susan Cotterell, and Frank Vahid, Tiny Instruction Caches for
Low Power Embedded Systems, ACM Transactions on Embedded Computing Systems
(TECS), ACM, 2003.
[15] Brain Ward, The Book of Vmware, No Starch Press, 2003.
[16] Ashfaq A. Khan, Practical Linux Programming: Device Drivers, Embedded systems,
and the Internet, Delmar Thomson Learning, 2002.
[17] Michael Beck, Harald Bohme, Mirko Dziadzka, Ulrich Kunitz, Robert Magnus, Dirk
Verworner, and Claus Schroter, Linux Kernel Programming, 3rd ed., Addison-Wesley
Professional, 2002.
[18] Ori Pomerantz, Linux Kernel Module Programming Guide, Iuniverse Inc., 2000.
[19] Wrox, Professional Linux Kernel Programming, Wrox Press Ltd., 2002.
[20] M. Tim Jones, GNU/Linux Application Programming (Programming Series), Charles
River Media, 2005.
[21] Richard Stones, Neil Matthew, and Alan Cox, Beginning Linux Programming, Wrox,
2000.
[22] Christopher Negus and Thomas Weeks, Linux Troubleshooting Bible, John Wiley &
Sons, 2004.
[23] Sivarama P. Dandamudi, Guide to Assembly Language Programming in Linux, Springer,
2005.
[24] Doug Abbott, Linux for Embedded and Real-Time Applications, Newnes, 2002.
[25] Tammy Noergaard, Embedded Systems Architecture: A Comprehensive Guide for Engineers
and Programmers, Newnes, 2005.
QRCODE
 
 
 
 
 
                                                                                                                                                                                                                                                                                                                                                                                                               
第一頁 上一頁 下一頁 最後一頁 top