Christopher Hallinan - Embedded Linux Primer - A Practical, Real-World Approach

Здесь есть возможность читать онлайн «Christopher Hallinan - Embedded Linux Primer - A Practical, Real-World Approach» весь текст электронной книги совершенно бесплатно (целиком полную версию без сокращений). В некоторых случаях можно слушать аудио, скачать через торрент в формате fb2 и присутствует краткое содержание. Год выпуска: 2006, ISBN: 2006, Издательство: Prentice Hall, Жанр: ОС и Сети, на английском языке. Описание произведения, (предисловие) а так же отзывы посетителей доступны на портале библиотеки ЛибКат.

Embedded Linux Primer: A Practical, Real-World Approach: краткое содержание, описание и аннотация

Предлагаем к чтению аннотацию, описание, краткое содержание или предисловие (зависит от того, что написал сам автор книги «Embedded Linux Primer: A Practical, Real-World Approach»). Если вы не нашли необходимую информацию о книге — напишите в комментариях, мы постараемся отыскать её.

Comprehensive Real-World Guidance for Every Embedded Developer and Engineer
This book brings together indispensable knowledge for building efficient, high-value, Linux-based embedded products: information that has never been assembled in one place before. Drawing on years of experience as an embedded Linux consultant and field application engineer, Christopher Hallinan offers solutions for the specific technical issues you're most likely to face, demonstrates how to build an effective embedded Linux environment, and shows how to use it as productively as possible.
Hallinan begins by touring a typical Linux-based embedded system, introducing key concepts and components, and calling attention to differences between Linux and traditional embedded environments. Writing from the embedded developer's viewpoint, he thoroughly addresses issues ranging from kernel building and initialization to bootloaders, device drivers to file systems.
Hallinan thoroughly covers the increasingly popular BusyBox utilities; presents a step-by-step walkthrough of porting Linux to custom boards; and introduces real-time configuration via CONFIG_RT--one of today's most exciting developments in embedded Linux. You'll find especially detailed coverage of using development tools to analyze and debug embedded systems--including the art of kernel debugging.
• Compare leading embedded Linux processors
• Understand the details of the Linux kernel initialization process
• Learn about the special role of bootloaders in embedded Linux systems, with specific emphasis on U-Boot
• Use embedded Linux file systems, including JFFS2--with detailed guidelines for building Flash-resident file system images
• Understand the Memory Technology Devices subsystem for flash (and other) memory devices
• Master gdb, KGDB, and hardware JTAG debugging
• Learn many tips and techniques for debugging within the Linux kernel
• Maximize your productivity in cross-development environments
• Prepare your entire development environment, including TFTP, DHCP, and NFS target servers
• Configure, build, and initialize BusyBox to support your unique requirements

Embedded Linux Primer: A Practical, Real-World Approach — читать онлайн бесплатно полную книгу (весь текст) целиком

Ниже представлен текст книги, разбитый по страницам. Система сохранения места последней прочитанной страницы, позволяет с удобством читать онлайн бесплатно книгу «Embedded Linux Primer: A Practical, Real-World Approach», без необходимости каждый раз заново искать на чём Вы остановились. Поставьте закладку, и сможете в любой момент перейти на страницу, на которой закончили чтение.

Тёмная тема
Сбросить

Интервал:

Закладка:

Сделать

If the input argument is a numeric PID, the list is traversed to find the matching task_struct. Lines 12 and 13 initialize the loop variables (gdb does not have a for statement in its macro command language), and lines 15 through 17 define the search loop. The find_next_task macro is used to extract the pointer to the next task_struct in the linked list. Finally, if the search fails, a sane return value is set (the address of init_task) so that it can be safely used in other macros.

Building on the find_task macro in Listing 14-11, we can easily create a simple ps command that displays useful information about each process running on the system.

Listing 14-12 defines a gdb macro that displays interesting information from a running process, extracted from the struct task_struct for the given process. It is invoked like any other gdb command, by typing its name followed by any required input parameters. Notice that this user-defined command requires a single argument, either a PID or the address of a task_struct.

Listing 14-12. gdb Macro: Print Process Information

1 define ps

2 # Print column headers

3 task_struct_header

4 set $t=&init_task

5 task_struct_show $t

6 find_next_task $t

7 # Walk the list

8 while &init_task!=$t

9 # Display useful info about each task

10 task_struct_show $t

11 find_next_task $t

12 end

13 end

14

15 document ps

16 Print points of interest for all tasks

17 end

This ps macro is similar to the find_task macro, except that it requires no input arguments and it adds a macro (task_struct_show) to display the useful information from each task_struct. Line 3 prints a banner line with column headings. Lines 4 through 6 set up the loop and display the first task. Lines 8 through 11 loop through each task, calling the task_struct_show macro for each.

Notice also the inclusion of the gdb document command. This allows the gdb user to get help by issuing the help ps command from the gdb command prompt as follows:

(gdb) help ps

Print points of interest for all tasks

Listing 14-13 displays the output of this macro on a target board running only minimal services.

Listing 14-13. gdb ps Macro Output

(gdb) ps

Address PID State User_NIP Kernel-SP device comm

0xC01D3750 0 Running 0xC0205E90 (none) swapper

0xC04ACB10 1 Sleeping 0x0FF6E85C 0xC04FFCE0 (none) init

