在查找資料過程中,發現自己搭建虛擬的arm環境的話,有一個比較好的軟件就是qemu了,當然還有其他的,大家各投所好就好。
接下來說一下qemu環境搭建過程。
其實搭建很簡單,作為小白,我還是搗鼓了兩三天才真正的安裝成功,正在嘗試着怎么使用。
上篇已經講了安裝Ubuntu系統后root密碼的設置,這里就要用到root密碼進行軟件安裝了。
可以在命令行模式下先進行update,輸入:sudo apt-get update
在保證電腦聯網的情況下,Ubuntu會自動進行文件更新,這個操作並不會更新整個文件系統,
他只是同步le /etc/apt/sources.list 和 /etc/apt/sources.list.d 中列出的源的索引,這樣才能獲取到最新的軟件包。
並且只有在更新了資源列表后才能使用apt-get install進行成功安裝(我當時就是沒有update就去安裝程序,失敗了好多次,各種欲哭無淚,
另:一定要保證自己的網絡環境良好,更新的文件都不大但是我想你不會想看着電腦以100B的速度去下載6000K+的文件的555555)
在update完成之后就可以進行qemu的安裝了,輸入指令:sudo apt-get install qemu(如果失敗並提示你需要嘗試修復什么文件的話用sudo apt-get -f install qemu代替)
在連着輸入兩個表示同意的‘y’之后等着系統自己安裝就好了。
安裝完畢,輸入qemu並聯系按幾下table,就會顯示當前qemu支持的架構(還是內核?不是很清楚這個概念)
qemu安裝到此結束。
========================================和上方震驚體標題后腦殘的內容划清界限,下面搭建Vexpress的qemu環境==========================================================================
1. 安裝qemu,參考上方腦殘內容,安裝完畢后查看qemu版本可出現如下內容表示安裝成功
sly@ubuntu:~/develop$ qemu-arm --version qemu-arm version 2.11.1(Debian 1:2.11+dfsg-1ubuntu7.19) Copyright (c) 2003-2017 Fabrice Bellard and the QEMU Project developers
PS: 交叉編譯工具鏈也需要安裝 sudo apt-get install gcc-arm-linux-gnueabi
2. 編譯Linux內核
sly@ubuntu:~/develop/linux-5.3.7$ make CROSS_COMPILE=arm-linux-gnueabi- ARCH=arm vexpress_defconfig
#
# configuration written to .config
#
修改Makfile如下兩個變量值
ARCH ?= arm
CROSS_COMPILE ?= arm-linux-gnueabi-
編譯:
sly@ubuntu:~/develop/linux-5.3.7$ make
sly@ubuntu:~/develop/linux-5.3.7$ make modules
sly@ubuntu:~/develop/linux-5.3.7$ make dtbs
生成的內核鐿像位於arch/arm/boot/zImage, qemu啟動時須要使用該鏡像。
sly@ubuntu:~/develop/linux-5.3.7$ make scripts/kconfig/conf --syncconfig Kconfig CALL scripts/checksyscalls.sh CALL scripts/atomic/check-atomics.sh CHK include/generated/compile.h GZIP kernel/config_data.gz CC kernel/configs.o AR kernel/built-in.a GEN .version CHK include/generated/compile.h UPD include/generated/compile.h CC init/version.o AR init/built-in.a LD vmlinux.o MODPOST vmlinux.o MODINFO modules.builtin.modinfo- KSYM .tmp_kallsyms1.o KSYM .tmp_kallsyms2.o LD vmlinux SORTEX vmlinux SYSMAP System.map OBJCOPY arch/arm/boot/Image Kernel: arch/arm/boot/Image is ready GZIP arch/arm/boot/compressed/piggy_data AS arch/arm/boot/compressed/piggy.o LD arch/arm/boot/compressed/vmlinux OBJCOPY arch/arm/boot/zImage Kernel: arch/arm/boot/zImage is ready Building modules, stage 2. MODPOST 1 modules
3. 測試qemu和內核是否能執行成功
qemu已經安裝好了。內核也編譯成功了,到這里最好是測試一下,編譯出來的內核是否OK,或者qemu對vexpress單板支持是否夠友好。
執行命令:qemu-system-arm -M vexpress-a9 -m 512m -kernel /home/sly/develop/linux-5.3.7/arch/arm/boot/zImage -dtb linux-5.3.7/arch/arm/boot/dts/vexpress-v2p-ca9.dtb -nographic -append "console=ttyAMA0"
sly@ubuntu:~/develop$ qemu-system-arm -M vexpress-a9 -m 512m -kernel /home/sly/develop/linux-5.3.7/arch/arm/boot/zImage -dtb linux-5.3.7/arch/arm/boot/dts/vexpress-v2p-ca9.dtb -nographic -append "console=ttyAMA0"
pulseaudio: set_sink_input_volume() failed
pulseaudio: Reason: Invalid argument
pulseaudio: set_sink_input_mute() failed
pulseaudio: Reason: Invalid argument
Booting Linux on physical CPU 0x0
Linux version 5.3.7 (sly@ubuntu) (gcc version 7.4.0 (Ubuntu/Linaro 7.4.0-1ubuntu1~18.04.1)) #4 SMP Mon Dec 9 08:31:07 PST 2019
--省略甚多log----------
Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(0,0)
CPU: 0 PID: 1 Comm: swapper/0 Not tainted 5.3.7 #4
Hardware name: ARM-Versatile Express
[<80110808>] (unwind_backtrace) from [<8010c680>] (show_stack+0x10/0x14)
[<8010c680>] (show_stack) from [<8074c7cc>] (dump_stack+0x88/0x9c)
[<8074c7cc>] (dump_stack) from [<80120e64>] (panic+0x110/0x310)
[<80120e64>] (panic) from [<80a01640>] (mount_block_root+0x1e8/0x2d4)
[<80a01640>] (mount_block_root) from [<80a01870>] (mount_root+0x144/0x160)
[<80a01870>] (mount_root) from [<80a019dc>] (prepare_namespace+0x150/0x198)
[<80a019dc>] (prepare_namespace) from [<80763874>] (kernel_init+0x8/0x114)
[<80763874>] (kernel_init) from [<801010e8>] (ret_from_fork+0x14/0x2c)
Exception stack(0x9e4a1fb0 to 0x9e4a1ff8)
1fa0: 00000000 00000000 00000000 00000000
1fc0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
1fe0: 00000000 00000000 00000000 00000000 00000013 00000000
---[ end Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(0,0) ]---
假設看到內核啟動過程中的打印,說明前的搭建是成功的。
這里簡介下qemu命令的參數:
-M vexpress-a9 模擬vexpress-a9單板,你能夠使用-M ?參數來獲取該qemu版本號支持的全部單板 -m 512M 單板執行物理內存512M -kernel /home/ivan/kernel_git/linux/arch/arm/boot/zImage 告訴qemu單板執行內核鏡像路徑 -nographic 不使用圖形化界面,僅僅使用串口 -append "console=ttyAMA0" 內核啟動參數。這里告訴內核vexpress單板執行。串口設備是哪個tty。從生成的.config文件CONFIG_CONSOLE宏找到
4. 利用busybox構建最小文件系統(下載地址:https://busybox.net/)
不加載文件系統窮的那個qemu會產生上面貼的log中的panic信息,下面先制作一個可用的最小文件系統。
a. 編譯busybox
a1. 下載源文件后進行配置
sly@ubuntu:~/develop$ cd busybox-1.24.2/ sly@ubuntu:~/develop/busybox-1.24.2$ export ARCH=arm sly@ubuntu:~/develop/busybox-1.24.2$ export CROSS_COMPILE=arm-linux-gnueabi- sly@ubuntu:~/develop/busybox-1.24.2$ make menuconfig
a2.menuconfig配置成靜態
Busybox Settings --->
Build Options --->
[*] Build BusyBox as a static binary (no shared libs)
a3. 開始編譯, 編譯完成后會在busybox目錄下生成一個_install的目錄,該目錄是編譯好的文件系統需要使用的一些命令集合。
sly@ubuntu:~/develop/busybox-1.24.2$ make defconfig
sly@ubuntu:~/develop/busybox-1.24.2$ make CROSS_COMPILE=arm-linux-gnueabi-
sly@ubuntu:~/develop/busybox-1.24.2$ make install CROSS_COMPILE=arm-linux-gnueabi-
生成的_install目錄包含如下內容
sly@ubuntu:~/develop/busybox-1.24.2/_install$ ll total 20 drwxrwxr-x 5 sly sly 4096 Dec 9 08:14 ./ drwxr-xr-x 36 sly sly 4096 Dec 9 21:08 ../ drwxrwxr-x 2 sly sly 4096 Dec 9 08:14 bin/ lrwxrwxrwx 1 sly sly 11 Dec 9 08:14 linuxrc -> bin/busybox* drwxrwxr-x 2 sly sly 4096 Dec 9 08:14 sbin/ drwxrwxr-x 4 sly sly 4096 Oct 30 22:18 usr/
b. 制作根文件系統
b1. 新建一個根文件系統的文件夾
sly@ubuntu:~/develop$ mkdir rootfs
sly@ubuntu:~/develop$ cd rootfs/
b2. 拷貝install目錄的命令集到文件夾中
sly@ubuntu:~/develop/rootfs$ cp -rf ../busybox-1.24.2/_install/* . sly@ubuntu:~/develop/rootfs$ ls bin dev lib linuxrc sbin usr
b3. 新建lib目錄,從工具鏈中拷貝執行庫到lib文件夾下
sly@ubuntu:~/develop/rootfs$ mkdir lib
sly@ubuntu:~/develop/rootfs$ cp -p /usr/arm-linux-gnueabi/lib/* ./lib
b4. 創建設備文件, 創建4個串口設備,和控制台
sly@ubuntu:~/develop/rootfs$ sudo mknod dev/tty1 c 4 1 sly@ubuntu:~/develop/rootfs$ sudo mknod dev/tty2 c 4 2 sly@ubuntu:~/develop/rootfs$ sudo mknod dev/tty3 c 4 3 sly@ubuntu:~/develop/rootfs$ sudo mknod dev/tty4 c 4 4 sly@ubuntu:~/develop/rootfs$sudo mknod -m 666 console c 5 1
b5. 制作SD根文件系統鏡像, 生成虛擬sd卡並格式化為ext格式:
dd if=/dev/zero of=rootfs.ext3 bs=1M count=32
mkfs.ext3 rootfs.ext3
sly@ubuntu:~/develop$ dd if=/dev/zero of=rootfs.ext3 bs=1M count=32 32+0 records in 32+0 records out 33554432 bytes (34 MB, 32 MiB) copied, 0.0941612 s, 356 MB/s sly@ubuntu:~/develop$ mkfs.ext3 rootfs.ext3 mke2fs 1.44.1 (24-Mar-2018) Discarding device blocks: done Creating filesystem with 32768 1k blocks and 8192 inodes Filesystem UUID: fe2c8081-588f-4e0c-b0c7-09489d0fded5 Superblock backups stored on blocks: 8193, 24577 Allocating group tables: done Writing inode tables: done Creating journal (4096 blocks): done Writing superblocks and filesystem accounting information: done
sly@ubuntu:~/develop$ ls
busybox-1.24.2 linux-5.3.7 linux-5.3.7.tar rootfs rootfs.ext3 tmpfs
b6. 將虛擬sd卡掛載到/tmpfs,拷貝rootfs的所有文件到sd,卸載sd(塊設備不能直接讀寫)
sudo mkdir tmpfs
sudo mount -t ext3 rootfs.ext3 tmpfs/ -o loop
sudo cp -r rootfs/* tmpfs/
sudo umount tmpfs
sly@ubuntu:~/develop$ sudo mount -t ext3 rootfs.ext3 tmpfs/ -o loop
sly@ubuntu:~/develop$ sudo cp -r rootfs/* tmpfs/
sly@ubuntu:~/develop$ ls tmpfs/
bin dev lib linuxrc lost+found sbin usr
sly@ubuntu:~/develop$ sudo umount tmpfs
sly@ubuntu:~/develop$ ls tmpfs/
sly@ubuntu:~/develop$
5. 啟動內核,掛載rootfs
qemu-system-arm -M vexpress-a9 -m 512m -kernel /home/sly/develop/linux-5.3.7/arch/arm/boot/zImage -dtb linux-5.3.7/arch/arm/boot/dts/vexpress-v2p-ca9.dtb -nographic -append "root=/dev/mmcblk0 console=ttyAMA0" -sd rootfs.ext3
sly@ubuntu:~/develop$ qemu-system-arm -M vexpress-a9 -m 512m -kernel /home/sly/develop/linux-5.3.7/arch/arm/boot/zImage -dtb linux-5.3.7/arch/arm/boot/dts/vexpress-v2p-ca9.dtb -nographic -append "root=/dev/mmcblk0 console=ttyAMA0" -sd rootfs.ext3 WARNING: Image format was not specified for 'rootfs.ext3' and probing guessed raw. Automatically detecting the format is dangerous for raw images, write operations on block 0 will be restricted. Specify the 'raw' format explicitly to remove the restrictions. pulseaudio: set_sink_input_volume() failed pulseaudio: Reason: Invalid argument pulseaudio: set_sink_input_mute() failed pulseaudio: Reason: Invalid argument Booting Linux on physical CPU 0x0 Linux version 5.3.7 (sly@ubuntu) (gcc version 7.4.0 (Ubuntu/Linaro 7.4.0-1ubuntu1~18.04.1)) #4 SMP Mon Dec 9 08:31:07 PST 2019=====================================================......========================================================================= ALSA device list: #0: ARM AC'97 Interface PL041 rev0 at 0x10004000, irq 24 input: ImExPS/2 Generic Explorer Mouse as /devices/platform/smb@4000000/smb@4000000:motherboard/smb@4000000:motherboard:iofpga@7,00000000/10007000.kmi/serio1/input/input2 Error: Driver 'vexpress-muxfpga' is already registered, aborting... drm-clcd-pl111 10020000.clcd: initializing Versatile Express PL111 drm-clcd-pl111 10020000.clcd: DVI muxed to daughterboard 1 (core tile) CLCD EXT4-fs (mmcblk0): mounting ext3 file system using the ext4 subsystem random: fast init done EXT4-fs (mmcblk0): mounted filesystem with ordered data mode. Opts: (null) VFS: Mounted root (ext3 filesystem) readonly on device 179:0. Freeing unused kernel memory: 1024K Run /sbin/init as init process random: crng init done can't run '/etc/init.d/rcS': No such file or directory Please press Enter to activate this console. / #
/ # ls
bin dev lib linuxrc lost+found sbin usr
6. 編寫簡單的模塊進行加載
文件目錄結構如下
sly@ubuntu:~/develop/module/first$ ls
first.c Makefile
編寫源文件
#include <linux/module.h> #include <linux/kernel.h> int init_hello_module(void) { printk("init hello_moudle\n"); return 0; } void exit_hello_module(void) { printk("exit hello_module\n"); } module_init(init_hello_module); module_exit(exit_hello_module); MODULE_LICENSE("GPL");
makefile文件
KERN_DIR=../../linux-5.3.7 all: make -C $(KERN_DIR) M=`pwd` modules clean: make -C $(KERN_DIR) M=`pwd` modules clean rm -rf modules.order obj-m += first.o
執行編譯,編譯出ko文件
sly@ubuntu:~/develop/module/first$ make make -C ../../linux-5.3.7 M=`pwd` modules make[1]: Entering directory '/home/sly/develop/linux-5.3.7' CC [M] /home/sly/develop/module/first/first.o Building modules, stage 2. MODPOST 1 modules CC /home/sly/develop/module/first/first.mod.o LD [M] /home/sly/develop/module/first/first.ko make[1]: Leaving directory '/home/sly/develop/linux-5.3.7' sly@ubuntu:~/develop/module/first$ ls first.c first.ko first.mod first.mod.c first.mod.o first.o Makefile modules.order Module.symvers
rootfs根文件系統下面創建一個modules目錄用來存放ko文件
拷貝rootfs的內容到rootfs.ext3虛擬SD中
mount -t ext3 rootfs.ext3 /mnt/ -o loop
cp -r rootfs/* /mnt
umount /mnt
啟動開發板,加載KO
/ # ls bin lib lost+found sbin dev linuxrc modules usr / # cd te -/bin/sh: cd: can't cd to te / # cd modules/ /modules # ls first.ko /modules # insmod first.ko first: loading out-of-tree module taints kernel. init hello_moudle /modules # rmmod first.ko rmmod: can't change directory to '/lib/modules': No such file or directory /lib # lsmod lsmod: can't open '/proc/modules': No such file or directory
7. 繼續完善文件系統
a. 創建etc及inittable文件,語句含義參考: https://blog.csdn.net/u014089899/article/details/80622607
sly@ubuntu:~/develop/rootfs$ mkdir etc sly@ubuntu:~/develop/rootfs$ cd etc/ sly@ubuntu:~/develop/rootfs/etc$ sudo vi inittab
inittab內容如下
::sysinit:/etc/init.d/rcS #::respawn:-/bin/sh #tty2::askfirst:-/bin/sh #::ctrlaltdel:/bin/umount -a -r console::askfirst:-/bin/sh ::ctrlaltdel:/sbin/reboot ::shutdown:/bin/umount -a -r
創建fstab,相應文件夾需要自行創建好 含義參考:https://blog.csdn.net/xyajia/article/details/79165655
sly@ubuntu:~/develop/rootfs/etc$ sudo vi fstab # /etc/fstab: static file system information. # # Use 'blkid' to print the universally unique identifier for a # device; this may be used with UUID= as a more robust way to name devices # that works even if disks are added and removed. See fstab(5). # # <file system> <mount point> <type> <options> <dump> <pass> # / was on /dev/sda1 during installation proc /proc proc defaults 0 0 tmpfs /tmp tmpfs defaults 0 0 sysfs /sys sysfs defaults 0 0 tmpfs /dev tmpfs defaults 0 0 var /dev tmpfs defaults 0 0 ramfs /dev ramfs defaults 0 0
創建init.d/rcS
sly@ubuntu:~/develop/rootfs/etc$ sudo mkdir init.d sly@ubuntu:~/develop/rootfs/etc$ cd init.d/ sly@ubuntu:~/develop/rootfs/etc/init.d$ sudo vi rcS #! /bin/sh PATH=/sbin:/bin:/usr/sbin:/usr/bin LD_LIBRARY_PATH=/lib export PATH LD_LIBRARY_PATH mount -a mkdir -p /dev/pts mount -t devpts devpts /dev/pts mdev -s mkdir -p /var/lock echo "----------------------------------------" echo " welcome debugging on A9 vexpress board" echo "----------------------------------------"
sly@ubuntu:~/develop/rootfs/etc/init.d$ sudo chmod 777 rcS
用最新的rootfs覆蓋rootfs.ext3虛擬SD卡,啟動開發板驗證,效果如下:(出錯部分不知道問什么掛在到mnt后在mnt中沒有可執行權限,添加下可執行權限就行)
Error: Driver 'vexpress-muxfpga' is already registered, aborting... drm-clcd-pl111 10020000.clcd: initializing Versatile Express PL111 drm-clcd-pl111 10020000.clcd: DVI muxed to daughterboard 1 (core tile) CLCD input: AT Raw Set 2 keyboard as /devices/platform/smb@4000000/smb@4000000:motherboard/smb@4000000:motherboard:iofpga@7,00000000/10006000.kmi/serio0/input/input0 mmc0: new SD card at address 4567 Error: Driver 'vexpress-muxfpga' is already registered, aborting... drm-clcd-pl111 10020000.clcd: initializing Versatile Express PL111 drm-clcd-pl111 10020000.clcd: DVI muxed to daughterboard 1 (core tile) CLCD mmcblk0: mmc0:4567 QEMU! 32.0 MiB Error: Driver 'vexpress-muxfpga' is already registered, aborting... drm-clcd-pl111 10020000.clcd: initializing Versatile Express PL111 drm-clcd-pl111 10020000.clcd: DVI muxed to daughterboard 1 (core tile) CLCD Error: Driver 'vexpress-muxfpga' is already registered, aborting... drm-clcd-pl111 10020000.clcd: initializing Versatile Express PL111 drm-clcd-pl111 10020000.clcd: DVI muxed to daughterboard 1 (core tile) CLCD rtc-pl031 10017000.rtc: setting system clock to 2019-12-24T05:46:23 UTC (1577166383) ALSA device list: #0: ARM AC'97 Interface PL041 rev0 at 0x10004000, irq 24 input: ImExPS/2 Generic Explorer Mouse as /devices/platform/smb@4000000/smb@4000000:motherboard/smb@4000000:motherboard:iofpga@7,00000000/10007000.kmi/serio1/input/input2 Error: Driver 'vexpress-muxfpga' is already registered, aborting... drm-clcd-pl111 10020000.clcd: initializing Versatile Express PL111 drm-clcd-pl111 10020000.clcd: DVI muxed to daughterboard 1 (core tile) CLCD EXT4-fs (mmcblk0): mounting ext3 file system using the ext4 subsystem random: fast init done EXT4-fs (mmcblk0): mounted filesystem with ordered data mode. Opts: (null) VFS: Mounted root (ext3 filesystem) readonly on device 179:0. Freeing unused kernel memory: 1024K Run /sbin/init as init process random: crng init done can't run '/etc/init.d/rcS': Permission denied Please press Enter to activate this console.
/ # ls
bin etc linuxrc proc sys usr
dev lib modules sbin tmp var
進行insmod和rmmod操作,發現還需要創建幾個文件夾,根據提示在lib下創建lib/modules和lib/modules/5.3.7,就此告一段落
/modules # ls first.ko hello /modules # cat hello hello /modules # vi hello /modules #
8.gdb遠程調試內核
8.1.准備gdb
linux環境安裝gcc后默認是不安裝配到gdb的,我們調試的遠端設備是arm的所以需要安裝交叉編譯的gdb,我們之前使用的交叉編譯工具鏈是這個 arm-linux-gnueabi-gcc, 所以我們安裝對應的gdb。這里下載的是目前較新的8.3版本
下載地址: http://ftp.gnu.org/gnu/gdb/
安裝方法,建議在源碼目錄外新建一個文件夾進行編譯,目錄結構如下
sly@ubuntu:~/develop$ ls build_gdb busybox-1.24.2 gdb-8.3 linux-5.3.7 linux-5.3.7.tar module rootfs rootfs.ext3 start.sh stop.sh tmp
按照上面的交叉編譯工具鏈進行安裝對應的gdb
sly@ubuntu:~/develop/build_gdb$ ../gdb-8.3/configure --target=arm-linux-gnueabi sly@ubuntu:~/develop/build_gdb$ make sly@ubuntu:~/develop/build_gdb$ sudo make install
第一個坑:gdb需要環境上安裝了textinfo,否則install的時候會失敗,安裝方法: sudo apt-get install texinfo
第二個坑:gdb運行remote調試時需要安裝expat, 安裝方法: sudo apt-get install expat
第三個坑:只安裝expat不管用,需要安裝dev的開發lib,安裝方法: sudo apt-get install libexpat1-dev
第二和第三個坑填上后修改下第一步的configure的傳入參數如下,帶expat編譯gdb,之后make再make install就可以了
sly@ubuntu:~/develop/build_gdb$ ../gdb-8.3/configure --target=arm-linux-gnueabi --with-expat
gdb默認安裝路徑: /usr/local/bin/arm-linux-gnueabi-gdb
安裝完成后查看一下
sly@ubuntu:~/develop/build_gdb$ arm-linux-gnueabi-gdb -v GNU gdb (GDB) 8.3 Copyright (C) 2019 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html> This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law.
8.2 gdb連接qemu的虛擬環境
qemu的參數需要加上-s以便於gdb可以通過1234端口對內核進行連接,新的啟動參數如下
qemu-system-arm -M vexpress-a9 -m 512m -kernel /home/sly/develop/linux-5.3.7/arch/arm/boot/zImage -dtb linux-5.3.7/arch/arm/boot/dts/vexpress-v2p-ca9.dtb -nographic -append "root=/dev/mmcblk0 console=ttyAMA0" -sd rootfs.ext3 -s
之后另起一個控制台,啟動gdb進行連接
sly@ubuntu:~/develop/linux-5.3.7$ arm-linux-gnueabi-gdb vmlinux GNU gdb (GDB) 8.3 Copyright (C) 2019 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html> This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. Type "show copying" and "show warranty" for details. This GDB was configured as "--host=x86_64-pc-linux-gnu --target=arm-linux-gnueabi". Type "show configuration" for configuration details. For bug reporting instructions, please see: <http://www.gnu.org/software/gdb/bugs/>. Find the GDB manual and other documentation resources online at: <http://www.gnu.org/software/gdb/documentation/>. For help, type "help". Type "apropos word" to search for commands related to "word"... Reading symbols from vmlinux... (gdb) target remote localhost:1234 Remote debugging using localhost:1234 cpu_v7_do_idle () at arch/arm/mm/proc-v7.S:78 78 ret lr (gdb)
大功告成!!