Coder Social home page Coder Social logo

figozhang / runninglinuxkernel_4.0 Goto Github PK

View Code? Open in Web Editor NEW
472.0 40.0 276.0 407.49 MB

《奔跑吧Linux内核》配套实验平台和代码,白色入门酱香篇,蓝色进阶浓香篇

License: Other

Makefile 0.24% C 96.67% Assembly 0.53% C++ 1.21% Objective-C 0.38% Shell 0.08% Perl 0.17% Awk 0.01% Python 0.06% Yacc 0.03% Lex 0.01% UnrealScript 0.01% Scilab 0.01% XS 0.01% Roff 0.42% Tcl 0.01% CSS 0.01% HTML 0.17% Clojure 0.01% M4 0.01%

runninglinuxkernel_4.0's Introduction

runninglinuxkernel_4.0 for 《奔跑吧Linux内核》 《奔跑吧Linux内核*入门篇》

国内git镜像

国内下载github比较慢,我们提供一个国内的git镜像。

$ git clone https://e.coding.net/benshushu/runninglinuxkernel_4.0.git -b rlk_basic

400页实验指导手册免费下载

国内首本Linux实验指导手册,将近400页,干货满满,融入企业实战项目的经验总结,让您快速入门!

加入奔跑吧Linux社区微信公众号(微信公众号:runninglinuxkernel),在微信公众号里输入“最新实验指导手册”,就会跳出下载地址啦。

下载奔跑吧入门篇全套资料

加入奔跑吧Linux社区微信公众号,在微信公众号里输入“全套”就会跳出下载地址啦

下载实验平台

加入奔跑吧Linux社区微信公众号,在微信公众号里输入“vmware镜像”就会跳出下载地址啦

下载免费视频

加入奔跑吧Linux社区微信公众号,在微信公众号里输入“免费视频”就会跳出下载地址啦

进阶视频课程

加入奔跑吧Linux社区微信公众号,在微信公众号里输入“进阶视频”。就会跳出下载地址啦

配套电子课件ppt

本书提供70多个linux内核和驱动入门实验,除了配套实验环境和实验代码之外,还精心制作了600多页精美的PPT电子课件,欢迎有兴趣的高校老师发邮件索取ppt源文件: [email protected], 请用工作邮箱发送邮件(比如edu域名邮箱)。

pdf版本的课件已经上传到人邮异步社区,ppt版本的课件仅限大专院校老师申请。培训机构或者企业内部培训,也可以 发邮件申请,需提供购买20本书的发票照片。

奔跑吧入门篇酱香篇配套代码

本分支是《奔跑吧Linux内核》入门酱香篇配套的实验环境和代码。

每当我看到Linux专家不用鼠标,直接在黑屏里噼噼啪啪的敲一通,一个程序就写好了, 我还在丑陋的VB/VC之类编程工具,我觉得我和大神们相差1000英里的距离

每次我看到Linux专家对Linux系统特别是Linux内核谈笑风生的时候,一大堆英文术语让我晕菜, 我觉得我和这些大神们的距离相差2000英里的距离。

每当我看到Linux大牛面对死机黑屏,淡淡一笑,轻轻的敲了几下键盘,就找到root cause了,我羡慕不已, 我觉得我和这些大神们的距离相差5000英里。

自从《奔跑吧Linux内核》出来之后,笨叔要告诉大家,您和Linux大神的距离只差一本奔跑吧入门酱香篇。

入门酱香篇特色:

**** 从0开始学习内核

  • 学习最新开发工具,如Vim 8和Git
  • 内容循序渐进,深入浅出学习Linux内核
  • 70多个创新实验,突出动手能力
  • 融入最新开源社区开发理念和资讯
  • 参与社区开发
  • 提供精美课件,多大500~600页ppt
  • 提供实验参考代码
  • 提供全套实验环境 - 基于优麒麟Linux 18.04系统的虚拟机镜像
  • 提供全套实验环境 - docker镜像
  • 提供免费补充高清视频,全程10小时,33集,B站首发
  • 提供配套音频节目,喜马拉雅首发