0xC04AC770 2 Sleeping 0xC0501E90 (none) ksoftirqd/0

0xC04AC3D0 3 Sleeping 0xC0531E30 (none) events/0

0xC04AC030 4 Sleeping 0xC0533E30 (none) khelper

0xC04CDB30 5 Sleeping 0xC0535E30 (none) kthread

0xC04CD790 23 Sleeping 0xC06FBE30 (none) kblockd/0

0xC04CD3F0 45 Sleeping 0xC06FDE50 (none) pdflush

0xC04CD050 46 Sleeping 0xC06FFE50 (none) pdflush

0xC054B7B0 48 Sleeping 0xC0703E30 (none) aio/0

0xC054BB50 47 Sleeping 0xC0701E20 (none) kswapd0

0xC054B410 629 Sleeping 0xC0781E60 (none) kseriod

0xC054B070 663 Sleeping 0xCFC59E30 (none) rpciod/0

0xCFFDE0D0 675 Sleeping 0x0FF6E85C 0xCF86DCE0 (none) udevd

0xCF95B110 879 Sleeping 0x0FF0BE58 0xCF517D80 (none) portmap

0xCFC24090 910 Sleeping 0x0FF6E85C 0xCF61BCE0 (none) syslogd

0xCF804490 918 Sleeping 0x0FF66C7C 0xCF65DD70 (none) klogd

0xCFE350B0 948 Sleeping 0x0FF0E85C 0xCF67DCE0 (none) rpc.statd

0xCFFDE810 960 Sleeping 0x0FF6E85C 0xCF5C7CE0 (none) inetd

0xCFC24B70 964 Sleeping 0x0FEEBEAC 0xCF64FD80 (none) mvltd

0xCFE35B90 973 Sleeping 0x0FF66C7C 0xCFEF7CE0 ttyS1 getty

0xCFE357F0 974 Sleeping 0x0FF4B85C 0xCF6EBCE0 (none) in.telnetd

0xCFFDE470 979 Sleeping 0x0FEB6950 0xCF675DB0 ttyp0 bash

0xCFFDEBB0 982

(gdb)

The bulk of the work done by this ps macro is performed by the task_struct_show macro. As shown in Listing 14-13, the task_struct_show macro displays the following fields from each task_struct :

• Address Address of the task_struct for the process

• PID Process ID

• State Current state of the process

• User_NIP Userspace Next Instruction Pointer

• Kernel_SP Kernel Stack Pointer

• device Device associated with this process

• comm Name of the process (or command)

It is relatively easy to modify the macro to show the items of interest for your particular kernel debugging task. The only complexity is in the simplicity of the macro language. Because function equivalents such as strlen do not exist in gdb 's user-defined command language, screen formatting must be done by hand.

Listing 14-14 reproduces the task_struct_show macro that produced the previous listing.

Listing 14-14. gdb task_struct_show Macro

1 define task_struct_show

2 # task_struct addr and PID

3 printf "0x%08X %5d", $arg0, $arg0->pid

4

5 # Place a '<' marker on the current task

6 # if ($arg0 == current)

7 # For PowerPC, register r2 points to the "current" task

8 if ($arg0 == $r2)

9 printf "<"

10 else

11 printf " "

12 end

13

14 # State

15 if ($arg0->state == 0)

16 printf "Running "

17 else

18 if ($arg0->state == 1)

19 printf "Sleeping "

20 else

21 if ($arg0->state == 2)

22 printf "Disksleep "

23 else

24 if ($arg0->state == 4)

25 printf "Zombie "

26 else

27 if ($arg0->state == 8)

28 printf "sTopped "

29 else

30 if ($arg0->state == 16)

31 printf "Wpaging "

32 else

33 printf "%2d ", $arg0->state

34 end

35 end

36 end

37 end

38 end

39 end

40

41 # User NIP

42 if ($arg0->thread.regs)

43 printf "0x%08X ", $arg0->thread.regs->nip

44 else

45 printf " "

46 end

47

48 # Display the kernel stack pointer

49 printf "0x%08X ", $arg0->thread.ksp

50

51 # device

52 if ($arg0->signal->tty)

53 printf "%s ", $arg0->signal->tty->name

54 else

55 printf "(none) "

56 end

57

58 # comm

59 printf "%s\n", $arg0->comm

60 end

Line 3 displays the address of the task_struct. Lines 8 through 12 display the process ID. If this is the current process (the process that was currently running on this CPU at the time the breakpoint was hit), it is marked with a < character.

Читать дальше
Тёмная тема
Сбросить

Интервал:

Закладка:

Сделать

Похожие книги на «Embedded Linux Primer: A Practical, Real-World Approach»

Представляем Вашему вниманию похожие книги на «Embedded Linux Primer: A Practical, Real-World Approach» списком для выбора. Мы отобрали схожую по названию и смыслу литературу в надежде предоставить читателям больше вариантов отыскать новые, интересные, ещё непрочитанные произведения.


Отзывы о книге «Embedded Linux Primer: A Practical, Real-World Approach»

Обсуждение, отзывы о книге «Embedded Linux Primer: A Practical, Real-World Approach» и просто собственные мнения читателей. Оставьте ваши комментарии, напишите, что Вы думаете о произведении, его смысле или главных героях. Укажите что конкретно понравилось, а что нет, и почему Вы так считаете.

x