配备全球最丰富的教学和学习资源

  1. 配套约600页课件(pdf版本) 课件已经上传到异步社区和github。 下载地址:https://www.epubit.com/book/detail/39321 或者:https://github.com/figozhang/Running-LinuxKernel ppt版本仅限大专院校linux相关专业任课老师申请,或者培训机构以及公司培训之用。

  2. 配套全套实验代码: https://github.com/figozhang/runninglinuxkernel_4.0

  3. 配套全套实验环境的vmware虚拟机镜像 (基于优麒麟Linux 18.04) 下载地址: 异步社区:https://www.epubit.com/book/detail/39321 百度网盘:https://pan.baidu.com/s/1XlJzdUBH_V7IwNRH1R4jrg 谷歌网盘:https://drive.google.com/open?id=1cTRQ73f0yzhTBoNt6rhHbkbbPTI8j_3P

  4. 配套全套实验的docker镜像 https://hub.docker.com/r/benshushu/runninglinuxkernel

  5. 配套补充视频,10小时高清,33集真情播放 从3月25号起,33集奔跑吧高清视频在B站首发,每天一集,天天精彩。 请到B站 (https://www.bilibili.com/)搜索:奔跑吧linux内核

配套视频通过GPLv2协议公开,欢迎大家下载和自由传播。网盘下载地址: 链接:https://pan.baidu.com/s/1AvTkeOyyJUSBJ_K0pxip0Q 提取码:le2s

  1. 配套音频节目 从3月25号起,33集配套音频节目上线喜马拉雅 https://www.ximalaya.com/keji/22283701/

  2. 微信交流群,请先加微信:runninglinuxkernel。请先自我介绍,然后才能拉进群。

  3. 免费的知识星球 https://t.zsxq.com/BY7yB2v

图书购买地址

收费视频

入门篇配套的免费视频基本上都是节选自奔跑吧旗舰篇视频,可能存在不完整或者不连贯。 若想收看完整的视频节目或者获得更好的学习效果,建议您订阅旗舰篇视频。 订阅地址:https://shop115683645.taobao.com/

runninglinuxkernel_4.0's People

Contributors

0x0916 avatar runninglinuxkernel avatar wangjiewen avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

runninglinuxkernel_4.0's Issues

Option frame-larger-than Warning

There are so many warning as shown below.

Is the below warning will be caused the kernel abnormal behavior ?

warning: the frame size of 2176 bytes is larger than 2048 bytes [-Wframe-larger-than=]

kernel don't run, waiting at "input: ImExPS/2 Generic Explorer Mouse as XXX"

Ubuntu 14.04.5
arm-linux-gnueabi-gcc version 4.7.3 (Ubuntu/Linaro 4.7.3-12ubuntu1)

qemu-system-arm -M vexpress-a9 -smp 4 -m 1024M -kernel arch/arm/boot/zImage  -append "rdinit=/linuxrc console=ttyAMA0 loglevel=8" -dtb arch/arm/boot/dts/vexpress-v2p-ca9.dtb -S -s -nographic

kernel waiting @

input: ImExPS/2 Generic Explorer Mouse as /devices/platform/smb/smb:motherboard/smb:motherboard:iofpga@7,00000000/10007000.kmi/serio1/input/input2

details

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
Initializing cgroup subsys cpuset
Linux version 4.0.0+ (gatieme@Aspire) (gcc version 4.7.3 (Ubuntu/Linaro 4.7.3-12ubuntu1) ) #1 SMP Sun May 28 23:29:14 CST 2017
CPU: ARMv7 Processor [410fc090] revision 0 (ARMv7), cr=10c5387d
CPU: PIPT / VIPT nonaliasing data cache, VIPT aliasing instruction cache
Machine model: V2P-CA9
Memory policy: Data cache writealloc
On node 0 totalpages: 262144
free_area_init_node: node 0, pgdat c1037d40, node_mem_map eeffa000
  Normal zone: 1520 pages used for memmap
  Normal zone: 0 pages reserved
  Normal zone: 194560 pages, LIFO batch:31
  HighMem zone: 67584 pages, LIFO batch:15
PERCPU: Embedded 11 pages/cpu @eefbd000 s16064 r8192 d20800 u45056
pcpu-alloc: s16064 r8192 d20800 u45056 alloc=11*4096
pcpu-alloc: [0] 0 [0] 1 [0] 2 [0] 3 
Built 1 zonelists in Zone order, mobility grouping on.  Total pages: 260624
Kernel command line: rdinit=/linuxrc console=ttyAMA0 loglevel=8
log_buf_len individual max cpu contribution: 4096 bytes
log_buf_len total cpu_extra contributions: 12288 bytes
log_buf_len min size: 16384 bytes
log_buf_len: 32768 bytes
early log buf free: 14948(91%)
PID hash table entries: 4096 (order: 2, 16384 bytes)
Dentry cache hash table entries: 131072 (order: 7, 524288 bytes)
Inode-cache hash table entries: 65536 (order: 6, 262144 bytes)
Memory: 1022452K/1048576K available (11636K kernel code, 229K rwdata, 1820K rodata, 2908K init, 188K bss, 26124K reserved, 0K cma-reserved, 270336K highmem)
Virtual kernel memory layout:
    vector  : 0xffff0000 - 0xffff1000   (   4 kB)
    fixmap  : 0xffc00000 - 0xfff00000   (3072 kB)
    vmalloc : 0xf0000000 - 0xff000000   ( 240 MB)
    lowmem  : 0xc0000000 - 0xef800000   ( 760 MB)
    pkmap   : 0xbfe00000 - 0xc0000000   (   2 MB)
    modules : 0xbf000000 - 0xbfe00000   (  14 MB)
      .text : 0xc0008000 - 0xc0d2c450   (13458 kB)
      .init : 0xc0d2d000 - 0xc1004000   (2908 kB)
      .data : 0xc1004000 - 0xc103d508   ( 230 kB)
       .bss : 0xc103d508 - 0xc106c518   ( 189 kB)
SLUB: HWalign=64, Order=0-3, MinObjects=0, CPUs=4, Nodes=1
Hierarchical RCU implementation.
	Additional per-CPU info printed with stalls.
	RCU restricting CPUs from NR_CPUS=8 to nr_cpu_ids=4.
RCU: Adjusting geometry for rcu_fanout_leaf=16, nr_cpu_ids=4
NR_IRQS:16 nr_irqs:16 16
L2C: platform modifies aux control register: 0x02020000 -> 0x02420000
L2C: device tree omits to specify unified cache
L2C: DT/platform modifies aux control register: 0x02020000 -> 0x02420000
L2C-310 enabling early BRESP for Cortex-A9
L2C-310 full line of zeros enabled for Cortex-A9
L2C-310 dynamic clock gating disabled, standby mode disabled
L2C-310 cache controller enabled, 8 ways, 128 kB
L2C-310: CACHE_ID 0x410000c8, AUX_CTRL 0x46420001
smp_twd: clock not found -2
sched_clock: 32 bits at 24MHz, resolution 41ns, wraps every 178956969942ns
Console: colour dummy device 80x30
Calibrating local timer... 90.74MHz.
Calibrating delay loop... 540.67 BogoMIPS (lpj=2703360)
pid_max: default: 32768 minimum: 301
Mount-cache hash table entries: 2048 (order: 1, 8192 bytes)
Mountpoint-cache hash table entries: 2048 (order: 1, 8192 bytes)
CPU: Testing write buffer coherency: ok
CPU0: thread -1, cpu 0, socket 0, mpidr 80000000
Setting up static identity map for 0x60b2d780 - 0x60b2d7d8
CPU1: thread -1, cpu 1, socket 0, mpidr 80000001
CPU2: thread -1, cpu 2, socket 0, mpidr 80000002
CPU3: thread -1, cpu 3, socket 0, mpidr 80000003
Brought up 4 CPUs
SMP: Total of 4 processors activated (1167.87 BogoMIPS).
CPU: All CPU(s) started in SVC mode.
devtmpfs: initialized
VFP support v0.3: implementor 41 architecture 3 part 30 variant 9 rev 0
NET: Registered protocol family 16
DMA: preallocated 256 KiB pool for atomic coherent allocations
cpuidle: using governor ladder
cpuidle: using governor menu
genirq: Setting trigger mode 1 for irq 18 failed (gic_set_type+0x0/0x100)
genirq: Setting trigger mode 1 for irq 19 failed (gic_set_type+0x0/0x100)
genirq: Setting trigger mode 1 for irq 20 failed (gic_set_type+0x0/0x100)
genirq: Setting trigger mode 1 for irq 21 failed (gic_set_type+0x0/0x100)
of_amba_device_create(): amba_device_add() failed (-19) for /memory-controller@100e0000
of_amba_device_create(): amba_device_add() failed (-19) for /memory-controller@100e1000
of_amba_device_create(): amba_device_add() failed (-19) for /watchdog@100e5000
of_amba_device_create(): amba_device_add() failed (-19) for /smb/motherboard/iofpga@7,00000000/sysctl@01000
of_amba_device_create(): amba_device_add() failed (-19) for /smb/motherboard/iofpga@7,00000000/wdt@0f000
No ATAGs?
hw-breakpoint: debug architecture 0x0 unsupported.
Serial: AMBA PL011 UART driver
10009000.uart: ttyAMA0 at MMIO 0x10009000 (irq = 38, base_baud = 0) is a PL011 rev1
console [ttyAMA0] enabled
1000a000.uart: ttyAMA1 at MMIO 0x1000a000 (irq = 39, base_baud = 0) is a PL011 rev1
1000b000.uart: ttyAMA2 at MMIO 0x1000b000 (irq = 40, base_baud = 0) is a PL011 rev1
1000c000.uart: ttyAMA3 at MMIO 0x1000c000 (irq = 41, base_baud = 0) is a PL011 rev1
SCSI subsystem initialized
libata version 3.00 loaded.
usbcore: registered new interface driver usbfs
usbcore: registered new interface driver hub
usbcore: registered new device driver usb
Advanced Linux Sound Architecture Driver Initialized.
Switched to clocksource arm,sp804
NET: Registered protocol family 2
TCP established hash table entries: 8192 (order: 3, 32768 bytes)
TCP bind hash table entries: 8192 (order: 4, 65536 bytes)
TCP: Hash tables configured (established 8192 bind 8192)
TCP: reno registered
UDP hash table entries: 512 (order: 2, 16384 bytes)
UDP-Lite hash table entries: 512 (order: 2, 16384 bytes)
NET: Registered protocol family 1
RPC: Registered named UNIX socket transport module.
RPC: Registered udp transport module.
RPC: Registered tcp transport module.
RPC: Registered tcp NFSv4.1 backchannel transport module.
hw perfevents: enabled with armv7_cortex_a9 PMU driver, 1 counters available
futex hash table entries: 1024 (order: 4, 65536 bytes)
squashfs: version 4.0 (2009/01/31) Phillip Lougher
jffs2: version 2.2. (NAND) © 2001-2006 Red Hat, Inc.
9p: Installing v9fs 9p2000 file system support
bounce: pool size: 64 pages
io scheduler noop registered (default)
clcd-pl11x 10020000.clcd: PL111 rev2 at 0x10020000
clcd-pl11x 10020000.clcd: /clcd@10020000 hardware, 1024x768@59 display
Console: switching to colour frame buffer device 128x48
clcd-pl11x 1001f000.clcd: PL111 rev2 at 0x1001f000
clcd-pl11x 1001f000.clcd: /smb/motherboard/iofpga@7,00000000/clcd@1f000 hardware, 640x480@59 display
40000000.flash: Found 2 x16 devices at 0x0 in 32-bit bank. Manufacturer ID 0x000000 Chip ID 0x000000
NOR chip too large to fit in mapping. Attempting to cope...
Intel/Sharp Extended Query Table at 0x0031
Using buffer write method
erase region 0: offset=0x0,size=0x80000,blocks=256
Reducing visibility of 131072KiB chip to 65536KiB
40000000.flash: Found 2 x16 devices at 0x0 in 32-bit bank. Manufacturer ID 0x000000 Chip ID 0x000000
NOR chip too large to fit in mapping. Attempting to cope...
Intel/Sharp Extended Query Table at 0x0031
Using buffer write method
erase region 0: offset=0x0,size=0x80000,blocks=256
Reducing visibility of 131072KiB chip to 65536KiB
Concatenating MTD devices:
(0): "40000000.flash"
(1): "40000000.flash"
into device "40000000.flash"
libphy: smsc911x-mdio: probed
smsc911x 4e000000.ethernet eth0: attached PHY driver [Generic PHY] (mii_bus:phy_addr=4e000000.etherne:01, irq=-1)
smsc911x 4e000000.ethernet eth0: MAC Address: 52:54:00:12:34:56
isp1760 4f000000.usb: bus width: 32, oc: digital
isp1760 4f000000.usb: NXP ISP1760 USB Host Controller
isp1760 4f000000.usb: new USB bus registered, assigned bus number 1
isp1760 4f000000.usb: Scratch test failed.
isp1760 4f000000.usb: can't setup: -19
isp1760 4f000000.usb: USB bus 1 deregistered
usbcore: registered new interface driver usb-storage
mousedev: PS/2 mouse device common for all mice
rtc-pl031 10017000.rtc: rtc core: registered pl031 as rtc0
Driver 'mmcblk' needs updating - please use bus_type methods
mmci-pl18x 10005000.mmci: Got CD GPIO
mmci-pl18x 10005000.mmci: Got WP GPIO
mmci-pl18x 10005000.mmci: No vqmmc regulator found
mmci-pl18x 10005000.mmci: mmc0: PL181 manf 41 rev0 at 0x10005000 irq 34,35 (pio)
ledtrig-cpu: registered to indicate activity on CPUs
usbcore: registered new interface driver usbhid
usbhid: USB HID core driver
input: AT Raw Set 2 keyboard as /devices/platform/smb/smb:motherboard/smb:motherboard:iofpga@7,00000000/10006000.kmi/serio0/input/input0
aaci-pl041 10004000.aaci: ARM AC'97 Interface PL041 rev0 at 0x10004000, irq 33
aaci-pl041 10004000.aaci: FIFO 512 entries
oprofile: using arm/armv7-ca9
TCP: cubic registered
NET: Registered protocol family 17
9pnet: Installing 9P2000 support
Registering SWP/SWPB emulation handler
rtc-pl031 10017000.rtc: setting system clock to 2017-05-28 16:06:41 UTC (1495987601)
ALSA device list:
  #0: ARM AC'97 Interface PL041 rev0 at 0x10004000, irq 33
Warning: unable to open an initial console.
Freeing unused kernel memory: 2908K (c0d2d000 - c1004000)
input: ImExPS/2 Generic Explorer Mouse as /devices/platform/smb/smb:motherboard/smb:motherboard:iofpga@7,00000000/10007000.kmi/serio1/input/input2

[ feature request] modules related dir for basic rootfs

Due to we need to study linux kernel by linux kernel modules.
So I regard that we should add lib/modules/$(version) in the rootfs for newbee.
if not, it will cause rmmod failed!
And also there is no shared mount point for module install. maybe we can used virt-9p for that.

红黑树实验用例,rmmod rb_test.ko 时发生异常

源码路径如下:
runninglinuxkernel_4.0/rlk_lab/rlk_basic/chapter_2/lab3/kernel_module/

使用该源码编译出 rb_test.ko,拷贝至 kmodules 文件夹下,通过 ./run.sh arm32 启动 qemu 后,执行 insmod rb_test.ko 无问题,但执行 rmmod rb_test.ko 报错如下:

/mnt # insmod rb_test.ko 
[   33.857806] key=0
[   33.859100] key=2
[   33.859175] key=4
[   33.859309] key=6
[   33.859386] key=8
[   33.859535] key=10
[   33.859624] key=12
[   33.859736] key=14
[   33.859804] key=16
[   33.859860] key=18
/mnt # rmmod rb_test.ko 
[   39.756729] Unable to handle kernel paging request at virtual address 6b6b6b73
[   39.759282] pgd = c4b4c000
[   39.759520] [6b6b6b73] *pgd=00000000
[   39.760576] Internal error: Oops: 5 [#1] SMP ARM
[   39.760934] Modules linked in: rb_test(O-)
[   39.761669] CPU: 1 PID: 778 Comm: rmmod Tainted: G           O    4.0.0+ #1
[   39.761957] Hardware name: ARM-Versatile Express
[   39.762247] task: c5df1b80 ti: c4530000 task.ti: c4530000
[   39.762929] PC is at rb_next+0x54/0xb0
[   39.763477] LR is at my_exit+0x5c/0x78 [rb_test]
[   39.763767] pc : [<c05a88c8>]    lr : [<bf000214>]    psr: 20000013
[   39.763767] sp : c4533f10  ip : 00000000  fp : 002183a4
[   39.764324] r10: 00000000  r9 : c4530000  r8 : c0014ec4
[   39.764547] r7 : 00000081  r6 : 00000000  r5 : 00747365  r4 : 745f6272
[   39.764719] r3 : 6b6b6b6b  r2 : 6b6b6b6b  r1 : 00000010  r0 : c44f7000
[   39.765112] Flags: nzCv  IRQs on  FIQs on  Mode SVC_32  ISA ARM  Segment user
[   39.765444] Control: 10c5387d  Table: 64b4c06a  DAC: 00000015
[   39.765640] Process rmmod (pid: 778, stack limit = 0xc4530210)
[   39.765823] Stack: (0xc4533f10 to 0xc4534000)
[   39.766191] 3f00:                                     c63bbee0 6b6b6b6b 745f6272 bf00020c
[   39.766533] 3f20: 00000001 c44f7000 c44f7000 c44f7000 be996abc c01149e0 00000880 be996abc
[   39.766908] 3f40: 745f6272 00747365 c4455b80 00004000 0000000c 00000000 fffffffe c4454280
[   39.767160] 3f60: 00000000 c10c1bb4 c4455b80 00000001 00000000 001e1bfc 00ffff9c 00000000
[   39.767608] 3f80: 00000000 c024a10c bf0003d4 00000000 bf00027c 00000880 be996abc 00000000
[   39.768052] 3fa0: 00000017 c0014d40 745f6272 00747365 be996abc 00000880 00000007 00000000
[   39.768239] 3fc0: 745f6272 00747365 00000000 00000081 00000001 00000000 00000000 002183a4
[   39.768417] 3fe0: be996ab8 be996aa8 0002d680 00012130 60000010 be996abc 00000000 00000000
[   39.768899] [<c05a88c8>] (rb_next) from [<bf000214>] (my_exit+0x5c/0x78 [rb_test])
[   39.769365] [<bf000214>] (my_exit [rb_test]) from [<c01149e0>] (SyS_delete_module+0x1d0/0x238)
[   39.769765] [<c01149e0>] (SyS_delete_module) from [<c0014d40>] (ret_fast_syscall+0x0/0x34)
[   39.770376] Code: e59d3004 e5933008 e58d3004 e59d3004 (e5933008) 
[   39.771142] ---[ end trace 464d93677bdf49e3 ]---
Segmentation fault

追踪至异常源码处,node 是 data 的红黑树结点指针,循环中 kfree 将 data 释放后,data 中的 node 也就释放了,在下一次循环时就使用了非法地址。

  static void __exit my_exit(void)
  {
          struct mytype *data;
          struct rb_node *node;
          for (node = rb_first(&mytree); node; node = rb_next(node)) {
                  data = rb_entry(node, struct mytype, node);
                  if (data) {
                          rb_erase(&data->node, &mytree);
                          kfree(data);
                  }
          }
  }

请帮忙确认下是否有上述问题,thanks!

repo address may be wrong

➜ tiny git clone https://github.com/figozhang/runninglinuxkernel_4.0.git tig: Not a git repository ➜ tiny git clone [email protected]:figozhang/runninglinuxkernel_4.0.git tig: Not a git repository ➜ tiny

网盘版本缺少run.sh

Hi,

我下载了网盘版本,但是发现缺少了run.sh脚本。
github的repo是有run.sh

我想,这个不同会容易造成困惑(如果不仔细比较的话)。

试验5-8出错

只修改了device的名称

/ # mknod /dev/mydemo_err0 c 252 0
/ # cd mnt
/mnt # insmod miscerr.ko
[ 77.235510] succeeded register char device: mydemo_err
/mnt # cat /dev/mydemo_err0 &
/mnt # [ 93.227125] demodrv_open: major=252, minor=0, device=mydemo_err0
[ 93.233195] demodrv_read:mydemo_err0 pid=778, going to sleep, private_data_0

/mnt #
/mnt #
/mnt # echo "i am study linux now" > /dev/mydemo_err0
[ 131.945397] demodrv_open: major=252, minor=0, device=mydemo_err0
[ 131.948193] wait up read queue, private_data_0
[ 131.948609] demodrv_write:mydemo_err0 pid=772, actual_write =21, ppos=0, ret=0
[ 131.950152] Unable to handle kernel paging request at virtual address c789f6c0
[ 131.950673] pgd = c47d4000
[ 131.950852] [c789f6c0] *pgd=00000000
[ 131.952042] Internal error: Oops: 5 [#1] SMP ARM
[ 131.952779] Modules linked in: miscerr(O)
[ 131.954508] CPU: 0 PID: 772 Comm: sh Tainted: G O 4.0.0+ #2
[ 131.955054] Hardware name: ARM-Versatile Express
[ 131.956382] task: c4ab0b00 ti: c47d0000 task.ti: c47d0000
[ 131.957525] PC is at kfree+0x178/0x704
[ 131.957849] LR is at __kfifo_free+0x1c/0x64
[ 131.958290] pc : [] lr : [] psr: 20000013
[ 131.958290] sp : c47d3c68 ip : 00000000 fp : beb48fbe
[ 131.958923] r10: 00000000 r9 : c47d0000 r8 : c0014ec4
[ 131.959194] r7 : 0000003f r6 : 00000000 r5 : 0021da88 r4 : c05c0fb8
[ 131.959539] r3 : c789f6c0 r2 : c789f6c0 r1 : 00000019 r0 : 6b6b6b6b
[ 131.960074] Flags: nzCv IRQs on FIQs on Mode SVC_32 ISA ARM Segment user
[ 131.960416] Control: 10c5387d Table: 647d406a DAC: 00000015
[ 131.960762] Process sh (pid: 772, stack limit = 0xc47d0210)
[ 131.961111] Stack: (0xc47d3c68 to 0xc47d4000)
[ 131.961506] 3c60: c4c3a280 6b6b6b6b 0a9b0a9b c0239350 00000000 c4c3a280
[ 131.962103] 3c80: c10f5188 c10f5188 60000013 c00c80f8 00000400 20000013 c10c378c c10c378c
[ 131.962595] 3ca0: 20000013 c10c378c 000003e0 c10c378c bcbcfdb1 00000000 0021dab8 bf000504
[ 131.963136] 3cc0: 00000000 c10f5188 c10f5188 c10f5188 c10f5188 60000013 00000004 c10f5188
[ 131.964751] 3ce0: 60000013 c10f5188 00000002 00000004 c62f4078 60000013 00000000 01000000
[ 131.967115] 3d00: c10f5188 c4ab0b00 00000000 00000000 00000000 c4ab0b00 00000000 00000042
[ 131.968103] 3d20: beb48fbe c007cc94 00000004 01000000 c5438c00 c4ab0b00 c4ba5ad0 00000002
[ 131.968833] 3d40: c47d0000 00000002 c4ab0b00 00000000 00000000 00000000 c4ab0ee4 00000004
[ 131.969416] 3d60: c5438c00 00000000 c4ab0ee4 00000004 c5438c00 c62feff8 05248000 c10b6ff8
[ 131.970017] 3d80: 00000000 00000000 00000000 00000000 05248000 c10b6ffc 00000000 00000000
[ 131.970820] 3da0: c4c3a280 c5c03cc0 00000080 c4c3a280 80010d00 c4c3a280 c4c3a280 c5c03cc0
[ 131.971726] 3dc0: c4c3a280 bf0001a8 c4c3a280 c63ca740 c789f6c0 0000000f c789f6c0 c789f6c0
[ 131.972422] 3de0: c789f6c0 0000000f c63ca740 c63ca740 c63ca740 c63ca740 00000007 00000000
[ 131.974227] 3e00: 60000013 00000000 c10f17a8 c10f17a8 6b6b6b6b c05c0fb8 c10f17a8 c10f17a8
[ 131.974868] 3e20: c4c3a280 6b6b6b6b c5d37540 c5c03cc0 c5d37548 6b6b6b6b 0000000b c05c0fb8
[ 131.976320] 3e40: c63ca740 c4c3a2c4 0000000b bf0001c4 c5438c00 c452c448 00000000 c4c3a2c4
[ 131.976861] 3e60: c4c3a2c4 c4c3a280 00000001 c0250b0c 00000000 00000000 00000002 c5438c00
[ 131.977718] 3e80: 00000001 c5d37508 00000000 00000000 00000000 00000000 00000000 c5d37540
[ 131.978780] 3ea0: 00000001 00000008 c5bf8270 c5438c08 00000008 0004001e c452c448 c5438c00
[ 131.979130] 3ec0: c5438c08 c5438c94 c5438c00 c028967c 00000000 00000000 00000001 c5438c00
[ 131.979624] 3ee0: c5438c00 c452c448 c5cf4c10 c5bf8270 00000002 c0250e30 c55da000 c5438c00
[ 131.980088] 3f00: 00000000 c5438c00 c5d37508 c007d16c 01e601e6 01e601e6 c5d37500 0000000b
[ 131.980496] 3f20: 00000004 c47d3f10 c4ab0ef8 c5438c00 c5438c00 00000000 c4ab0ee4 00000004
[ 131.981302] 3f40: 00000000 c5438c00 c4ab0ee4 00000004 00000000 c5438c00 c4ab0ee4 00000000
[ 131.981866] 3f60: 00000000 c4ab0ef8 00000000 c4ab0b00 c5438c00 c5438c00 00200200 c001c8e0
[ 131.982384] 3f80: c5438c00 c0014ec4 00000004 c47d3fb0 00000015 00000002 c47d0000 c47d3fb0
[ 131.985925] 3fa0: 00000017 c0014d40 0000000b c0014d84 00000001 00000001 0021c828 00000001
[ 131.986431] 3fc0: 0000000b 0021da88 00000000 0000003f 0021cc28 00000000 001ca858 beb48fbe
[ 131.986848] 3fe0: 00000000 beb489fc 000707d0 00011bbc 20000010 0000000b 00000000 00000000
[ 131.987406] [] (kfree) from [] (__kfifo_free+0x1c/0x64)
[ 131.988871] [] (__kfifo_free) from [] (demodrv_release+0x40/0x50 [miscerr])
[ 131.989336] [] (demodrv_release [miscerr]) from [] (__fput+0x1fc/0x3f0)
[ 131.989831] [] (__fput) from [] (____fput+0x20/0x2c)
[ 131.990178] [] (____fput) from [] (task_work_run+0x2ec/0x334)
[ 131.990626] [] (task_work_run) from [] (do_work_pending+0x13c/0x174)
[ 131.991237] [] (do_work_pending) from [] (work_pending+0xc/0x20)
[ 131.992238] Code: e1a032c3 e1a03103 e59d2168 e0823003 (e5932000)
[ 131.993084] ---[ end trace a12670f987276c82 ]---

[入门篇]印刷错误

109页

实验3:为虚拟设备编写驱动

代码

static char *device_buffer;

这里device_buffer是一个野指针,没有任何定义在后续的read和write就直接使用了

然后错误2是在demodrv_read函数中,

need_read = max_free > count ? lbuf : max_free;

没有找到lbuf的定义,推测是不是该为count?

执行rmmod发生Segmentation fault

/mnt # rmmod modhello
Segmentation fault

网盘上的repo遇到这个问题,码云上的repo我也测试了,也是这个问题

hello_exit的退出函数里,只有一句printk

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.