├── .gitignore ├── Makefile ├── README.md ├── doc ├── INSTALL.docx ├── Visio │ ├── PCB.jpg │ ├── PCB.vsdx │ ├── stack1-0.jpg │ ├── stack1-0.vsdx │ ├── stack1-1.jpg │ ├── stack1-1.vsdx │ ├── stack1-2.jpg │ ├── stack1-2.vsdx │ ├── stack1-3.jpg │ ├── stack1-3.vsdx │ ├── stack1-4.jpg │ ├── stack1-4.vsdx │ ├── stack1-5.jpg │ ├── stack1-5.vsdx │ ├── stack2-0.jpg │ ├── stack2-0.vsdx │ ├── stack2-1.jpg │ ├── stack2-1.vsdx │ ├── stack2-2.jpg │ ├── stack2-2.vsdx │ ├── stack2-3.jpg │ ├── stack2-3.vsdx │ ├── stack2-4.jpg │ ├── stack2-4.vsdx │ ├── stack2-5.jpg │ ├── stack2-5.vsdx │ ├── stack3-0.jpg │ ├── stack3-0.vsdx │ ├── stack3-1.jpg │ ├── stack3-1.vsdx │ ├── stack3-2.jpg │ ├── stack3-2.vsdx │ ├── stack3-3.jpg │ ├── stack3-3.vsdx │ ├── stack3-4.jpg │ ├── stack3-4.vsdx │ ├── stack3-5.jpg │ ├── stack3-5.vsdx │ ├── stack3-6.jpg │ ├── stack3-6.vsdx │ ├── task0.jpg │ ├── task0.vsdx │ ├── 循环链表.jpg │ ├── 循环链表.vsdx │ ├── 循环链表1.jpg │ ├── 循环链表1.vsdx │ ├── 循环链表2.jpg │ ├── 循环链表2.vsdx │ ├── 循环链表3.jpg │ └── 循环链表3.vsdx ├── images │ ├── linux-3.9.4.png │ └── linux-4.1.0.png ├── mykernel.ppt └── os2013 │ ├── CoursePlan2013.pdf │ ├── HowtheComputerWorks-1.pdf │ ├── HowtheComputerWorks-2.ppt │ ├── LinuxArchitectureAndSystemExecution.ppt │ ├── LinuxC.pdf │ ├── Linux_Get_Started_SOP_V1.1.0_20120806.pdf │ ├── example_asm.c │ ├── example_c.c │ ├── lab3-shell.ppt │ ├── lab3.rar │ ├── lab4.ppt │ ├── lab5.ppt │ ├── lab6.pdf │ ├── lab6.rar │ ├── lab7.ppt │ ├── lab7.rar │ ├── mykernel_release_1.rar │ └── mykernel_release_2.rar ├── kink-src ├── kink-0.0.1 │ ├── Makefile │ ├── interrupt.c │ ├── main.c │ ├── pcb.h │ └── scheduler.c ├── kink-0.0.2 │ ├── Makefile │ ├── README.md │ ├── interrupt.c │ ├── main.c │ ├── pcb.h │ └── scheduler.c └── kink-now │ ├── Makefile │ ├── README.md │ ├── interrupt.c │ ├── main.c │ ├── pcb.h │ └── scheduler.c ├── mykernel-3.9.4 ├── Makefile ├── Makefile.bak ├── README.md ├── bak │ ├── myinterrupt.c │ ├── mymain.c │ └── mypcb.h ├── configs │ └── mini-x86.config ├── patches │ └── linux-3.9.4-mykernel.patch └── src │ ├── Makefile │ ├── README.md │ ├── interrupt.c │ ├── main.c │ ├── pcb.h │ └── scheduler.c ├── mykernel-4.1.0 ├── Makefile ├── README.md ├── configs │ └── mini-x86.config ├── patches │ └── linux-4_1-mykernel.patch └── src │ ├── Makefile │ ├── interrupt.c │ ├── main.c │ ├── pcb.h │ └── scheduler.c └── mykernel.sh /.gitignore: -------------------------------------------------------------------------------- 1 | # intermediate directories 2 | mykernel-3.9.4/downloads/ 3 | mykernel-3.9.4/kernel/ 4 | mykernel-3.9.4/.stamps/ 5 | mykernel-3.9.4/.out/ 6 | 7 | mykernel-4.1.0/downloads/ 8 | mykernel-4.1.0/kernel/ 9 | mykernel-4.1.0/.stamps/ 10 | mykernel-4.1.0/.out/ 11 | 12 | # Normal rules 13 | .* 14 | *.o 15 | *.o.* 16 | *.order 17 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | COMMIT="增加了make run3和make run4直接运行..." 2 | 3 | KERNEL_3_DIR=mykernel-3.9.4 4 | 5 | KERNEL_4_DIR=mykernel-4.1.0 6 | 7 | 8 | .PNONY : github run3 run4 9 | 10 | all : github 11 | 12 | # github 13 | 14 | GITHUB_COMMIT=$(COMMIT) 15 | github : 16 | git add -A 17 | git commit -m $(GITHUB_COMMIT) 18 | git push origin master 19 | 20 | # run your kernel(KINK) 21 | run3 : 22 | cd $(KERNEL_3_DIR) && make run 23 | 24 | run4 : 25 | cd $(KERNEL_4_DIR) && make run 26 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Welcome to the KInK(KernelInKernel) 2 | ------- 3 | 4 | 5 | It is a platform to write your own OS kernel,its based on Linux Kernel 3.9.4/4.1.0 source code 6 | 7 | 8 | 9 | ![linux-3.9.4](doc/images/linux-3.9.4.png) 10 | 11 | 12 | #1 Start KInK 13 | ------- 14 | 15 | 16 | ##1.1 install qemu 17 | ------- 18 | 19 | 20 | your can use `qemu` to run our kernel(KINK). 21 | 22 | install qemu by 23 | 24 | ```c 25 | sudo apt-get install qemu # install QEMU 26 | ``` 27 | 28 | 29 | ``` 30 | sudo ln -s /usr/bin/qemu-system-i386 /usr/bin/qemu 31 | ``` 32 | 33 | or 34 | ``` 35 | sudo ln -s /usr/bin/qemu-system-x86_64 /usr/bin/qemu 36 | ``` 37 | 38 | ##1.2 make KInK 39 | ------- 40 | 41 | 42 | 43 | build **linux-3.9.4** 44 | 45 | ```c 46 | cd linux-3.9.4 47 | make 48 | ``` 49 | 50 | build **linux-4.1** 51 | 52 | ```c 53 | cd linux-4.1 54 | make 55 | ``` 56 | 57 | ##1.3 run KInK 58 | ------- 59 | 60 | run KInK in linux-3.9.4 61 | 62 | ```c 63 | cd linux-3.9.4 64 | make run 65 | ``` 66 | 67 | run KInK in **linux-4.1** 68 | 69 | ```c 70 | cd linux-4.1 71 | make run 72 | ``` 73 | 74 | 75 | 76 | #2 How to Make 77 | ------- 78 | 79 | ##2.1 make内核 80 | ------- 81 | 82 | mykernel-3.9.4是linux-3.9.4的构建目录 83 | 84 | mykernel-4.1.0是linux-4.1.0的构建目录 85 | 86 | 他们都采用了同样的构建方式 87 | 88 | 1. 首先将3.x和4.x内核的源代码, 下载到download目录下 89 | 90 | 2. 接着想内核源代码解压缩到kernel, 并拷贝处两个副本linux-x.x.x.new和linux-x.x.x.src, 前者作为我们自己的kernel构建, 后者则是一份纯净的linux内核源码, 两个副本有利于我们生成自己的patch 91 | 92 | 3. patch内核, 使linux内核开机后执行我们自己定义的start_kernel 93 | 94 | 4. 使用预先的.config(位于configs目录的下mini-86.config文件)配着linux内核的编译参数, 也可以使用make allnoconfig使用默认配置, 至此.config文件生成, 可以执行make构建内核的操作 95 | 96 | 5. make构建内核, 为了保持内核源码的纯净, 我们使用make O=.out将内核构建到.out目录下, 构建完成后将在构建目录.out的arch/x86/boot下生成内核镜像bzImage 97 | 98 | 6. qemu -kernel bzImage用qemu启动内核 99 | 100 | 101 | 102 | 我们的makefile设置了所有自动化的配置工作, 可以直接使用make来完成所有的工作,但是我们仍然有必要了解构建的过程, 这对于我们学习, 修改以及出错排查都有帮助 103 | 104 | 构建**linux-3.9.4** 105 | 106 | ```c 107 | cd linux-3.9.4 108 | make 109 | ``` 110 | 111 | 构建**linux-4.1** 112 | 113 | ```c 114 | cd linux-4.1 115 | make 116 | ``` 117 | 118 | 119 | 如果您想了解详细的构建机理, 请参照如下信息 120 | 121 | #2.2 根目录 122 | ------- 123 | 124 | | 目录 | 描述 | 125 | |:-------:|:-------:| 126 | | mykernel-3.9.4 | linux-3.9.4的构建目录 | 127 | | mykernel-4.1.0 | linux-4.1.0的构建目录 | 128 | | kink-src | 不断开发和改进的KINK小巧内核, 开发完成后, 将导入到内核构建目录的src中参与构建 | 129 | | mykernel.sh | 早期的构建脚本, 已经废弃, 现在已经使用makefile来完成自动化构建, 但是脚本myel.sh仍可以给我们基本的构建思路 | 130 | | doc | 操作系统的文档信息 | 131 | | doc/os2013 | [2013年暑期补课计算机操作系统原理](https://github.com/mengning/mykernel/wiki/OS2013) | 132 | | README.md | 帮助文档 | 133 | 134 | ##2.3 构建目录结构 135 | ------- 136 | 137 | mykernel-3.9.4是linux-3.9.4的构建目录 138 | 139 | mykernel-4.1.0是linux-4.1.0的构建目录 140 | 141 | 142 | 首先来看下mykernel-x.x的目录结构 143 | 144 | | 目录 | 描述 | 145 | |:-------:|:-------:| 146 | | downloads | 内核源代码的下载目录 | 147 | | kernel | 内核源代码将被解压到kernel目录 | 148 | | patches | 我们自己kernel的补丁 | 149 | | configs | 内核源代码的.config文件, 但是我们编译linux-3.9.4内核的时候并未使用, 而是在集结make allnoconfig | 150 | | src | 我们内核的基本框架, 它并没有patch到内核中, 内核源代码树中的mysrc目录直接链接到了源码src中 | 151 | | Makefile | 用于构建的Makefile | 152 | | README.md | 文档信息 | 153 | 154 | #2.4 makefile构建过程 155 | ------- 156 | 157 | 158 | 在构建的过程中会产生几个构建隐藏目录.stamps和.out 159 | 160 | 其中.stamps为我们的构建完成准备工作 161 | 162 | | .stamps子目录 | 描述 | 163 | |:-------:|:-------:| 164 | | downloads | 用于make完成linux内核源码的下载, 内核源码下载完成后, 此文件时间戳将被更新(create/touch) | 165 | | extract | 内核源代码下载完成后, 由extract完成内核源代码的解压缩, 将解压缩两个副本(linux-x.x.src和linux-x.x.new), 其中src是最原始的源码, 用于生成新的patch时候使用, new是我们的工作源码目录, 其中包含了一个指向了kernel源码src的链接文件mysrc | 166 | | patch | extract完成了解压缩之后, 交由patch来完成内核补丁的添加, 完成后更新patch的时间戳(以供makefile完成依赖检查) | 167 | | config | 最后config完成了内核.config的配置 | 168 | 169 | 170 | 171 | 172 | 173 | 174 | #2.5 总结 175 | ------- 176 | 177 | 178 | **不用makefile如何一步一步构建内核** 179 | 180 | 181 | makefile的执行过程其实相当于执行了如下命令 182 | 183 | 以内核linux-4.1为例, 其中与linux-3.9内核有差别的地方我们会单独列出 184 | 185 | 186 | **首先安装qemu** 187 | ```c 188 | sudo apt-get install qemu # install QEMU 189 | ``` 190 | 191 | ``` 192 | sudo ln -s /usr/bin/qemu-system-i386 /usr/bin/qemu 193 | ``` 194 | 195 | 或者 196 | ``` 197 | sudo ln -s /usr/bin/qemu-system-x86_64 /usr/bin/qemu 198 | ``` 199 | 200 | **下载内核源码** download Linux Kernel 4.1 source code, 源代码被下载到downloads目录下 201 | 202 | ```c 203 | cd downloads 204 | wget https://www.kernel.org/pub/linux/kernel/v4.x/linux-4.1.tar.xz 205 | ``` 206 | 207 | **解压缩内核源码**, 会将内核源代码解压缩到kernel目录下 208 | ``` 209 | 210 | cd download 211 | xz -d linux-4.1.tar.xz 212 | tar -Jxvf linux-4.1.tar -C ../kernel #被解压缩kernel/linux-4.1目录下 213 | ``` 214 | 215 | **配置内核源代码目录**, 配置出linux-4.1.new和linux-4.1.src两个目录 216 | 217 | ```c 218 | cd ../kernel 219 | cp linux-4.1 linux-4.1.src 220 | mv linux.4.1 linux-4.1.new 221 | ``` 222 | 223 | **patch内核**, 用我们的start_kernel替代linux原本的start_kernel, 以完成我们自己的内核平台 224 | 225 | ```c 226 | cd linux-4.1-new 227 | patch -p1 < ../../patches/linux-4_1-mykernel.patch 228 | ``` 229 | 230 | **link我们的src目录**, 我们需要构建的是内核源码树linux-4.1.new目录, 而我们的内核kernel在src中, 因此将src连接到内核源码的mysrc, 这样我们在src中直接修改代码, 直接make即可 231 | 232 | ```c 233 | cd linux-4.1-new 234 | ln -s ../../src mysrc 235 | ``` 236 | 其中连接link和删除链接rmlink的工作可以直接交给make link/rmlink来完成, 具体请见makefile 237 | 238 | 239 | **构建内核在目录.out中完成**, 需要构建的是内核源码树linux-4.1.new目录 240 | 241 | 我们为了保证内核源码树的清洁, 构建不再源码树中完成, 而是在.out隐藏目录完成此工作, 因此我们先创建此目录 242 | ```c 243 | cd ../.. 244 | mkdir -p .out 245 | ``` 246 | 247 | **配置内核的BUILD构建配置文件.config** 248 | 249 | 250 | linux-4.1需要拷贝.config 251 | ```c 252 | cp configs/mini-x86.config .out/config 253 | ``` 254 | 如果是linux-3.9.4, 我们不使用配置好的.config而是使用默认配置, 则执行如下操作 255 | 256 | ```c 257 | make allnoconfig 258 | ``` 259 | 260 | **构建内核**, 使用O=$(pwd)/../../.out将构建任务指定到.out目录下 261 | 262 | ```c 263 | cd kernel/linux-4.1.0.new 264 | make O=$(pwd)/../../.out 265 | ``` 266 | 267 | **运行操作系统**, 可以使用make run直接运行, 其本质上是执行了如下命令 268 | 269 | ```c 270 | qemu -kernel .out/arch/x86/boot/bzImage 271 | ``` 272 | 273 | 从qemu窗口中您可以看到my_start_kernel在执行,同时my_timer_handler时钟中断处理程序周期性执行。 274 | 275 | 276 | 277 | 278 | 279 | #3 运行KINK操作系统 280 | ------ 281 | 282 | **运行操作系统**, 可以使用 283 | 284 | ```c 285 | make run 286 | ``` 287 | 288 | 直接运行, 其本质上是执行了如下命令 289 | 290 | ```c 291 | qemu -kernel .out/arch/x86/boot/bzImage 292 | ``` 293 | 294 | 295 | linux3.9.4的运行情况 296 | 297 | ![linux-3.9.4](doc/images/linux-3.9.4.png) 298 | 299 | linux4.1.0的运行情况 300 | 301 | ![linux-3.9.4](doc/images/linux-4.1.0.png) 302 | 303 | 304 | #4 如何生成/添加patch 305 | ------- 306 | 307 | 308 | 首先我们先删除mysrc的工作目录, 当然你也可以选择不删除, 这样的话我们自己kernel的源码也会集成到patch中, 而多数情况下, 我们希望生成的是一个纯净的patch, 一个可以被被人拿来直接穿件自己kernel的patch. 309 | 310 | 311 | 使用diff对比两个new和src两个构建目录的异同, 即可生成一个patch 312 | 313 | ```c 314 | diff -Naur linux-4.1.src linux-4.1.new/ >linux-4.1-mykernel.patch 315 | ``` 316 | 也可以直接使用make genpatch直接生成patch 317 | 318 | 将patch添加到内核中可以直接使用 319 | 320 | ```c 321 | patch -p1 < ../../patches/linux-4_1-mykernel.patch 322 | ``` 323 | 324 | 也可以使用make patch直接添加patch 325 | 326 | 327 | #5 改进自己的KINK内核 328 | ------- 329 | 330 | 我们在根目录的kink-src目录中不断完善自己的内核, 然后将内核拷贝到mykernel-x.x.x的src文件中, 执行make操作即可参与构建 331 | 332 | ##5.1 为什么使用3.9.4和4.1.0两个内核 333 | 334 | 其实完全可以使用一个内核, 但是, 基于一下几点, 我们保留了对个内核. 335 | 336 | * 我们的项目是在[jserv/kernel-in-kernel](https://github.com/jserv/kernel-in-kernel)(基于linux-4.1.0)和[mengning/mykernel](https://github.com/mengning/mykernel)(基于linux-3.9.4)的基础上整合在一起的, 而后者也是在前者的基础上改进的, 这些都是原作者的劳动成果, 我们应该给予尊重 337 | . 338 | * 该项目的本质是希望通过一个模拟的内核机制来实现我们自定义的进程调度机制或者其他内核机制, 因此在多个版本的内核中同时编译运行, 不同的内核中采用不同的机制或者不同的参数, 利于我们开发改进 339 | 340 | 341 | * 我们的KINK在不断的完善, 给出两个或者多个分支版本, 即可以方便我们对比进度和完善的情况, 也利于我们分析其在不同内核中的运行情况. 342 | 343 | * 由于linux内核在不断更新, 我们不排除后期仍然会增加其他的内核版本, 甚至可能添加一些早期版本比如2.x 344 | 345 | 346 | 347 | 348 | ##5.2 如何编写自己的内核 349 | ------- 350 | 351 | 你可以直接在mykernel-x.x.x的src目录中直接修改KINK内核代码, 由于该目录被链接到了build目录kernel/linux-x.x.x.new/mysrc中, 因为我们该文件的修改将在build过程中直接更新的内核linux内核和KINK中 352 | 353 | 但是我们也提供了根的kink-src目录来开发, 这个目录可以做为KINK-src的存档目录. 354 | 355 | 即进行KINK开发, 你可以 356 | 357 | * 在mykernel-x.x.x的src目录修改, 并直接编译, 一些重要的版本可以备份到kink-src目录 358 | 359 | OR 360 | 361 | * 将kink-src作为工作目录, 在完成后, 将源码拷贝到对应内核版本的mykernel-x.x.x的src目录中, 然后执行make build操作 362 | 363 | OR 364 | 365 | * 我们说过了linux-kernel内核源代码的mysrc是一个指向了src的链接目录, 如果你觉得每次拷贝麻烦, 你甚至可以直接将mysrc连接到kink-src目录, 这样就不同每次拷贝了. 366 | 367 | 368 | kink-src中源码, 以及mysrc, src的源码结构如下 369 | 370 | 371 | | 文件 | 描述 | 372 | |:-------:|:-------:| 373 | | pcb.h | 进程的基本信息PCB结构 | 374 | | interrupt.c | 周期性中断处理, 其功能类似与周期性调度器 | 375 | | scheduler.c | 主调度器, 如果需要更改调度机制, 主要是更改此目录 | 376 | | main.c | KINK-kernel的主函数 | 377 | | Makefile | 构建内核源码需要的makefile | 378 | 379 | 380 | #6 Comments 381 | ------- 382 | 383 | * KernelInKernel一个短小精悍的模拟内核,在Linux内核的基础山已补丁patch的方式实现, 通过屏蔽掉linux内核的启动函数, 实现自己的start_kernel来启动一个小巧的操作系统 384 | 385 | * 本系统在[jserv/kernel-in-kernel](https://github.com/jserv/kernel-in-kernel)(基于linux-4.1.0)和[mengning/mykernel](https://github.com/mengning/mykernel)(基于linux-3.9.4)的基础上实现, 将两者整合在一起, 借鉴了前者的makefile机制和后者的调度器. 386 | 387 | 388 | #7 Links 389 | ------- 390 | * [Linux进程管理与调度-之-目录导航](http://blog.csdn.net/gatieme/article/details/51456569) 391 | 392 | * [Linux内核分析期末总结](http://blog.csdn.net/pianogirl123/article/details/51287024) 393 | 394 | 395 | * [2013年暑期补课计算机操作系统原理](https://github.com/mengning/mykernel/wiki/OS2013) 396 | 397 | -------------------------------------------------------------------------------- /doc/INSTALL.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gatieme/KernelInKernel/fb20116a2b7fdd90493eb8f1aaf33a61c4e2e2b2/doc/INSTALL.docx -------------------------------------------------------------------------------- /doc/Visio/PCB.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gatieme/KernelInKernel/fb20116a2b7fdd90493eb8f1aaf33a61c4e2e2b2/doc/Visio/PCB.jpg -------------------------------------------------------------------------------- /doc/Visio/PCB.vsdx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gatieme/KernelInKernel/fb20116a2b7fdd90493eb8f1aaf33a61c4e2e2b2/doc/Visio/PCB.vsdx -------------------------------------------------------------------------------- /doc/Visio/stack1-0.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gatieme/KernelInKernel/fb20116a2b7fdd90493eb8f1aaf33a61c4e2e2b2/doc/Visio/stack1-0.jpg -------------------------------------------------------------------------------- /doc/Visio/stack1-0.vsdx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gatieme/KernelInKernel/fb20116a2b7fdd90493eb8f1aaf33a61c4e2e2b2/doc/Visio/stack1-0.vsdx -------------------------------------------------------------------------------- /doc/Visio/stack1-1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gatieme/KernelInKernel/fb20116a2b7fdd90493eb8f1aaf33a61c4e2e2b2/doc/Visio/stack1-1.jpg -------------------------------------------------------------------------------- /doc/Visio/stack1-1.vsdx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gatieme/KernelInKernel/fb20116a2b7fdd90493eb8f1aaf33a61c4e2e2b2/doc/Visio/stack1-1.vsdx -------------------------------------------------------------------------------- /doc/Visio/stack1-2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gatieme/KernelInKernel/fb20116a2b7fdd90493eb8f1aaf33a61c4e2e2b2/doc/Visio/stack1-2.jpg -------------------------------------------------------------------------------- /doc/Visio/stack1-2.vsdx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gatieme/KernelInKernel/fb20116a2b7fdd90493eb8f1aaf33a61c4e2e2b2/doc/Visio/stack1-2.vsdx -------------------------------------------------------------------------------- /doc/Visio/stack1-3.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gatieme/KernelInKernel/fb20116a2b7fdd90493eb8f1aaf33a61c4e2e2b2/doc/Visio/stack1-3.jpg -------------------------------------------------------------------------------- /doc/Visio/stack1-3.vsdx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gatieme/KernelInKernel/fb20116a2b7fdd90493eb8f1aaf33a61c4e2e2b2/doc/Visio/stack1-3.vsdx -------------------------------------------------------------------------------- /doc/Visio/stack1-4.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gatieme/KernelInKernel/fb20116a2b7fdd90493eb8f1aaf33a61c4e2e2b2/doc/Visio/stack1-4.jpg -------------------------------------------------------------------------------- /doc/Visio/stack1-4.vsdx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gatieme/KernelInKernel/fb20116a2b7fdd90493eb8f1aaf33a61c4e2e2b2/doc/Visio/stack1-4.vsdx -------------------------------------------------------------------------------- /doc/Visio/stack1-5.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gatieme/KernelInKernel/fb20116a2b7fdd90493eb8f1aaf33a61c4e2e2b2/doc/Visio/stack1-5.jpg -------------------------------------------------------------------------------- /doc/Visio/stack1-5.vsdx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gatieme/KernelInKernel/fb20116a2b7fdd90493eb8f1aaf33a61c4e2e2b2/doc/Visio/stack1-5.vsdx -------------------------------------------------------------------------------- /doc/Visio/stack2-0.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gatieme/KernelInKernel/fb20116a2b7fdd90493eb8f1aaf33a61c4e2e2b2/doc/Visio/stack2-0.jpg -------------------------------------------------------------------------------- /doc/Visio/stack2-0.vsdx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gatieme/KernelInKernel/fb20116a2b7fdd90493eb8f1aaf33a61c4e2e2b2/doc/Visio/stack2-0.vsdx -------------------------------------------------------------------------------- /doc/Visio/stack2-1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gatieme/KernelInKernel/fb20116a2b7fdd90493eb8f1aaf33a61c4e2e2b2/doc/Visio/stack2-1.jpg -------------------------------------------------------------------------------- /doc/Visio/stack2-1.vsdx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gatieme/KernelInKernel/fb20116a2b7fdd90493eb8f1aaf33a61c4e2e2b2/doc/Visio/stack2-1.vsdx -------------------------------------------------------------------------------- /doc/Visio/stack2-2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gatieme/KernelInKernel/fb20116a2b7fdd90493eb8f1aaf33a61c4e2e2b2/doc/Visio/stack2-2.jpg -------------------------------------------------------------------------------- /doc/Visio/stack2-2.vsdx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gatieme/KernelInKernel/fb20116a2b7fdd90493eb8f1aaf33a61c4e2e2b2/doc/Visio/stack2-2.vsdx -------------------------------------------------------------------------------- /doc/Visio/stack2-3.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gatieme/KernelInKernel/fb20116a2b7fdd90493eb8f1aaf33a61c4e2e2b2/doc/Visio/stack2-3.jpg -------------------------------------------------------------------------------- /doc/Visio/stack2-3.vsdx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gatieme/KernelInKernel/fb20116a2b7fdd90493eb8f1aaf33a61c4e2e2b2/doc/Visio/stack2-3.vsdx -------------------------------------------------------------------------------- /doc/Visio/stack2-4.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gatieme/KernelInKernel/fb20116a2b7fdd90493eb8f1aaf33a61c4e2e2b2/doc/Visio/stack2-4.jpg -------------------------------------------------------------------------------- /doc/Visio/stack2-4.vsdx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gatieme/KernelInKernel/fb20116a2b7fdd90493eb8f1aaf33a61c4e2e2b2/doc/Visio/stack2-4.vsdx -------------------------------------------------------------------------------- /doc/Visio/stack2-5.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gatieme/KernelInKernel/fb20116a2b7fdd90493eb8f1aaf33a61c4e2e2b2/doc/Visio/stack2-5.jpg -------------------------------------------------------------------------------- /doc/Visio/stack2-5.vsdx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gatieme/KernelInKernel/fb20116a2b7fdd90493eb8f1aaf33a61c4e2e2b2/doc/Visio/stack2-5.vsdx -------------------------------------------------------------------------------- /doc/Visio/stack3-0.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gatieme/KernelInKernel/fb20116a2b7fdd90493eb8f1aaf33a61c4e2e2b2/doc/Visio/stack3-0.jpg -------------------------------------------------------------------------------- /doc/Visio/stack3-0.vsdx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gatieme/KernelInKernel/fb20116a2b7fdd90493eb8f1aaf33a61c4e2e2b2/doc/Visio/stack3-0.vsdx -------------------------------------------------------------------------------- /doc/Visio/stack3-1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gatieme/KernelInKernel/fb20116a2b7fdd90493eb8f1aaf33a61c4e2e2b2/doc/Visio/stack3-1.jpg -------------------------------------------------------------------------------- /doc/Visio/stack3-1.vsdx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gatieme/KernelInKernel/fb20116a2b7fdd90493eb8f1aaf33a61c4e2e2b2/doc/Visio/stack3-1.vsdx -------------------------------------------------------------------------------- /doc/Visio/stack3-2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gatieme/KernelInKernel/fb20116a2b7fdd90493eb8f1aaf33a61c4e2e2b2/doc/Visio/stack3-2.jpg -------------------------------------------------------------------------------- /doc/Visio/stack3-2.vsdx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gatieme/KernelInKernel/fb20116a2b7fdd90493eb8f1aaf33a61c4e2e2b2/doc/Visio/stack3-2.vsdx -------------------------------------------------------------------------------- /doc/Visio/stack3-3.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gatieme/KernelInKernel/fb20116a2b7fdd90493eb8f1aaf33a61c4e2e2b2/doc/Visio/stack3-3.jpg -------------------------------------------------------------------------------- /doc/Visio/stack3-3.vsdx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gatieme/KernelInKernel/fb20116a2b7fdd90493eb8f1aaf33a61c4e2e2b2/doc/Visio/stack3-3.vsdx -------------------------------------------------------------------------------- /doc/Visio/stack3-4.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gatieme/KernelInKernel/fb20116a2b7fdd90493eb8f1aaf33a61c4e2e2b2/doc/Visio/stack3-4.jpg -------------------------------------------------------------------------------- /doc/Visio/stack3-4.vsdx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gatieme/KernelInKernel/fb20116a2b7fdd90493eb8f1aaf33a61c4e2e2b2/doc/Visio/stack3-4.vsdx -------------------------------------------------------------------------------- /doc/Visio/stack3-5.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gatieme/KernelInKernel/fb20116a2b7fdd90493eb8f1aaf33a61c4e2e2b2/doc/Visio/stack3-5.jpg -------------------------------------------------------------------------------- /doc/Visio/stack3-5.vsdx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gatieme/KernelInKernel/fb20116a2b7fdd90493eb8f1aaf33a61c4e2e2b2/doc/Visio/stack3-5.vsdx -------------------------------------------------------------------------------- /doc/Visio/stack3-6.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gatieme/KernelInKernel/fb20116a2b7fdd90493eb8f1aaf33a61c4e2e2b2/doc/Visio/stack3-6.jpg -------------------------------------------------------------------------------- /doc/Visio/stack3-6.vsdx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gatieme/KernelInKernel/fb20116a2b7fdd90493eb8f1aaf33a61c4e2e2b2/doc/Visio/stack3-6.vsdx -------------------------------------------------------------------------------- /doc/Visio/task0.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gatieme/KernelInKernel/fb20116a2b7fdd90493eb8f1aaf33a61c4e2e2b2/doc/Visio/task0.jpg -------------------------------------------------------------------------------- /doc/Visio/task0.vsdx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gatieme/KernelInKernel/fb20116a2b7fdd90493eb8f1aaf33a61c4e2e2b2/doc/Visio/task0.vsdx -------------------------------------------------------------------------------- /doc/Visio/循环链表.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gatieme/KernelInKernel/fb20116a2b7fdd90493eb8f1aaf33a61c4e2e2b2/doc/Visio/循环链表.jpg -------------------------------------------------------------------------------- /doc/Visio/循环链表.vsdx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gatieme/KernelInKernel/fb20116a2b7fdd90493eb8f1aaf33a61c4e2e2b2/doc/Visio/循环链表.vsdx -------------------------------------------------------------------------------- /doc/Visio/循环链表1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gatieme/KernelInKernel/fb20116a2b7fdd90493eb8f1aaf33a61c4e2e2b2/doc/Visio/循环链表1.jpg -------------------------------------------------------------------------------- /doc/Visio/循环链表1.vsdx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gatieme/KernelInKernel/fb20116a2b7fdd90493eb8f1aaf33a61c4e2e2b2/doc/Visio/循环链表1.vsdx -------------------------------------------------------------------------------- /doc/Visio/循环链表2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gatieme/KernelInKernel/fb20116a2b7fdd90493eb8f1aaf33a61c4e2e2b2/doc/Visio/循环链表2.jpg -------------------------------------------------------------------------------- /doc/Visio/循环链表2.vsdx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gatieme/KernelInKernel/fb20116a2b7fdd90493eb8f1aaf33a61c4e2e2b2/doc/Visio/循环链表2.vsdx -------------------------------------------------------------------------------- /doc/Visio/循环链表3.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gatieme/KernelInKernel/fb20116a2b7fdd90493eb8f1aaf33a61c4e2e2b2/doc/Visio/循环链表3.jpg -------------------------------------------------------------------------------- /doc/Visio/循环链表3.vsdx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gatieme/KernelInKernel/fb20116a2b7fdd90493eb8f1aaf33a61c4e2e2b2/doc/Visio/循环链表3.vsdx -------------------------------------------------------------------------------- /doc/images/linux-3.9.4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gatieme/KernelInKernel/fb20116a2b7fdd90493eb8f1aaf33a61c4e2e2b2/doc/images/linux-3.9.4.png -------------------------------------------------------------------------------- /doc/images/linux-4.1.0.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gatieme/KernelInKernel/fb20116a2b7fdd90493eb8f1aaf33a61c4e2e2b2/doc/images/linux-4.1.0.png -------------------------------------------------------------------------------- /doc/mykernel.ppt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gatieme/KernelInKernel/fb20116a2b7fdd90493eb8f1aaf33a61c4e2e2b2/doc/mykernel.ppt -------------------------------------------------------------------------------- /doc/os2013/CoursePlan2013.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gatieme/KernelInKernel/fb20116a2b7fdd90493eb8f1aaf33a61c4e2e2b2/doc/os2013/CoursePlan2013.pdf -------------------------------------------------------------------------------- /doc/os2013/HowtheComputerWorks-1.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gatieme/KernelInKernel/fb20116a2b7fdd90493eb8f1aaf33a61c4e2e2b2/doc/os2013/HowtheComputerWorks-1.pdf -------------------------------------------------------------------------------- /doc/os2013/HowtheComputerWorks-2.ppt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gatieme/KernelInKernel/fb20116a2b7fdd90493eb8f1aaf33a61c4e2e2b2/doc/os2013/HowtheComputerWorks-2.ppt -------------------------------------------------------------------------------- /doc/os2013/LinuxArchitectureAndSystemExecution.ppt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gatieme/KernelInKernel/fb20116a2b7fdd90493eb8f1aaf33a61c4e2e2b2/doc/os2013/LinuxArchitectureAndSystemExecution.ppt -------------------------------------------------------------------------------- /doc/os2013/LinuxC.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gatieme/KernelInKernel/fb20116a2b7fdd90493eb8f1aaf33a61c4e2e2b2/doc/os2013/LinuxC.pdf -------------------------------------------------------------------------------- /doc/os2013/Linux_Get_Started_SOP_V1.1.0_20120806.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gatieme/KernelInKernel/fb20116a2b7fdd90493eb8f1aaf33a61c4e2e2b2/doc/os2013/Linux_Get_Started_SOP_V1.1.0_20120806.pdf -------------------------------------------------------------------------------- /doc/os2013/example_asm.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int z = 0; 4 | int x = 8; 5 | int y = 8; 6 | 7 | int main() 8 | { 9 | printf("x:%d,y:%d\n",x,y); 10 | /* simu z = add(x,y); */ 11 | asm volatile( 12 | /* simu call */ 13 | "pushl %1\n\t" 14 | "pushl %2\n\t" 15 | "pushl $0\n\t" 16 | /* simu add functon */ 17 | "pushl %%ebp\n\t" 18 | "movl %%esp,%%ebp\n\t" 19 | "movl $0,%%eax\n\t" 20 | "addl 12(%%ebp),%%eax\n\t" 21 | "addl 8(%%ebp),%%eax\n\t" 22 | "movl %%ebp,%%esp\n\t" 23 | "popl %%ebp\n\t" 24 | /* add functon end */ 25 | "movl %%eax,%0\n\t" 26 | :"=m"(z) 27 | : "m" (x),"m" (y) 28 | ); 29 | printf("z:%d\n",z); 30 | return 0; 31 | } 32 | -------------------------------------------------------------------------------- /doc/os2013/example_c.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int z = 0; 4 | int x = 8; 5 | int y = 8; 6 | 7 | int add(int x,int y) 8 | { 9 | return x + y; 10 | } 11 | 12 | int main() 13 | { 14 | printf("x:%d,y:%d\n",x,y); 15 | z = add(x,y); 16 | printf("z:%d\n",z); 17 | return 0; 18 | } 19 | -------------------------------------------------------------------------------- /doc/os2013/lab3-shell.ppt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gatieme/KernelInKernel/fb20116a2b7fdd90493eb8f1aaf33a61c4e2e2b2/doc/os2013/lab3-shell.ppt -------------------------------------------------------------------------------- /doc/os2013/lab3.rar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gatieme/KernelInKernel/fb20116a2b7fdd90493eb8f1aaf33a61c4e2e2b2/doc/os2013/lab3.rar -------------------------------------------------------------------------------- /doc/os2013/lab4.ppt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gatieme/KernelInKernel/fb20116a2b7fdd90493eb8f1aaf33a61c4e2e2b2/doc/os2013/lab4.ppt -------------------------------------------------------------------------------- /doc/os2013/lab5.ppt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gatieme/KernelInKernel/fb20116a2b7fdd90493eb8f1aaf33a61c4e2e2b2/doc/os2013/lab5.ppt -------------------------------------------------------------------------------- /doc/os2013/lab6.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gatieme/KernelInKernel/fb20116a2b7fdd90493eb8f1aaf33a61c4e2e2b2/doc/os2013/lab6.pdf -------------------------------------------------------------------------------- /doc/os2013/lab6.rar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gatieme/KernelInKernel/fb20116a2b7fdd90493eb8f1aaf33a61c4e2e2b2/doc/os2013/lab6.rar -------------------------------------------------------------------------------- /doc/os2013/lab7.ppt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gatieme/KernelInKernel/fb20116a2b7fdd90493eb8f1aaf33a61c4e2e2b2/doc/os2013/lab7.ppt -------------------------------------------------------------------------------- /doc/os2013/lab7.rar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gatieme/KernelInKernel/fb20116a2b7fdd90493eb8f1aaf33a61c4e2e2b2/doc/os2013/lab7.rar -------------------------------------------------------------------------------- /doc/os2013/mykernel_release_1.rar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gatieme/KernelInKernel/fb20116a2b7fdd90493eb8f1aaf33a61c4e2e2b2/doc/os2013/mykernel_release_1.rar -------------------------------------------------------------------------------- /doc/os2013/mykernel_release_2.rar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gatieme/KernelInKernel/fb20116a2b7fdd90493eb8f1aaf33a61c4e2e2b2/doc/os2013/mykernel_release_2.rar -------------------------------------------------------------------------------- /kink-src/kink-0.0.1/Makefile: -------------------------------------------------------------------------------- 1 | # used by Linux kernel 2 | obj-y = interrupt.o scheduler.o main.o 3 | -------------------------------------------------------------------------------- /kink-src/kink-0.0.1/interrupt.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #include "pcb.h" 4 | 5 | extern myPCB task[MAX_TASK_NUM], *my_current_task; 6 | extern volatile int my_need_sched; 7 | volatile int time_count = 0; 8 | 9 | /* 10 | * Called by timer interrupt. 11 | * it runs in the name of current running process, 12 | * so it use kernel stack of current running process 13 | */ 14 | void my_timer_handler(void) 15 | { 16 | if (time_count % 1000 == 0 && my_need_sched != 1) 17 | my_need_sched = 1; 18 | time_count++; 19 | } 20 | -------------------------------------------------------------------------------- /kink-src/kink-0.0.1/main.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #include "pcb.h" 4 | 5 | myPCB task[MAX_TASK_NUM], *my_current_task = NULL; 6 | volatile int my_need_sched = 0; 7 | 8 | static void my_process(void); 9 | 10 | void __init my_start_kernel(void) 11 | { 12 | int pid = 0; 13 | int i; 14 | 15 | /* Initialize process 0 */ 16 | task[pid].pid = pid; 17 | task[pid].state = S_runnable; 18 | task[pid].task_entry = task[pid].thread.ip = (uintptr_t) my_process; 19 | task[pid].thread.sp = 20 | (uintptr_t) &task[pid].stack[KERNEL_STACK_SIZE - 1]; 21 | task[pid].next = &task[pid]; 22 | 23 | /* fork more process */ 24 | for (i = 1; i < MAX_TASK_NUM; i++) { 25 | memcpy(&task[i], &task[0], sizeof(myPCB)); 26 | task[i].pid = i; 27 | task[i].state = S_stopped; 28 | task[i].thread.sp = 29 | (uintptr_t) &task[i].stack[KERNEL_STACK_SIZE - 1]; 30 | task[i].next = task[i-1].next; 31 | task[i-1].next = &task[i]; 32 | } 33 | 34 | /* start process 0 by task[0] */ 35 | pid = 0; 36 | my_current_task = &task[pid]; 37 | asm volatile( 38 | "movl %0, %%esp\n\t" /* set task[pid].thread.sp to esp */ 39 | "jmp my_process\n" 40 | : 41 | : "c" (task[pid].thread.sp) /* input c mean /%edx */ 42 | ); 43 | } 44 | 45 | static void my_process(void) 46 | { 47 | unsigned long i = 0; 48 | while (1) 49 | { 50 | if (i++ % 10000000) 51 | continue; 52 | 53 | //printk(KERN_NOTICE "this is process %d - =WangPanPan(Soleprincess)=\n", 54 | // my_current_task->pid); 55 | 56 | if (my_need_sched == 1) 57 | { 58 | printk(KERN_NOTICE "process %d schedule\n", my_current_task->pid); 59 | my_need_sched = 0; 60 | my_schedule(); 61 | printk(KERN_NOTICE "process %d re-schedule\n", my_current_task->pid); 62 | } 63 | 64 | //printk(KERN_NOTICE "this is process %d + =ChengJian(Gatieme)=\n", 65 | // my_current_task->pid); 66 | } 67 | } 68 | -------------------------------------------------------------------------------- /kink-src/kink-0.0.1/pcb.h: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #define MAX_TASK_NUM 4 4 | #define KERNEL_STACK_SIZE (1024 * 8) 5 | 6 | /* CPU-specific state of this task */ 7 | struct myThread { 8 | uintptr_t ip; 9 | uintptr_t sp; 10 | }; 11 | 12 | enum myState { S_unrunnable = -1, S_runnable = 0, S_stopped = 1 }; 13 | typedef struct _myPCB { 14 | int pid; 15 | volatile enum myState state; 16 | char stack[KERNEL_STACK_SIZE]; 17 | /* CPU-specific state of this task */ 18 | struct myThread thread; 19 | uintptr_t task_entry; 20 | struct _myPCB *next; 21 | } myPCB; 22 | 23 | void my_schedule(void); 24 | -------------------------------------------------------------------------------- /kink-src/kink-0.0.1/scheduler.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #include "pcb.h" 4 | 5 | extern myPCB task[MAX_TASK_NUM], *my_current_task; 6 | extern volatile int my_need_sched; 7 | 8 | 9 | void my_schedule(void) 10 | { 11 | myPCB *next, *prev; 12 | 13 | if (my_current_task == NULL 14 | || my_current_task->next == NULL) 15 | { 16 | printk(KERN_NOTICE " time out!!!,but no more than 2 task,need not schedule\n"); 17 | return; 18 | } 19 | printk(KERN_NOTICE ">>> %s <<<\n", __func__); 20 | /* schedule */ 21 | next = my_current_task->next; 22 | prev = my_current_task; 23 | if (next->state == S_runnable) { 24 | my_current_task = next; 25 | printk(KERN_NOTICE ">>>switch from %d to %d<<<\n", 26 | prev->pid, next->pid); 27 | /* switch to next process */ 28 | asm volatile( 29 | "movl %%esp, %0\n\t" /* save esp */ 30 | "movl %2, %%esp\n\t" /* restore esp */ 31 | "movl $1f, %1\n\t" /* save eip */ 32 | "jmp *%3\n" 33 | "1:\t" /* next process start here */ 34 | : "=m" (prev->thread.sp), "=m" (prev->thread.ip) 35 | : "m" (next->thread.sp), "m" (next->thread.ip) 36 | ); 37 | } else { 38 | next->state = S_runnable; 39 | my_current_task = next; 40 | printk(KERN_NOTICE ">>>switch to new process %d<<<\n", 41 | next->pid); 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /kink-src/kink-0.0.2/Makefile: -------------------------------------------------------------------------------- 1 | # 2 | # Makefile for the linux mykernel. 3 | # 4 | 5 | obj-y = interrupt.o scheduler.o main.o 6 | 7 | -------------------------------------------------------------------------------- /kink-src/kink-0.0.2/README.md: -------------------------------------------------------------------------------- 1 | # Welcome to the mykernel 1.1 2 | 3 | 增加了优先级调度方式 -------------------------------------------------------------------------------- /kink-src/kink-0.0.2/interrupt.c: -------------------------------------------------------------------------------- 1 | /* mykernel--Simple simulation of the linux OS process schedule 2 | * 3 | * linux/mykernel/myinterrupt.c 4 | * 5 | * Kernel internal my_timer_handler 6 | * 7 | * Copyright (C) 2013 Mengning 8 | * 9 | * Modified 2014 zhyq 10 | * 11 | * 12 | * You can redistribute or modify this program under the terms 13 | * of the GNU General Public License as published by 14 | * the Free Software Foundation. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with this program. If not, see . 18 | */ 19 | 20 | #include 21 | #include 22 | #include 23 | #include 24 | #include 25 | #include 26 | #include 27 | #include 28 | #include 29 | #include 30 | #include 31 | #include 32 | #include 33 | #include 34 | #include 35 | #include 36 | #include 37 | #include 38 | #include 39 | #include 40 | #include 41 | #include 42 | 43 | #include 44 | #include 45 | #include 46 | #include 47 | #include 48 | 49 | #include 50 | #include 51 | #include 52 | #include 53 | #include 54 | 55 | #include "pcb.h" 56 | 57 | #define CREATE_TRACE_POINTS 58 | #include 59 | 60 | extern tPCB task[MAX_TASK_NUM]; 61 | extern tPCB * my_current_task; 62 | extern volatile int my_need_sched; 63 | volatile int time_count = 0; 64 | 65 | /* 66 | * Called by timer interrupt. 67 | * it runs in the name of current running process, 68 | * so it use kernel stack of current running process 69 | */ 70 | void my_timer_handler(void) 71 | { 72 | #if 1 73 | // make sure need schedule after system circle 2000 times. 74 | if(time_count%2000 == 0 && my_need_sched != 1) 75 | { 76 | my_need_sched = 1; 77 | //time_count=0; 78 | } 79 | time_count ++ ; 80 | #endif 81 | return; 82 | } 83 | 84 | -------------------------------------------------------------------------------- /kink-src/kink-0.0.2/main.c: -------------------------------------------------------------------------------- 1 | /* mykernel--Simple simulation of the linux OS process schedule 2 | * 3 | * linux/mykernel/mymain.c 4 | * 5 | * Kernel internal my_timer_handler 6 | * 7 | * Copyright (C) 2013 Mengning 8 | * 9 | * Modified zhyq 10 | * 11 | * 12 | * You can redistribute or modify this program under the terms 13 | * of the GNU General Public License as published by 14 | * the Free Software Foundation. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with this program. If not, see . 18 | */ 19 | 20 | 21 | #include 22 | #include 23 | #include 24 | #include 25 | #include 26 | #include 27 | #include 28 | #include 29 | #include 30 | #include 31 | #include 32 | #include 33 | #include 34 | #include 35 | #include 36 | #include 37 | #include 38 | #include 39 | #include 40 | #include 41 | #include 42 | #include 43 | #include 44 | #include 45 | #include 46 | #include 47 | #include 48 | #include 49 | #include 50 | #include 51 | #include 52 | #include 53 | #include 54 | #include 55 | #include 56 | #include 57 | #include 58 | #include 59 | #include 60 | #include 61 | #include 62 | #include 63 | #include 64 | #include 65 | #include 66 | #include 67 | #include 68 | #include 69 | #include 70 | #include 71 | #include 72 | #include 73 | #include 74 | #include 75 | #include 76 | #include 77 | #include 78 | #include 79 | #include 80 | #include 81 | #include 82 | #include 83 | #include 84 | 85 | #include 86 | #include 87 | #include 88 | #include 89 | #include 90 | 91 | #include 92 | 93 | #include 94 | #include 95 | 96 | #ifdef CONFIG_X86_LOCAL_APIC 97 | #include 98 | #endif 99 | #include "pcb.h" 100 | 101 | tPCB task[MAX_TASK_NUM]; 102 | tPCB * my_current_task = NULL; 103 | volatile int my_need_sched = 0; 104 | 105 | void my_process(void); 106 | unsigned long get_rand(int ); 107 | 108 | void sand_priority(void) 109 | { 110 | int i; 111 | for(i=0;i0 stopped */ 120 | // set task 0 execute entry address to my_process 121 | task[pid].task_entry = task[pid].thread.ip = (unsigned long)my_process; 122 | task[pid].thread.sp = (unsigned long)&task[pid].stack[KERNEL_STACK_SIZE-1]; 123 | task[pid].next = &task[pid]; 124 | /*fork more process */ 125 | for(pid=1;pid>>process 0 running!!!<<<\n\n"); 135 | /* start process 0 by task[0] */ 136 | pid = 0; 137 | my_current_task = &task[pid]; 138 | asm volatile( 139 | "movl %1,%%esp\n\t" /* set task[pid].thread.sp to esp */ 140 | "pushl %1\n\t" /* push ebp */ 141 | "pushl %0\n\t" /* push task[pid].thread.ip */ 142 | "ret\n\t" /* pop task[pid].thread.ip to eip */ 143 | "popl %%ebp\n\t" 144 | : 145 | : "c" (task[pid].thread.ip),"d" (task[pid].thread.sp) /* input c or d mean %ecx/%edx*/ 146 | ); 147 | } 148 | void my_process(void) 149 | { 150 | int i = 0; 151 | while(1) 152 | { 153 | i++; 154 | if(i%10000000 == 0) 155 | { 156 | //printk(KERN_NOTICE "this is process %d - =WangPanPan(Soleprincess)=\n", 157 | // my_current_task->pid); 158 | 159 | if(my_need_sched == 1) 160 | { 161 | //printk(KERN_NOTICE "process %d schedule\n", my_current_task->pid); 162 | my_need_sched = 0; 163 | sand_priority(); 164 | my_schedule(); 165 | 166 | //printk(KERN_NOTICE "process %d re-schedule\n", my_current_task->pid); 167 | } 168 | //printk(KERN_NOTICE "this is process %d - =ChengJian(Gatieme)=\n", 169 | // my_current_task->pid); 170 | } 171 | } 172 | }//end of my_process 173 | 174 | //produce a random priority to a task 175 | unsigned long get_rand(max) 176 | { 177 | unsigned long a; 178 | unsigned long umax; 179 | umax=(unsigned long)max; 180 | get_random_bytes(&a, sizeof(unsigned long )); 181 | a=(a+umax)%umax; 182 | return a; 183 | } 184 | -------------------------------------------------------------------------------- /kink-src/kink-0.0.2/pcb.h: -------------------------------------------------------------------------------- 1 | /* mykernel--Simple simulation of the linux OS process schedule 2 | * 3 | * linux/mykernel/mypcb.h 4 | * 5 | * Kernel internal my_timer_handler 6 | * 7 | * Copyright (C) 2013 Mengning 8 | * 9 | * Modified 2014 Yunquan Zhang 10 | * 11 | * 12 | * You can redistribute or modify this program under the terms 13 | * of the GNU General Public License as published by 14 | * the Free Software Foundation. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with this program. If not, see . 18 | */ 19 | 20 | #define MAX_TASK_NUM 10 // max num of task in system 21 | #define KERNEL_STACK_SIZE 1024*8 22 | #define PRIORITY_MAX 30 //priority range from 0 to 30 23 | 24 | /* CPU-specific state of this task */ 25 | struct Thread { 26 | unsigned long ip;//point to cpu run address 27 | unsigned long sp;//point to the thread stack's top address 28 | //todo add other attrubte of system thread 29 | }; 30 | 31 | //PCB Struct 32 | typedef struct PCB{ 33 | int pid; // pcb id 34 | volatile long state; /* -1 unrunnable, 0 runnable, >0 stopped */ 35 | char stack[KERNEL_STACK_SIZE];// each pcb stack size is 1024*8 36 | /* CPU-specific state of this task */ 37 | struct Thread thread; 38 | unsigned long task_entry;//the task execute entry memory address 39 | struct PCB *next;//pcb is a circular linked list 40 | unsigned long priority;// task priority //////// 41 | //todo add other attrubte of process control block 42 | }tPCB; 43 | 44 | //void my_schedule(int pid); 45 | void my_schedule(void); 46 | -------------------------------------------------------------------------------- /kink-src/kink-0.0.2/scheduler.c: -------------------------------------------------------------------------------- 1 | /* mykernel--Simple simulation of the linux OS process schedule 2 | * 3 | * linux/mykernel/myinterrupt.c 4 | * 5 | * Kernel internal my_timer_handler 6 | * 7 | * Copyright (C) 2013 Mengning 8 | * 9 | * Modified 2014 zhyq 10 | * 11 | * 12 | * You can redistribute or modify this program under the terms 13 | * of the GNU General Public License as published by 14 | * the Free Software Foundation. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with this program. If not, see . 18 | */ 19 | 20 | #include 21 | #include 22 | #include 23 | #include 24 | #include 25 | #include 26 | #include 27 | #include 28 | #include 29 | #include 30 | #include 31 | #include 32 | #include 33 | #include 34 | #include 35 | #include 36 | #include 37 | #include 38 | #include 39 | #include 40 | #include 41 | #include 42 | 43 | #include 44 | #include 45 | #include 46 | #include 47 | #include 48 | 49 | #include 50 | #include 51 | #include 52 | #include 53 | #include 54 | 55 | #include "pcb.h" 56 | 57 | #define CREATE_TRACE_POINTS 58 | #include 59 | 60 | extern tPCB task[MAX_TASK_NUM]; 61 | extern tPCB * my_current_task; 62 | extern volatile int my_need_sched; 63 | 64 | 65 | void all_task_print(void) 66 | { 67 | int i,cnum=62;// 68 | printk(KERN_NOTICE "\n current task is:%d all task in OS are:\n",my_current_task->pid); 69 | 70 | printk(" "); 71 | for(i=0;ipriority) 95 | hig_pri=&task[i]; 96 | printk(" higst process is:%d priority is:%d\n",hig_pri->pid,hig_pri->priority); 97 | return hig_pri; 98 | 99 | }//end of priority_schedule 100 | 101 | void my_schedule(void) 102 | { 103 | tPCB * next; 104 | tPCB * prev; 105 | // if there no task running or only a task ,it shouldn't need schedule 106 | if(my_current_task == NULL 107 | || my_current_task->next == NULL) 108 | { 109 | printk(KERN_NOTICE " time out!!!,but no more than 2 task,need not schedule\n"); 110 | return; 111 | } 112 | /* schedule */ 113 | 114 | next = get_next(); 115 | prev = my_current_task; 116 | printk(KERN_NOTICE " the next task is %d priority is %u\n",next->pid,next->priority); 117 | if(next->state == 0)/* -1 unrunnable, 0 runnable, >0 stopped */ 118 | {//save current scene 119 | /* switch to next process */ 120 | asm volatile( 121 | "pushl %%ebp\n\t" /* save ebp */ 122 | "movl %%esp,%0\n\t" /* save esp */ 123 | "movl %2,%%esp\n\t" /* restore esp */ 124 | "movl $1f,%1\n\t" /* save eip */ 125 | "pushl %3\n\t" 126 | "ret\n\t" /* restore eip */ 127 | "1:\t" /* next process start here */ 128 | "popl %%ebp\n\t" 129 | : "=m" (prev->thread.sp),"=m" (prev->thread.ip) 130 | : "m" (next->thread.sp),"m" (next->thread.ip) 131 | ); 132 | my_current_task = next;//switch to the next task 133 | printk(KERN_NOTICE " switch from %d process to %d process\n >>>process %d running!!!<<<\n\n",prev->pid,next->pid,next->pid); 134 | 135 | } 136 | else 137 | { 138 | next->state = 0; 139 | my_current_task = next; 140 | printk(KERN_NOTICE " switch from %d process to %d process\n >>>process %d running!!!<<<\n\n\n",prev->pid,next->pid,next->pid); 141 | 142 | /* switch to new process */ 143 | asm volatile( 144 | "pushl %%ebp\n\t" /* save ebp */ 145 | "movl %%esp,%0\n\t" /* save esp */ 146 | "movl %2,%%esp\n\t" /* restore esp */ 147 | "movl %2,%%ebp\n\t" /* restore ebp */ 148 | "movl $1f,%1\n\t" /* save eip */ 149 | "pushl %3\n\t" 150 | "ret\n\t" /* restore eip */ 151 | : "=m" (prev->thread.sp),"=m" (prev->thread.ip) 152 | : "m" (next->thread.sp),"m" (next->thread.ip) 153 | ); 154 | } 155 | return; 156 | }//end of my_schedule 157 | 158 | -------------------------------------------------------------------------------- /kink-src/kink-now/Makefile: -------------------------------------------------------------------------------- 1 | # 2 | # Makefile for the linux mykernel. 3 | # 4 | 5 | obj-y = interrupt.o scheduler.o main.o 6 | 7 | -------------------------------------------------------------------------------- /kink-src/kink-now/README.md: -------------------------------------------------------------------------------- 1 | # Welcome to the mykernel 1.1 2 | 3 | 增加了优先级调度方式 -------------------------------------------------------------------------------- /kink-src/kink-now/interrupt.c: -------------------------------------------------------------------------------- 1 | /* mykernel--Simple simulation of the linux OS process schedule 2 | * 3 | * linux/mykernel/myinterrupt.c 4 | * 5 | * Kernel internal my_timer_handler 6 | * 7 | * Copyright (C) 2013 Mengning 8 | * 9 | * Modified 2014 zhyq 10 | * 11 | * 12 | * You can redistribute or modify this program under the terms 13 | * of the GNU General Public License as published by 14 | * the Free Software Foundation. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with this program. If not, see . 18 | */ 19 | 20 | #include 21 | #include 22 | #include 23 | #include 24 | #include 25 | #include 26 | #include 27 | #include 28 | #include 29 | #include 30 | #include 31 | #include 32 | #include 33 | #include 34 | #include 35 | #include 36 | #include 37 | #include 38 | #include 39 | #include 40 | #include 41 | #include 42 | 43 | #include 44 | #include 45 | #include 46 | #include 47 | #include 48 | 49 | #include 50 | #include 51 | #include 52 | #include 53 | #include 54 | 55 | #include "pcb.h" 56 | 57 | #define CREATE_TRACE_POINTS 58 | #include 59 | 60 | extern tPCB task[MAX_TASK_NUM]; 61 | extern tPCB * my_current_task; 62 | extern volatile int my_need_sched; 63 | volatile int time_count = 0; 64 | 65 | /* 66 | * Called by timer interrupt. 67 | * it runs in the name of current running process, 68 | * so it use kernel stack of current running process 69 | */ 70 | void my_timer_handler(void) 71 | { 72 | #if 1 73 | // make sure need schedule after system circle 2000 times. 74 | if(time_count%2000 == 0 && my_need_sched != 1) 75 | { 76 | my_need_sched = 1; 77 | //time_count=0; 78 | } 79 | time_count ++ ; 80 | #endif 81 | return; 82 | } 83 | 84 | -------------------------------------------------------------------------------- /kink-src/kink-now/main.c: -------------------------------------------------------------------------------- 1 | /* mykernel--Simple simulation of the linux OS process schedule 2 | * 3 | * linux/mykernel/mymain.c 4 | * 5 | * Kernel internal my_timer_handler 6 | * 7 | * Copyright (C) 2013 Mengning 8 | * 9 | * Modified zhyq 10 | * 11 | * 12 | * You can redistribute or modify this program under the terms 13 | * of the GNU General Public License as published by 14 | * the Free Software Foundation. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with this program. If not, see . 18 | */ 19 | 20 | 21 | #include 22 | #include 23 | #include 24 | #include 25 | #include 26 | #include 27 | #include 28 | #include 29 | #include 30 | #include 31 | #include 32 | #include 33 | #include 34 | #include 35 | #include 36 | #include 37 | #include 38 | #include 39 | #include 40 | #include 41 | #include 42 | #include 43 | #include 44 | #include 45 | #include 46 | #include 47 | #include 48 | #include 49 | #include 50 | #include 51 | #include 52 | #include 53 | #include 54 | #include 55 | #include 56 | #include 57 | #include 58 | #include 59 | #include 60 | #include 61 | #include 62 | #include 63 | #include 64 | #include 65 | #include 66 | #include 67 | #include 68 | #include 69 | #include 70 | #include 71 | #include 72 | #include 73 | #include 74 | #include 75 | #include 76 | #include 77 | #include 78 | #include 79 | #include 80 | #include 81 | #include 82 | #include 83 | #include 84 | 85 | #include 86 | #include 87 | #include 88 | #include 89 | #include 90 | 91 | #include 92 | 93 | #include 94 | #include 95 | 96 | #ifdef CONFIG_X86_LOCAL_APIC 97 | #include 98 | #endif 99 | #include "pcb.h" 100 | 101 | tPCB task[MAX_TASK_NUM]; 102 | tPCB * my_current_task = NULL; 103 | volatile int my_need_sched = 0; 104 | 105 | void my_process(void); 106 | unsigned long get_rand(int ); 107 | 108 | void sand_priority(void) 109 | { 110 | int i; 111 | for(i=0;i0 stopped */ 122 | // set task 0 execute entry address to my_process 123 | task[pid].task_entry = task[pid].thread.ip = (unsigned long)my_process; 124 | task[pid].thread.sp = (unsigned long)&task[pid].stack[KERNEL_STACK_SIZE-1]; 125 | task[pid].next = &task[pid]; 126 | /*fork more process */ 127 | for(pid=1;pid>>process 0 running!!!<<<\n\n"); 137 | /* start process 0 by task[0] */ 138 | pid = 0; 139 | my_current_task = &task[pid]; 140 | asm volatile( 141 | "movl %1,%%esp\n\t" /* set task[pid].thread.sp to esp */ 142 | "pushl %1\n\t" /* push ebp */ 143 | "pushl %0\n\t" /* push task[pid].thread.ip */ 144 | "ret\n\t" /* pop task[pid].thread.ip to eip */ 145 | "popl %%ebp\n\t" 146 | : 147 | : "c" (task[pid].thread.ip),"d" (task[pid].thread.sp) /* input c or d mean %ecx/%edx*/ 148 | ); 149 | } 150 | void my_process(void) 151 | { 152 | int i = 0; 153 | while(1) 154 | { 155 | i++; 156 | if(i%10000000 == 0) 157 | { 158 | //printk(KERN_NOTICE "this is process %d - =WangPanPan(Soleprincess)=\n", 159 | // my_current_task->pid); 160 | 161 | if(my_need_sched == 1) 162 | { 163 | //printk(KERN_NOTICE "process %d schedule\n", my_current_task->pid); 164 | my_need_sched = 0; 165 | sand_priority(); 166 | my_schedule(); 167 | 168 | //printk(KERN_NOTICE "process %d re-schedule\n", my_current_task->pid); 169 | } 170 | //printk(KERN_NOTICE "this is process %d - =ChengJian(Gatieme)=\n", 171 | // my_current_task->pid); 172 | } 173 | } 174 | }//end of my_process 175 | 176 | //produce a random priority to a task 177 | unsigned long get_rand(max) 178 | { 179 | unsigned long a; 180 | unsigned long umax; 181 | umax=(unsigned long)max; 182 | get_random_bytes(&a, sizeof(unsigned long )); 183 | a=(a+umax)%umax; 184 | return a; 185 | } 186 | -------------------------------------------------------------------------------- /kink-src/kink-now/pcb.h: -------------------------------------------------------------------------------- 1 | /* mykernel--Simple simulation of the linux OS process schedule 2 | * 3 | * linux/mykernel/mypcb.h 4 | * 5 | * Kernel internal my_timer_handler 6 | * 7 | * Copyright (C) 2013 Mengning 8 | * 9 | * Modified 2014 Yunquan Zhang 10 | * 11 | * 12 | * You can redistribute or modify this program under the terms 13 | * of the GNU General Public License as published by 14 | * the Free Software Foundation. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with this program. If not, see . 18 | */ 19 | 20 | #define MAX_TASK_NUM 10 // max num of task in system 21 | #define KERNEL_STACK_SIZE 1024*8 22 | #define PRIORITY_MAX 30 //priority range from 0 to 30 23 | 24 | /* CPU-specific state of this task */ 25 | struct Thread { 26 | unsigned long ip;//point to cpu run address 27 | unsigned long sp;//point to the thread stack's top address 28 | //todo add other attrubte of system thread 29 | }; 30 | 31 | //PCB Struct 32 | typedef struct PCB{ 33 | int pid; // pcb id 34 | volatile long state; /* -1 unrunnable, 0 runnable, >0 stopped */ 35 | char stack[KERNEL_STACK_SIZE];// each pcb stack size is 1024*8 36 | /* CPU-specific state of this task */ 37 | struct Thread thread; 38 | unsigned long task_entry;//the task execute entry memory address 39 | struct PCB *next;//pcb is a circular linked list 40 | unsigned long priority;// task priority //////// 41 | //todo add other attrubte of process control block 42 | }tPCB; 43 | 44 | //void my_schedule(int pid); 45 | void my_schedule(void); 46 | -------------------------------------------------------------------------------- /kink-src/kink-now/scheduler.c: -------------------------------------------------------------------------------- 1 | /* mykernel--Simple simulation of the linux OS process schedule 2 | * 3 | * linux/mykernel/myinterrupt.c 4 | * 5 | * Kernel internal my_timer_handler 6 | * 7 | * Copyright (C) 2013 Mengning 8 | * 9 | * Modified 2014 zhyq 10 | * 11 | * 12 | * You can redistribute or modify this program under the terms 13 | * of the GNU General Public License as published by 14 | * the Free Software Foundation. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with this program. If not, see . 18 | */ 19 | 20 | #include 21 | #include 22 | #include 23 | #include 24 | #include 25 | #include 26 | #include 27 | #include 28 | #include 29 | #include 30 | #include 31 | #include 32 | #include 33 | #include 34 | #include 35 | #include 36 | #include 37 | #include 38 | #include 39 | #include 40 | #include 41 | #include 42 | 43 | #include 44 | #include 45 | #include 46 | #include 47 | #include 48 | 49 | #include 50 | #include 51 | #include 52 | #include 53 | #include 54 | 55 | #include "pcb.h" 56 | 57 | #define CREATE_TRACE_POINTS 58 | #include 59 | 60 | extern tPCB task[MAX_TASK_NUM]; 61 | extern tPCB * my_current_task; 62 | extern volatile int my_need_sched; 63 | 64 | 65 | void all_task_print(void) 66 | { 67 | int i,cnum=62;// 68 | printk(KERN_NOTICE "\n current task is:%d all task in OS are:\n",my_current_task->pid); 69 | 70 | printk(" "); 71 | for(i = 0; i < cnum; i++) 72 | { 73 | printk("-"); 74 | } 75 | 76 | printk("\n | process:"); 77 | 78 | for(i=0;i< MAX_TASK_NUM;i++) 79 | { 80 | printk("| %2d ",i); 81 | } 82 | 83 | printk("|\n | priority:"); 84 | 85 | for(i=0;ipriority) 106 | hig_pri=&task[i]; 107 | printk(" higst process is:%d priority is:%d\n",hig_pri->pid,hig_pri->priority); 108 | return hig_pri; 109 | 110 | }//end of priority_schedule 111 | 112 | void my_schedule(void) 113 | { 114 | tPCB * next; 115 | tPCB * prev; 116 | // if there no task running or only a task ,it shouldn't need schedule 117 | if(my_current_task == NULL 118 | || my_current_task->next == NULL) 119 | { 120 | printk(KERN_NOTICE " time out!!!,but no more than 2 task,need not schedule\n"); 121 | return; 122 | } 123 | /* schedule */ 124 | 125 | next = get_next(); 126 | prev = my_current_task; 127 | printk(KERN_NOTICE " the next task is %d priority is %u\n",next->pid,next->priority); 128 | if(next->state == 0)/* -1 unrunnable, 0 runnable, >0 stopped */ 129 | {//save current scene 130 | /* switch to next process */ 131 | asm volatile( 132 | "pushl %%ebp\n\t" /* save ebp */ 133 | "movl %%esp,%0\n\t" /* save esp */ 134 | "movl %2,%%esp\n\t" /* restore esp */ 135 | "movl $1f,%1\n\t" /* save eip */ 136 | "pushl %3\n\t" 137 | "ret\n\t" /* restore eip */ 138 | "1:\t" /* next process start here */ 139 | "popl %%ebp\n\t" 140 | : "=m" (prev->thread.sp),"=m" (prev->thread.ip) 141 | : "m" (next->thread.sp),"m" (next->thread.ip) 142 | ); 143 | my_current_task = next;//switch to the next task 144 | printk(KERN_NOTICE " switch from %d process to %d process\n >>>process %d running!!!<<<\n\n",prev->pid,next->pid,next->pid); 145 | 146 | } 147 | else 148 | { 149 | next->state = 0; 150 | my_current_task = next; 151 | printk(KERN_NOTICE " switch from %d process to %d process\n >>>process %d running!!!<<<\n\n\n",prev->pid,next->pid,next->pid); 152 | 153 | /* switch to new process */ 154 | asm volatile( 155 | "pushl %%ebp\n\t" /* save ebp */ 156 | "movl %%esp,%0\n\t" /* save esp */ 157 | "movl %2,%%esp\n\t" /* restore esp */ 158 | "movl %2,%%ebp\n\t" /* restore ebp */ 159 | "movl $1f,%1\n\t" /* save eip */ 160 | "pushl %3\n\t" 161 | "ret\n\t" /* restore eip */ 162 | : "=m" (prev->thread.sp),"=m" (prev->thread.ip) 163 | : "m" (next->thread.sp),"m" (next->thread.ip) 164 | ); 165 | } 166 | return; 167 | }//end of my_schedule 168 | 169 | -------------------------------------------------------------------------------- /mykernel-3.9.4/Makefile: -------------------------------------------------------------------------------- 1 | # used by Linux kernel 2 | obj-y = mymain.o myinterrupt.o 3 | 4 | 5 | KERNEL = linux-3.9.4 6 | 7 | ROOT_DIR=$(shell pwd) 8 | DOWNLOAD_DIR = $(ROOT_DIR)/downloads 9 | KERNEL_DIR = $(ROOT_DIR)/kernel 10 | KERNEL_PATCH_DIR = $(KERNEL_DIR)/$(KERNEL).new 11 | KERNEL_SRC_DIR = $(KERNEL_DIR)/$(KERNEL).src 12 | 13 | 14 | PATCH_DIR = $(ROOT_DIR)/patches 15 | PATCH_FILE = linux-3.9.4-mykernel.patch 16 | 17 | CONFIG_DIR = $(ROOT_DIR)/configs 18 | 19 | # the generic parts 20 | LINUX_URL = https://www.kernel.org/pub/linux/kernel/v3.x 21 | LINUX_FILE = downloads/$(KERNEL).tar.xz 22 | LINUX_MD5 = "053095dfe88fbd52e7cc8db302631d99" 23 | 24 | 25 | OUT = $(PWD)/.out 26 | 27 | ALL = .stamps/downloads .stamps/setup .stamps/build 28 | .PHONY: all 29 | all: $(ALL) 30 | 31 | TMPFILE := $(shell mktemp) 32 | 33 | .stamps: 34 | @mkdir -p $@ 35 | 36 | to-md5 = $1 $(addsuffix .md5,$1) 37 | %.md5: FORCE 38 | @$(if $(filter-out $(shell cat $@ 2>/dev/null),$(shell md5sum $*)),md5sum $* > $@) 39 | FORCE: 40 | 41 | $(LINUX_FILE): 42 | mkdir -p $(DOWNLOAD_DIR) 43 | (cd downloads; wget -c $(LINUX_URL)/$(KERNEL).tar.xz) 44 | 45 | .stamps/downloads: $(call to-md5,$(LINUX_FILE)) .stamps 46 | @echo $(LINUX_MD5) > $(TMPFILE) 47 | @cmp -n 32 $(TMPFILE) $<.md5 >/dev/null || (echo "File checksum mismatch!"; exit 1) 48 | @touch $@ 49 | 50 | .stamps/setup: .stamps/extract .stamps/patch .stamps/config 51 | @touch $@ 52 | 53 | .stamps/extract: $(LINUX_FILE) 54 | mkdir -p $(KERNEL_DIR) 55 | tar Jxf $< -C $(KERNEL_DIR) 56 | (cd $(KERNEL_DIR); \ 57 | mv $(KERNEL) $(KERNEL).src; \ 58 | cp -rf $(KERNEL).src $(KERNEL).new) 59 | (cd $(KERNEL_PATCH_DIR); ln -s ../../src mysrc) 60 | @touch $@ 61 | 62 | .stamps/patch: 63 | (cd $(KERNEL_PATCH_DIR); \ 64 | patch --dry-run -f -p1 < $(PATCH_DIR)/$(PATCH_FILE) >/dev/null && \ 65 | patch -p1 < $(PATCH_DIR)/$(PATCH_FILE)) || touch $@ 66 | 67 | .stamps/config: 68 | @mkdir -p $(OUT) 69 | (cd $(KERNEL_PATCH_DIR) && make allnoconfig && make O=$(OUT)) 70 | @touch $@ 71 | 72 | #.stamps/config: 73 | # @mkdir -p $(OUT) 74 | # (cd $(KERNEL_PATCH_DIR); \ 75 | # cp -f $(CONFIG_DIR)/mini-x86.config $(OUT)/.config; \ 76 | # make O=$(OUT) oldconfig) 77 | # @touch $@ 78 | 79 | 80 | # number of CPUs 81 | ifndef CPUS 82 | CPUS := $(shell grep -c ^processor /proc/cpuinfo 2>/dev/null || \ 83 | sysctl -n hw.ncpu) 84 | endif 85 | 86 | .stamps/build: $(KERNEL_PATCH_DIR)/Makefile \ 87 | interrupt.c main.c pcb.h 88 | (cd $(KERNEL_PATCH_DIR); $(MAKE) O=$(OUT) -j $(CPUS)) 89 | @touch $@ 90 | 91 | .PHNOY : run 92 | run: $(OUT)/arch/x86/boot/bzImage 93 | qemu -kernel $< 94 | 95 | # --------------------------- 96 | # generate patch and patch it 97 | # --------------------------- 98 | 99 | # generate your kernel patch 100 | .PHNOY : genpatch 101 | genpatch: .stamps/extract 102 | cd $(KERNEL_DIR) 103 | diff -Naur linux-3.9.4.src linux-3.9.4.new/ >linux-3.9.4-mykernel.patch 104 | 105 | # patch your kernel 106 | .PHNOY : patch 107 | patch : .stamps/extract 108 | (cd $(KERNEL_PATCH_DIR); \ 109 | patch --dry-run -f -p1 < $(PATCH_DIR)/$(PATCH_FILE) >/dev/null && \ 110 | patch -p1 < $(PATCH_DIR)/$(PATCH_FILE)) || touch $@ 111 | 112 | 113 | # ---------------------------------------------------- 114 | # link and rmlink ./src to /kernel/linux-3.9.4.new/mysrc 115 | # ---------------------------------------------------- 116 | 117 | # remove your links 118 | .PHNOY : rmlink 119 | rmlink : 120 | rm $(KERNEL_PATCH_DIR)/mysrc 121 | 122 | # relink ./src to /kernel/linux-3.9.4.new/mysrc 123 | .PHNOY : link 124 | link : 125 | (cd $(KERNEL_PATCH_DIR); ln -s ../../src mysrc) 126 | 127 | 128 | # ------------ 129 | # build kernel 130 | # ------------ 131 | .PHNOY : build 132 | build : 133 | (cd $(KERNEL_PATCH_DIR); $(MAKE) O=$(OUT)) 134 | 135 | # ------------------- 136 | # clean and distclean 137 | # ------------------- 138 | 139 | # clean your work 140 | .PHONY : clean 141 | clean: 142 | $(MAKE) -C $(KERNEL_PATCH_DIR) O=$(OUT) clean 143 | rm -f .stamps/build 144 | 145 | # distclean all your work 146 | .PHONY : distclean 147 | distclean: clean 148 | rm -rf .stamps $(OUT) 149 | rm -rf $(KERNEL_DIR) 150 | -------------------------------------------------------------------------------- /mykernel-3.9.4/Makefile.bak: -------------------------------------------------------------------------------- 1 | # used by Linux kernel 2 | obj-y = mymain.o myinterrupt.o 3 | 4 | # the generic parts 5 | #LINUX_URL = https://www.kernel.org/pub/linux/kernel/v4.x 6 | LINUX_URL = https://www.kernel.org/pub/linux/kernel/v3.x 7 | KERNEL = linux-3.9.4 8 | LINUX_FILE = downloads/$(KERNEL).tar.xz 9 | LINUX_MD5 = "053095dfe88fbd52e7cc8db302631d99" 10 | PATCH_FILE = linux-3.9.4-mykernel.patch 11 | OUT = $(PWD)/.out 12 | 13 | ALL = .stamps/downloads .stamps/setup .stamps/build 14 | .PHONY: all 15 | all: $(ALL) 16 | 17 | TMPFILE := $(shell mktemp) 18 | 19 | .stamps: 20 | @mkdir -p $@ 21 | 22 | to-md5 = $1 $(addsuffix .md5,$1) 23 | %.md5: FORCE 24 | @$(if $(filter-out $(shell cat $@ 2>/dev/null),$(shell md5sum $*)),md5sum $* > $@) 25 | FORCE: 26 | 27 | $(LINUX_FILE): 28 | mkdir -p downloads 29 | (cd downloads; wget -c $(LINUX_URL)/$(KERNEL).tar.xz) 30 | 31 | .stamps/downloads: $(call to-md5,$(LINUX_FILE)) .stamps 32 | @echo $(LINUX_MD5) > $(TMPFILE) 33 | @cmp -n 32 $(TMPFILE) $<.md5 >/dev/null || (echo "File checksum mismatch!"; exit 1) 34 | @touch $@ 35 | 36 | .stamps/setup: .stamps/extract .stamps/patch .stamps/config 37 | @touch $@ 38 | 39 | .stamps/extract: $(LINUX_FILE) 40 | tar Jxf $< 41 | (cd $(KERNEL); ln -s ../src mysrc) 42 | @touch $@ 43 | 44 | .stamps/patch: 45 | (cd $(KERNEL); \ 46 | patch --dry-run -f -p1 < ../patches/$(PATCH_FILE) >/dev/null && \ 47 | patch -p1 < ../patches/$(PATCH_FILE)) || touch $@ 48 | 49 | .stamps/config: 50 | @mkdir -p $(OUT) 51 | (cd $(KERNEL); \ 52 | cp -f ../configs/mini-x86.config $(OUT)/.config; \ 53 | make O=$(OUT)) 54 | @touch $@ 55 | 56 | # number of CPUs 57 | ifndef CPUS 58 | CPUS := $(shell grep -c ^processor /proc/cpuinfo 2>/dev/null || \ 59 | sysctl -n hw.ncpu) 60 | endif 61 | 62 | .stamps/build: $(KERNEL)/Makefile \ 63 | src/myinterrupt.c src/mymain.c src/mypcb.h 64 | (cd $(KERNEL); $(MAKE) O=$(OUT) -j $(CPUS)) 65 | @touch $@ 66 | 67 | run: $(OUT)/arch/x86/boot/bzImage 68 | qemu -kernel $< 69 | 70 | clean: 71 | $(MAKE) -C $(KERNEL) O=$(OUT) clean 72 | rm -f .stamps/build 73 | 74 | distclean: clean 75 | rm -rf .stamps $(OUT) 76 | rm -rf $(KERNEL) 77 | -------------------------------------------------------------------------------- /mykernel-3.9.4/README.md: -------------------------------------------------------------------------------- 1 | 本项目基于mykernel项目修改 2 | 3 | | name | github | website | 4 | |:-------:|:-------:|:-------:| 5 | | mykernel |ggit@github.com:mengning/mykernel.git | https://github.com/mengning/mykernel | 6 | 7 | 8 | # Welcome to the mykernel! 9 | 10 | It is a platform to write your own OS kernel,its based on Linux Kernel 3.9.4 source code. 11 | 12 | + Set up this platform 13 | + sudo apt-get install qemu # install QEMU 14 | + sudo ln -s /usr/bin/qemu-system-i386 /usr/bin/qemu 15 | + wget https://www.kernel.org/pub/linux/kernel/v3.x/linux-3.9.4.tar.xz # download [Linux Kernel 3.9.4 source code](https://www.kernel.org/pub/linux/kernel/v3.x/linux-3.9.4.tar.xz) 16 | + wget https://raw.github.com/mengning/mykernel/master/mykernel_for_linux3.9.4sc.patch # download [mykernel_for_linux3.9.4sc.patch](https://raw.github.com/mengning/mykernel/master/mykernel_for_linux3.9.4sc.patch) 17 | + xz -d linux-3.9.4.tar.xz 18 | + tar -xvf linux-3.9.4.tar 19 | + cd linux-3.9.4 20 | + patch -p1 < ../mykernel_for_linux3.9.4sc.patch 21 | + make allnoconfig 22 | + make 23 | + qemu -kernel arch/x86/boot/bzImage 从qemu窗口中您可以看到my_start_kernel在执行,同时my_timer_handler时钟中断处理程序周期性执行。 24 | + cd mykernel 您可以看到qemu窗口输出的内容的代码mymain.c和myinterrupt.c 25 | + 当前有一个CPU执行C代码的上下文环境,同时具有中断处理程序的上下文环境,我们初始化好了系统环境。 26 | + 您只要在mymain.c基础上继续写进程描述PCB和进程链表管理等代码,在myinterrupt.c的基础上完成进程切换代码,一个可运行的小OS kernel就完成了。 27 | + start to write your own OS kernel,enjoy it! 28 | 29 | + mykernel patch generated by this command: 30 | + diff -Naur linux-3.9.4 linux-3.9.4.new/ > mykernel_for_linux3.9.4sc.patch 31 | 32 | # Comments 33 | 34 | * mykernel这样一个短小精悍的模拟内核,时常给我提供了看问题的角度和思路。当被庞杂的Linux内核代码弄得一头雾水时,我就去看看mykernel,很多复杂的问题就可以用简单的机制解释。——[pianogirl](http://blog.csdn.net/pianogirl123/article/details/51287024) 35 | 36 | # Links 37 | 38 | * [2013年暑期补课计算机操作系统原理](https://github.com/mengning/mykernel/wiki/OS2013) 39 | * 和mykernel类似的项目[kernel-in-kernel](https://github.com/jserv/kernel-in-kernel)值得参考 40 | -------------------------------------------------------------------------------- /mykernel-3.9.4/bak/myinterrupt.c: -------------------------------------------------------------------------------- 1 | /* 2 | * linux/mykernel/myinterrupt.c 3 | * 4 | * Kernel internal my_timer_handler 5 | * 6 | * Copyright (C) 2013 Mengning 7 | * 8 | */ 9 | #include 10 | #include 11 | #include 12 | #include 13 | #include 14 | 15 | #include "mypcb.h" 16 | 17 | extern tPCB task[MAX_TASK_NUM]; 18 | extern tPCB * my_current_task; 19 | extern volatile int my_need_sched; 20 | volatile int time_count = 0; 21 | 22 | /* 23 | * Called by timer interrupt. 24 | * it runs in the name of current running process, 25 | * so it use kernel stack of current running process 26 | */ 27 | void my_timer_handler(void) 28 | { 29 | #if 1 30 | if(time_count%1000 == 0 && my_need_sched != 1) 31 | { 32 | printk(KERN_NOTICE ">>>my_timer_handler here<<<\n"); 33 | my_need_sched = 1; 34 | } 35 | time_count ++ ; 36 | #endif 37 | return; 38 | } 39 | 40 | void my_schedule(void) 41 | { 42 | tPCB * next; 43 | tPCB * prev; 44 | 45 | if(my_current_task == NULL 46 | || my_current_task->next == NULL) 47 | { 48 | return; 49 | } 50 | printk(KERN_NOTICE ">>>my_schedule<<<\n"); 51 | /* schedule */ 52 | next = my_current_task->next; 53 | prev = my_current_task; 54 | if(next->state == 0)/* -1 unrunnable, 0 runnable, >0 stopped */ 55 | { 56 | my_current_task = next; 57 | printk(KERN_NOTICE ">>>switch %d to %d<<<\n",prev->pid,next->pid); 58 | /* switch to next process */ 59 | asm volatile( 60 | "pushl %%ebp\n\t" /* save ebp */ 61 | "movl %%esp,%0\n\t" /* save esp */ 62 | "movl %2,%%esp\n\t" /* restore esp */ 63 | "movl $1f,%1\n\t" /* save eip */ 64 | "pushl %3\n\t" 65 | "ret\n\t" /* restore eip */ 66 | "1:\t" /* next process start here */ 67 | "popl %%ebp\n\t" 68 | : "=m" (prev->thread.sp),"=m" (prev->thread.ip) 69 | : "m" (next->thread.sp),"m" (next->thread.ip) 70 | ); 71 | 72 | } 73 | else 74 | { 75 | next->state = 0; 76 | my_current_task = next; 77 | printk(KERN_NOTICE ">>>switch %d to %d<<<\n",prev->pid,next->pid); 78 | /* switch to new process */ 79 | asm volatile( 80 | "pushl %%ebp\n\t" /* save ebp */ 81 | "movl %%esp,%0\n\t" /* save esp */ 82 | "movl %2,%%esp\n\t" /* restore esp */ 83 | "movl %2,%%ebp\n\t" /* restore ebp */ 84 | "movl $1f,%1\n\t" /* save eip */ 85 | "pushl %3\n\t" 86 | "ret\n\t" /* restore eip */ 87 | : "=m" (prev->thread.sp),"=m" (prev->thread.ip) 88 | : "m" (next->thread.sp),"m" (next->thread.ip) 89 | ); 90 | } 91 | return; 92 | } 93 | 94 | -------------------------------------------------------------------------------- /mykernel-3.9.4/bak/mymain.c: -------------------------------------------------------------------------------- 1 | /* 2 | * linux/mykernel/mymain.c 3 | * 4 | * Kernel internal my_start_kernel 5 | * 6 | * Copyright (C) 2013 Mengning 7 | * 8 | */ 9 | #include 10 | #include 11 | #include 12 | #include 13 | #include 14 | 15 | 16 | #include "mypcb.h" 17 | 18 | tPCB task[MAX_TASK_NUM]; 19 | tPCB * my_current_task = NULL; 20 | volatile int my_need_sched = 0; 21 | 22 | void my_process(void); 23 | 24 | 25 | void __init my_start_kernel(void) 26 | { 27 | int pid = 0; 28 | int i; 29 | /* Initialize process 0*/ 30 | task[pid].pid = pid; 31 | task[pid].state = 0;/* -1 unrunnable, 0 runnable, >0 stopped */ 32 | task[pid].task_entry = task[pid].thread.ip = (unsigned long)my_process; 33 | task[pid].thread.sp = (unsigned long)&task[pid].stack[KERNEL_STACK_SIZE-1]; 34 | task[pid].next = &task[pid]; 35 | /*fork more process */ 36 | for(i=1;ipid); 67 | if(my_need_sched == 1) 68 | { 69 | my_need_sched = 0; 70 | my_schedule(); 71 | } 72 | printk(KERN_NOTICE "this is process %d +\n",my_current_task->pid); 73 | } 74 | } 75 | } -------------------------------------------------------------------------------- /mykernel-3.9.4/bak/mypcb.h: -------------------------------------------------------------------------------- 1 | /* 2 | * linux/mykernel/mypcb.h 3 | * 4 | * Kernel internal PCB types 5 | * 6 | * Copyright (C) 2013 Mengning 7 | * 8 | */ 9 | 10 | #define MAX_TASK_NUM 4 11 | #define KERNEL_STACK_SIZE 1024*8 12 | 13 | /* CPU-specific state of this task */ 14 | struct Thread { 15 | unsigned long ip; 16 | unsigned long sp; 17 | }; 18 | 19 | typedef struct PCB{ 20 | int pid; 21 | volatile long state; /* -1 unrunnable, 0 runnable, >0 stopped */ 22 | char stack[KERNEL_STACK_SIZE]; 23 | /* CPU-specific state of this task */ 24 | struct Thread thread; 25 | unsigned long task_entry; 26 | struct PCB *next; 27 | }tPCB; 28 | 29 | void my_schedule(void); 30 | 31 | -------------------------------------------------------------------------------- /mykernel-3.9.4/configs/mini-x86.config: -------------------------------------------------------------------------------- 1 | # 2 | # Automatically generated file; DO NOT EDIT. 3 | # Linux/x86 3.9.4 Kernel Configuration 4 | # 5 | # CONFIG_64BIT is not set 6 | CONFIG_X86_32=y 7 | CONFIG_X86=y 8 | CONFIG_INSTRUCTION_DECODER=y 9 | CONFIG_OUTPUT_FORMAT="elf32-i386" 10 | CONFIG_ARCH_DEFCONFIG="arch/x86/configs/i386_defconfig" 11 | CONFIG_LOCKDEP_SUPPORT=y 12 | CONFIG_STACKTRACE_SUPPORT=y 13 | CONFIG_HAVE_LATENCYTOP_SUPPORT=y 14 | CONFIG_MMU=y 15 | CONFIG_NEED_SG_DMA_LENGTH=y 16 | CONFIG_GENERIC_ISA_DMA=y 17 | CONFIG_GENERIC_BUG=y 18 | CONFIG_GENERIC_HWEIGHT=y 19 | CONFIG_ARCH_MAY_HAVE_PC_FDC=y 20 | CONFIG_RWSEM_XCHGADD_ALGORITHM=y 21 | CONFIG_GENERIC_CALIBRATE_DELAY=y 22 | CONFIG_ARCH_HAS_CPU_RELAX=y 23 | CONFIG_ARCH_HAS_DEFAULT_IDLE=y 24 | CONFIG_ARCH_HAS_CACHE_LINE_SIZE=y 25 | CONFIG_ARCH_HAS_CPU_AUTOPROBE=y 26 | CONFIG_HAVE_SETUP_PER_CPU_AREA=y 27 | CONFIG_NEED_PER_CPU_EMBED_FIRST_CHUNK=y 28 | CONFIG_NEED_PER_CPU_PAGE_FIRST_CHUNK=y 29 | CONFIG_ARCH_HIBERNATION_POSSIBLE=y 30 | CONFIG_ARCH_SUSPEND_POSSIBLE=y 31 | # CONFIG_ZONE_DMA32 is not set 32 | # CONFIG_AUDIT_ARCH is not set 33 | CONFIG_ARCH_SUPPORTS_OPTIMIZED_INLINING=y 34 | CONFIG_ARCH_SUPPORTS_DEBUG_PAGEALLOC=y 35 | CONFIG_X86_32_LAZY_GS=y 36 | CONFIG_ARCH_HWEIGHT_CFLAGS="-fcall-saved-ecx -fcall-saved-edx" 37 | CONFIG_ARCH_SUPPORTS_UPROBES=y 38 | CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config" 39 | CONFIG_IRQ_WORK=y 40 | CONFIG_BUILDTIME_EXTABLE_SORT=y 41 | 42 | # 43 | # General setup 44 | # 45 | CONFIG_BROKEN_ON_SMP=y 46 | CONFIG_INIT_ENV_ARG_LIMIT=32 47 | CONFIG_CROSS_COMPILE="" 48 | CONFIG_LOCALVERSION="" 49 | # CONFIG_LOCALVERSION_AUTO is not set 50 | CONFIG_HAVE_KERNEL_GZIP=y 51 | CONFIG_HAVE_KERNEL_BZIP2=y 52 | CONFIG_HAVE_KERNEL_LZMA=y 53 | CONFIG_HAVE_KERNEL_XZ=y 54 | CONFIG_HAVE_KERNEL_LZO=y 55 | CONFIG_KERNEL_GZIP=y 56 | # CONFIG_KERNEL_BZIP2 is not set 57 | # CONFIG_KERNEL_LZMA is not set 58 | # CONFIG_KERNEL_XZ is not set 59 | # CONFIG_KERNEL_LZO is not set 60 | CONFIG_DEFAULT_HOSTNAME="(none)" 61 | # CONFIG_SWAP is not set 62 | # CONFIG_SYSVIPC is not set 63 | # CONFIG_FHANDLE is not set 64 | CONFIG_HAVE_GENERIC_HARDIRQS=y 65 | 66 | # 67 | # IRQ subsystem 68 | # 69 | CONFIG_GENERIC_HARDIRQS=y 70 | CONFIG_GENERIC_IRQ_PROBE=y 71 | CONFIG_GENERIC_IRQ_SHOW=y 72 | CONFIG_IRQ_FORCED_THREADING=y 73 | CONFIG_SPARSE_IRQ=y 74 | CONFIG_CLOCKSOURCE_WATCHDOG=y 75 | CONFIG_KTIME_SCALAR=y 76 | CONFIG_GENERIC_CLOCKEVENTS=y 77 | CONFIG_GENERIC_CLOCKEVENTS_BUILD=y 78 | CONFIG_GENERIC_CLOCKEVENTS_MIN_ADJUST=y 79 | CONFIG_GENERIC_CMOS_UPDATE=y 80 | 81 | # 82 | # Timers subsystem 83 | # 84 | # CONFIG_NO_HZ is not set 85 | # CONFIG_HIGH_RES_TIMERS is not set 86 | 87 | # 88 | # CPU/Task time and stats accounting 89 | # 90 | CONFIG_TICK_CPU_ACCOUNTING=y 91 | # CONFIG_IRQ_TIME_ACCOUNTING is not set 92 | # CONFIG_BSD_PROCESS_ACCT is not set 93 | 94 | # 95 | # RCU Subsystem 96 | # 97 | CONFIG_TINY_RCU=y 98 | # CONFIG_PREEMPT_RCU is not set 99 | # CONFIG_RCU_STALL_COMMON is not set 100 | # CONFIG_TREE_RCU_TRACE is not set 101 | # CONFIG_IKCONFIG is not set 102 | CONFIG_LOG_BUF_SHIFT=17 103 | CONFIG_HAVE_UNSTABLE_SCHED_CLOCK=y 104 | CONFIG_ARCH_SUPPORTS_NUMA_BALANCING=y 105 | CONFIG_ARCH_WANTS_PROT_NUMA_PROT_NONE=y 106 | # CONFIG_CGROUPS is not set 107 | # CONFIG_CHECKPOINT_RESTORE is not set 108 | CONFIG_NAMESPACES=y 109 | # CONFIG_UTS_NS is not set 110 | # CONFIG_USER_NS is not set 111 | # CONFIG_PID_NS is not set 112 | CONFIG_UIDGID_CONVERTED=y 113 | # CONFIG_UIDGID_STRICT_TYPE_CHECKS is not set 114 | # CONFIG_SCHED_AUTOGROUP is not set 115 | # CONFIG_SYSFS_DEPRECATED is not set 116 | # CONFIG_RELAY is not set 117 | # CONFIG_BLK_DEV_INITRD is not set 118 | # CONFIG_CC_OPTIMIZE_FOR_SIZE is not set 119 | CONFIG_SYSCTL=y 120 | CONFIG_ANON_INODES=y 121 | # CONFIG_EXPERT is not set 122 | CONFIG_HAVE_UID16=y 123 | CONFIG_UID16=y 124 | # CONFIG_SYSCTL_SYSCALL is not set 125 | CONFIG_SYSCTL_EXCEPTION_TRACE=y 126 | CONFIG_KALLSYMS=y 127 | CONFIG_HOTPLUG=y 128 | CONFIG_PRINTK=y 129 | CONFIG_BUG=y 130 | CONFIG_ELF_CORE=y 131 | CONFIG_PCSPKR_PLATFORM=y 132 | CONFIG_HAVE_PCSPKR_PLATFORM=y 133 | CONFIG_BASE_FULL=y 134 | CONFIG_FUTEX=y 135 | CONFIG_EPOLL=y 136 | CONFIG_SIGNALFD=y 137 | CONFIG_TIMERFD=y 138 | CONFIG_EVENTFD=y 139 | CONFIG_SHMEM=y 140 | CONFIG_AIO=y 141 | # CONFIG_EMBEDDED is not set 142 | CONFIG_HAVE_PERF_EVENTS=y 143 | 144 | # 145 | # Kernel Performance Events And Counters 146 | # 147 | CONFIG_PERF_EVENTS=y 148 | CONFIG_VM_EVENT_COUNTERS=y 149 | CONFIG_SLUB_DEBUG=y 150 | # CONFIG_COMPAT_BRK is not set 151 | # CONFIG_SLAB is not set 152 | CONFIG_SLUB=y 153 | # CONFIG_PROFILING is not set 154 | CONFIG_HAVE_OPROFILE=y 155 | CONFIG_OPROFILE_NMI_TIMER=y 156 | # CONFIG_JUMP_LABEL is not set 157 | # CONFIG_HAVE_64BIT_ALIGNED_ACCESS is not set 158 | CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS=y 159 | CONFIG_ARCH_USE_BUILTIN_BSWAP=y 160 | CONFIG_HAVE_IOREMAP_PROT=y 161 | CONFIG_HAVE_KPROBES=y 162 | CONFIG_HAVE_KRETPROBES=y 163 | CONFIG_HAVE_OPTPROBES=y 164 | CONFIG_HAVE_KPROBES_ON_FTRACE=y 165 | CONFIG_HAVE_ARCH_TRACEHOOK=y 166 | CONFIG_HAVE_DMA_ATTRS=y 167 | CONFIG_HAVE_DMA_CONTIGUOUS=y 168 | CONFIG_GENERIC_SMP_IDLE_THREAD=y 169 | CONFIG_HAVE_REGS_AND_STACK_ACCESS_API=y 170 | CONFIG_HAVE_DMA_API_DEBUG=y 171 | CONFIG_HAVE_HW_BREAKPOINT=y 172 | CONFIG_HAVE_MIXED_BREAKPOINTS_REGS=y 173 | CONFIG_HAVE_USER_RETURN_NOTIFIER=y 174 | CONFIG_HAVE_PERF_EVENTS_NMI=y 175 | CONFIG_HAVE_PERF_REGS=y 176 | CONFIG_HAVE_PERF_USER_STACK_DUMP=y 177 | CONFIG_HAVE_ARCH_JUMP_LABEL=y 178 | CONFIG_ARCH_HAVE_NMI_SAFE_CMPXCHG=y 179 | CONFIG_HAVE_ALIGNED_STRUCT_PAGE=y 180 | CONFIG_HAVE_CMPXCHG_LOCAL=y 181 | CONFIG_HAVE_CMPXCHG_DOUBLE=y 182 | CONFIG_ARCH_WANT_IPC_PARSE_VERSION=y 183 | CONFIG_HAVE_ARCH_SECCOMP_FILTER=y 184 | CONFIG_HAVE_IRQ_TIME_ACCOUNTING=y 185 | CONFIG_HAVE_ARCH_TRANSPARENT_HUGEPAGE=y 186 | CONFIG_MODULES_USE_ELF_REL=y 187 | CONFIG_CLONE_BACKWARDS=y 188 | CONFIG_OLD_SIGSUSPEND3=y 189 | CONFIG_OLD_SIGACTION=y 190 | 191 | # 192 | # GCOV-based kernel profiling 193 | # 194 | CONFIG_HAVE_GENERIC_DMA_COHERENT=y 195 | CONFIG_SLABINFO=y 196 | CONFIG_RT_MUTEXES=y 197 | CONFIG_BASE_SMALL=0 198 | # CONFIG_MODULES is not set 199 | CONFIG_BLOCK=y 200 | # CONFIG_LBDAF is not set 201 | # CONFIG_BLK_DEV_BSG is not set 202 | # CONFIG_BLK_DEV_BSGLIB is not set 203 | # CONFIG_BLK_DEV_INTEGRITY is not set 204 | 205 | # 206 | # Partition Types 207 | # 208 | # CONFIG_PARTITION_ADVANCED is not set 209 | CONFIG_MSDOS_PARTITION=y 210 | CONFIG_EFI_PARTITION=y 211 | 212 | # 213 | # IO Schedulers 214 | # 215 | CONFIG_IOSCHED_NOOP=y 216 | # CONFIG_IOSCHED_DEADLINE is not set 217 | # CONFIG_IOSCHED_CFQ is not set 218 | CONFIG_DEFAULT_NOOP=y 219 | CONFIG_DEFAULT_IOSCHED="noop" 220 | CONFIG_INLINE_SPIN_UNLOCK_IRQ=y 221 | CONFIG_INLINE_READ_UNLOCK=y 222 | CONFIG_INLINE_READ_UNLOCK_IRQ=y 223 | CONFIG_INLINE_WRITE_UNLOCK=y 224 | CONFIG_INLINE_WRITE_UNLOCK_IRQ=y 225 | # CONFIG_FREEZER is not set 226 | 227 | # 228 | # Processor type and features 229 | # 230 | CONFIG_ZONE_DMA=y 231 | # CONFIG_SMP is not set 232 | # CONFIG_X86_EXTENDED_PLATFORM is not set 233 | # CONFIG_X86_GOLDFISH is not set 234 | # CONFIG_X86_32_IRIS is not set 235 | # CONFIG_SCHED_OMIT_FRAME_POINTER is not set 236 | # CONFIG_PARAVIRT_GUEST is not set 237 | CONFIG_NO_BOOTMEM=y 238 | # CONFIG_MEMTEST is not set 239 | # CONFIG_M486 is not set 240 | # CONFIG_M586 is not set 241 | # CONFIG_M586TSC is not set 242 | # CONFIG_M586MMX is not set 243 | CONFIG_M686=y 244 | # CONFIG_MPENTIUMII is not set 245 | # CONFIG_MPENTIUMIII is not set 246 | # CONFIG_MPENTIUMM is not set 247 | # CONFIG_MPENTIUM4 is not set 248 | # CONFIG_MK6 is not set 249 | # CONFIG_MK7 is not set 250 | # CONFIG_MK8 is not set 251 | # CONFIG_MCRUSOE is not set 252 | # CONFIG_MEFFICEON is not set 253 | # CONFIG_MWINCHIPC6 is not set 254 | # CONFIG_MWINCHIP3D is not set 255 | # CONFIG_MELAN is not set 256 | # CONFIG_MGEODEGX1 is not set 257 | # CONFIG_MGEODE_LX is not set 258 | # CONFIG_MCYRIXIII is not set 259 | # CONFIG_MVIAC3_2 is not set 260 | # CONFIG_MVIAC7 is not set 261 | # CONFIG_MCORE2 is not set 262 | # CONFIG_MATOM is not set 263 | # CONFIG_X86_GENERIC is not set 264 | CONFIG_X86_INTERNODE_CACHE_SHIFT=5 265 | CONFIG_X86_L1_CACHE_SHIFT=5 266 | # CONFIG_X86_PPRO_FENCE is not set 267 | CONFIG_X86_USE_PPRO_CHECKSUM=y 268 | CONFIG_X86_TSC=y 269 | CONFIG_X86_CMPXCHG64=y 270 | CONFIG_X86_CMOV=y 271 | CONFIG_X86_MINIMUM_CPU_FAMILY=5 272 | CONFIG_X86_DEBUGCTLMSR=y 273 | CONFIG_CPU_SUP_INTEL=y 274 | CONFIG_CPU_SUP_AMD=y 275 | CONFIG_CPU_SUP_CENTAUR=y 276 | CONFIG_CPU_SUP_TRANSMETA_32=y 277 | # CONFIG_HPET_TIMER is not set 278 | CONFIG_DMI=y 279 | CONFIG_NR_CPUS=1 280 | CONFIG_PREEMPT_NONE=y 281 | # CONFIG_PREEMPT_VOLUNTARY is not set 282 | # CONFIG_PREEMPT is not set 283 | # CONFIG_X86_UP_APIC is not set 284 | # CONFIG_X86_MCE is not set 285 | CONFIG_VM86=y 286 | # CONFIG_TOSHIBA is not set 287 | # CONFIG_I8K is not set 288 | # CONFIG_X86_REBOOTFIXUPS is not set 289 | # CONFIG_MICROCODE is not set 290 | # CONFIG_X86_MSR is not set 291 | # CONFIG_X86_CPUID is not set 292 | # CONFIG_NOHIGHMEM is not set 293 | CONFIG_HIGHMEM4G=y 294 | # CONFIG_HIGHMEM64G is not set 295 | CONFIG_PAGE_OFFSET=0xC0000000 296 | CONFIG_HIGHMEM=y 297 | CONFIG_ARCH_FLATMEM_ENABLE=y 298 | CONFIG_ARCH_SPARSEMEM_ENABLE=y 299 | CONFIG_ARCH_SELECT_MEMORY_MODEL=y 300 | CONFIG_ILLEGAL_POINTER_VALUE=0 301 | CONFIG_SELECT_MEMORY_MODEL=y 302 | CONFIG_FLATMEM_MANUAL=y 303 | # CONFIG_SPARSEMEM_MANUAL is not set 304 | CONFIG_FLATMEM=y 305 | CONFIG_FLAT_NODE_MEM_MAP=y 306 | CONFIG_SPARSEMEM_STATIC=y 307 | CONFIG_HAVE_MEMBLOCK=y 308 | CONFIG_HAVE_MEMBLOCK_NODE_MAP=y 309 | CONFIG_ARCH_DISCARD_MEMBLOCK=y 310 | # CONFIG_HAVE_BOOTMEM_INFO_NODE is not set 311 | CONFIG_PAGEFLAGS_EXTENDED=y 312 | CONFIG_SPLIT_PTLOCK_CPUS=4 313 | # CONFIG_COMPACTION is not set 314 | # CONFIG_PHYS_ADDR_T_64BIT is not set 315 | CONFIG_ZONE_DMA_FLAG=1 316 | CONFIG_BOUNCE=y 317 | CONFIG_VIRT_TO_BUS=y 318 | # CONFIG_KSM is not set 319 | CONFIG_DEFAULT_MMAP_MIN_ADDR=4096 320 | # CONFIG_TRANSPARENT_HUGEPAGE is not set 321 | # CONFIG_CROSS_MEMORY_ATTACH is not set 322 | CONFIG_NEED_PER_CPU_KM=y 323 | # CONFIG_CLEANCACHE is not set 324 | # CONFIG_HIGHPTE is not set 325 | # CONFIG_X86_CHECK_BIOS_CORRUPTION is not set 326 | CONFIG_X86_RESERVE_LOW=64 327 | # CONFIG_MATH_EMULATION is not set 328 | CONFIG_MTRR=y 329 | # CONFIG_MTRR_SANITIZER is not set 330 | CONFIG_X86_PAT=y 331 | CONFIG_ARCH_USES_PG_UNCACHED=y 332 | CONFIG_ARCH_RANDOM=y 333 | CONFIG_X86_SMAP=y 334 | # CONFIG_SECCOMP is not set 335 | # CONFIG_CC_STACKPROTECTOR is not set 336 | # CONFIG_HZ_100 is not set 337 | CONFIG_HZ_250=y 338 | # CONFIG_HZ_300 is not set 339 | # CONFIG_HZ_1000 is not set 340 | CONFIG_HZ=250 341 | # CONFIG_SCHED_HRTICK is not set 342 | # CONFIG_KEXEC is not set 343 | # CONFIG_CRASH_DUMP is not set 344 | CONFIG_PHYSICAL_START=0x1000000 345 | # CONFIG_RELOCATABLE is not set 346 | CONFIG_PHYSICAL_ALIGN=0x1000000 347 | # CONFIG_COMPAT_VDSO is not set 348 | # CONFIG_CMDLINE_BOOL is not set 349 | CONFIG_ARCH_ENABLE_MEMORY_HOTPLUG=y 350 | 351 | # 352 | # Power management and ACPI options 353 | # 354 | # CONFIG_SUSPEND is not set 355 | # CONFIG_PM_RUNTIME is not set 356 | # CONFIG_SFI is not set 357 | 358 | # 359 | # CPU Frequency scaling 360 | # 361 | # CONFIG_CPU_FREQ is not set 362 | # CONFIG_CPU_IDLE is not set 363 | # CONFIG_ARCH_NEEDS_CPU_IDLE_COUPLED is not set 364 | 365 | # 366 | # Bus options (PCI etc.) 367 | # 368 | # CONFIG_PCI is not set 369 | CONFIG_PCI_LABEL=y 370 | CONFIG_ISA_DMA_API=y 371 | # CONFIG_ISA is not set 372 | # CONFIG_SCx200 is not set 373 | # CONFIG_OLPC is not set 374 | # CONFIG_ALIX is not set 375 | # CONFIG_NET5501 is not set 376 | # CONFIG_GEOS is not set 377 | # CONFIG_PCCARD is not set 378 | 379 | # 380 | # Executable file formats / Emulations 381 | # 382 | # CONFIG_BINFMT_ELF is not set 383 | CONFIG_ARCH_BINFMT_ELF_RANDOMIZE_PIE=y 384 | CONFIG_HAVE_AOUT=y 385 | # CONFIG_BINFMT_AOUT is not set 386 | # CONFIG_BINFMT_MISC is not set 387 | CONFIG_COREDUMP=y 388 | CONFIG_HAVE_ATOMIC_IOMAP=y 389 | CONFIG_HAVE_TEXT_POKE_SMP=y 390 | # CONFIG_NET is not set 391 | 392 | # 393 | # Device Drivers 394 | # 395 | 396 | # 397 | # Generic Driver Options 398 | # 399 | CONFIG_UEVENT_HELPER_PATH="" 400 | # CONFIG_DEVTMPFS is not set 401 | # CONFIG_STANDALONE is not set 402 | # CONFIG_PREVENT_FIRMWARE_BUILD is not set 403 | CONFIG_FW_LOADER=y 404 | # CONFIG_FIRMWARE_IN_KERNEL is not set 405 | CONFIG_EXTRA_FIRMWARE="" 406 | # CONFIG_FW_LOADER_USER_HELPER is not set 407 | # CONFIG_SYS_HYPERVISOR is not set 408 | # CONFIG_GENERIC_CPU_DEVICES is not set 409 | # CONFIG_DMA_SHARED_BUFFER is not set 410 | # CONFIG_CMA is not set 411 | 412 | # 413 | # Bus devices 414 | # 415 | # CONFIG_MTD is not set 416 | # CONFIG_PARPORT is not set 417 | # CONFIG_BLK_DEV is not set 418 | 419 | # 420 | # Misc devices 421 | # 422 | # CONFIG_SENSORS_LIS3LV02D is not set 423 | # CONFIG_ATMEL_SSC is not set 424 | # CONFIG_ENCLOSURE_SERVICES is not set 425 | # CONFIG_VMWARE_BALLOON is not set 426 | # CONFIG_C2PORT is not set 427 | 428 | # 429 | # EEPROM support 430 | # 431 | # CONFIG_EEPROM_93CX6 is not set 432 | 433 | # 434 | # Texas Instruments shared transport line discipline 435 | # 436 | 437 | # 438 | # Altera FPGA firmware download module 439 | # 440 | CONFIG_HAVE_IDE=y 441 | # CONFIG_IDE is not set 442 | 443 | # 444 | # SCSI device support 445 | # 446 | CONFIG_SCSI_MOD=y 447 | # CONFIG_RAID_ATTRS is not set 448 | # CONFIG_SCSI is not set 449 | # CONFIG_SCSI_DMA is not set 450 | # CONFIG_SCSI_NETLINK is not set 451 | # CONFIG_ATA is not set 452 | # CONFIG_MD is not set 453 | # CONFIG_MACINTOSH_DRIVERS is not set 454 | 455 | # 456 | # Input device support 457 | # 458 | CONFIG_INPUT=y 459 | # CONFIG_INPUT_FF_MEMLESS is not set 460 | # CONFIG_INPUT_POLLDEV is not set 461 | # CONFIG_INPUT_SPARSEKMAP is not set 462 | # CONFIG_INPUT_MATRIXKMAP is not set 463 | 464 | # 465 | # Userland interfaces 466 | # 467 | CONFIG_INPUT_MOUSEDEV=y 468 | # CONFIG_INPUT_MOUSEDEV_PSAUX is not set 469 | CONFIG_INPUT_MOUSEDEV_SCREEN_X=1024 470 | CONFIG_INPUT_MOUSEDEV_SCREEN_Y=768 471 | # CONFIG_INPUT_JOYDEV is not set 472 | # CONFIG_INPUT_EVDEV is not set 473 | # CONFIG_INPUT_EVBUG is not set 474 | 475 | # 476 | # Input Device Drivers 477 | # 478 | CONFIG_INPUT_KEYBOARD=y 479 | CONFIG_KEYBOARD_ATKBD=y 480 | # CONFIG_KEYBOARD_LKKBD is not set 481 | # CONFIG_KEYBOARD_NEWTON is not set 482 | # CONFIG_KEYBOARD_OPENCORES is not set 483 | # CONFIG_KEYBOARD_STOWAWAY is not set 484 | # CONFIG_KEYBOARD_SUNKBD is not set 485 | # CONFIG_KEYBOARD_XTKBD is not set 486 | # CONFIG_INPUT_MOUSE is not set 487 | # CONFIG_INPUT_JOYSTICK is not set 488 | # CONFIG_INPUT_TABLET is not set 489 | # CONFIG_INPUT_TOUCHSCREEN is not set 490 | # CONFIG_INPUT_MISC is not set 491 | 492 | # 493 | # Hardware I/O ports 494 | # 495 | CONFIG_SERIO=y 496 | CONFIG_SERIO_I8042=y 497 | # CONFIG_SERIO_SERPORT is not set 498 | # CONFIG_SERIO_CT82C710 is not set 499 | CONFIG_SERIO_LIBPS2=y 500 | # CONFIG_SERIO_RAW is not set 501 | # CONFIG_SERIO_ALTERA_PS2 is not set 502 | # CONFIG_SERIO_PS2MULT is not set 503 | # CONFIG_SERIO_ARC_PS2 is not set 504 | # CONFIG_GAMEPORT is not set 505 | 506 | # 507 | # Character devices 508 | # 509 | CONFIG_TTY=y 510 | CONFIG_VT=y 511 | CONFIG_CONSOLE_TRANSLATIONS=y 512 | CONFIG_VT_CONSOLE=y 513 | CONFIG_HW_CONSOLE=y 514 | # CONFIG_VT_HW_CONSOLE_BINDING is not set 515 | CONFIG_UNIX98_PTYS=y 516 | # CONFIG_DEVPTS_MULTIPLE_INSTANCES is not set 517 | # CONFIG_LEGACY_PTYS is not set 518 | # CONFIG_SERIAL_NONSTANDARD is not set 519 | # CONFIG_TRACE_SINK is not set 520 | # CONFIG_DEVKMEM is not set 521 | 522 | # 523 | # Serial drivers 524 | # 525 | # CONFIG_SERIAL_8250 is not set 526 | CONFIG_FIX_EARLYCON_MEM=y 527 | 528 | # 529 | # Non-8250 serial port support 530 | # 531 | # CONFIG_SERIAL_SCCNXP is not set 532 | # CONFIG_SERIAL_TIMBERDALE is not set 533 | # CONFIG_SERIAL_ALTERA_JTAGUART is not set 534 | # CONFIG_SERIAL_ALTERA_UART is not set 535 | # CONFIG_SERIAL_ARC is not set 536 | # CONFIG_IPMI_HANDLER is not set 537 | # CONFIG_HW_RANDOM is not set 538 | # CONFIG_NVRAM is not set 539 | # CONFIG_RTC is not set 540 | # CONFIG_GEN_RTC is not set 541 | # CONFIG_R3964 is not set 542 | # CONFIG_MWAVE is not set 543 | # CONFIG_PC8736x_GPIO is not set 544 | # CONFIG_NSC_GPIO is not set 545 | # CONFIG_RAW_DRIVER is not set 546 | # CONFIG_HANGCHECK_TIMER is not set 547 | # CONFIG_TCG_TPM is not set 548 | # CONFIG_TELCLOCK is not set 549 | # CONFIG_I2C is not set 550 | # CONFIG_SPI is not set 551 | # CONFIG_HSI is not set 552 | 553 | # 554 | # PPS support 555 | # 556 | # CONFIG_PPS is not set 557 | 558 | # 559 | # PPS generators support 560 | # 561 | 562 | # 563 | # PTP clock support 564 | # 565 | # CONFIG_PTP_1588_CLOCK is not set 566 | 567 | # 568 | # Enable PHYLIB and NETWORK_PHY_TIMESTAMPING to see the additional clocks. 569 | # 570 | # CONFIG_PTP_1588_CLOCK_PCH is not set 571 | CONFIG_ARCH_WANT_OPTIONAL_GPIOLIB=y 572 | CONFIG_GPIO_DEVRES=y 573 | # CONFIG_GPIOLIB is not set 574 | # CONFIG_W1 is not set 575 | # CONFIG_POWER_SUPPLY is not set 576 | # CONFIG_POWER_AVS is not set 577 | # CONFIG_HWMON is not set 578 | # CONFIG_THERMAL is not set 579 | # CONFIG_WATCHDOG is not set 580 | CONFIG_SSB_POSSIBLE=y 581 | 582 | # 583 | # Sonics Silicon Backplane 584 | # 585 | # CONFIG_SSB is not set 586 | CONFIG_BCMA_POSSIBLE=y 587 | 588 | # 589 | # Broadcom specific AMBA 590 | # 591 | # CONFIG_BCMA is not set 592 | 593 | # 594 | # Multifunction device drivers 595 | # 596 | # CONFIG_MFD_CORE is not set 597 | # CONFIG_MFD_SM501 is not set 598 | # CONFIG_MFD_TI_AM335X_TSCADC is not set 599 | # CONFIG_HTC_PASIC3 is not set 600 | # CONFIG_MFD_TMIO is not set 601 | # CONFIG_ABX500_CORE is not set 602 | # CONFIG_REGULATOR is not set 603 | # CONFIG_MEDIA_SUPPORT is not set 604 | 605 | # 606 | # Graphics support 607 | # 608 | # CONFIG_DRM is not set 609 | # CONFIG_VGASTATE is not set 610 | # CONFIG_VIDEO_OUTPUT_CONTROL is not set 611 | # CONFIG_FB is not set 612 | # CONFIG_EXYNOS_VIDEO is not set 613 | # CONFIG_BACKLIGHT_LCD_SUPPORT is not set 614 | 615 | # 616 | # Console display driver support 617 | # 618 | CONFIG_VGA_CONSOLE=y 619 | # CONFIG_VGACON_SOFT_SCROLLBACK is not set 620 | CONFIG_DUMMY_CONSOLE=y 621 | # CONFIG_SOUND is not set 622 | 623 | # 624 | # HID support 625 | # 626 | # CONFIG_HID is not set 627 | # CONFIG_USB_ARCH_HAS_OHCI is not set 628 | # CONFIG_USB_ARCH_HAS_EHCI is not set 629 | # CONFIG_USB_ARCH_HAS_XHCI is not set 630 | # CONFIG_USB_SUPPORT is not set 631 | # CONFIG_MMC is not set 632 | # CONFIG_MEMSTICK is not set 633 | # CONFIG_NEW_LEDS is not set 634 | # CONFIG_ACCESSIBILITY is not set 635 | # CONFIG_EDAC is not set 636 | # CONFIG_RTC_CLASS is not set 637 | # CONFIG_DMADEVICES is not set 638 | # CONFIG_AUXDISPLAY is not set 639 | # CONFIG_UIO is not set 640 | 641 | # 642 | # Virtio drivers 643 | # 644 | # CONFIG_VIRTIO_MMIO is not set 645 | 646 | # 647 | # Microsoft Hyper-V guest support 648 | # 649 | # CONFIG_STAGING is not set 650 | # CONFIG_X86_PLATFORM_DEVICES is not set 651 | 652 | # 653 | # Hardware Spinlock drivers 654 | # 655 | CONFIG_CLKSRC_I8253=y 656 | CONFIG_CLKEVT_I8253=y 657 | CONFIG_I8253_LOCK=y 658 | CONFIG_CLKBLD_I8253=y 659 | # CONFIG_MAILBOX is not set 660 | # CONFIG_IOMMU_SUPPORT is not set 661 | 662 | # 663 | # Remoteproc drivers 664 | # 665 | # CONFIG_STE_MODEM_RPROC is not set 666 | 667 | # 668 | # Rpmsg drivers 669 | # 670 | # CONFIG_VIRT_DRIVERS is not set 671 | # CONFIG_PM_DEVFREQ is not set 672 | # CONFIG_EXTCON is not set 673 | # CONFIG_MEMORY is not set 674 | # CONFIG_IIO is not set 675 | # CONFIG_PWM is not set 676 | # CONFIG_IPACK_BUS is not set 677 | 678 | # 679 | # Firmware Drivers 680 | # 681 | # CONFIG_EDD is not set 682 | CONFIG_FIRMWARE_MEMMAP=y 683 | # CONFIG_DELL_RBU is not set 684 | # CONFIG_DCDBAS is not set 685 | # CONFIG_DMIID is not set 686 | # CONFIG_DMI_SYSFS is not set 687 | # CONFIG_ISCSI_IBFT_FIND is not set 688 | # CONFIG_GOOGLE_FIRMWARE is not set 689 | 690 | # 691 | # File systems 692 | # 693 | CONFIG_DCACHE_WORD_ACCESS=y 694 | # CONFIG_EXT2_FS is not set 695 | # CONFIG_EXT3_FS is not set 696 | # CONFIG_EXT4_FS is not set 697 | # CONFIG_REISERFS_FS is not set 698 | # CONFIG_JFS_FS is not set 699 | # CONFIG_XFS_FS is not set 700 | # CONFIG_BTRFS_FS is not set 701 | # CONFIG_NILFS2_FS is not set 702 | # CONFIG_FS_POSIX_ACL is not set 703 | CONFIG_FILE_LOCKING=y 704 | # CONFIG_FSNOTIFY is not set 705 | # CONFIG_DNOTIFY is not set 706 | # CONFIG_INOTIFY_USER is not set 707 | # CONFIG_FANOTIFY is not set 708 | # CONFIG_QUOTA is not set 709 | # CONFIG_QUOTACTL is not set 710 | # CONFIG_AUTOFS4_FS is not set 711 | # CONFIG_FUSE_FS is not set 712 | 713 | # 714 | # Caches 715 | # 716 | # CONFIG_FSCACHE is not set 717 | 718 | # 719 | # CD-ROM/DVD Filesystems 720 | # 721 | # CONFIG_ISO9660_FS is not set 722 | # CONFIG_UDF_FS is not set 723 | 724 | # 725 | # DOS/FAT/NT Filesystems 726 | # 727 | # CONFIG_MSDOS_FS is not set 728 | # CONFIG_VFAT_FS is not set 729 | # CONFIG_NTFS_FS is not set 730 | 731 | # 732 | # Pseudo filesystems 733 | # 734 | CONFIG_PROC_FS=y 735 | # CONFIG_PROC_KCORE is not set 736 | CONFIG_PROC_SYSCTL=y 737 | CONFIG_PROC_PAGE_MONITOR=y 738 | CONFIG_SYSFS=y 739 | # CONFIG_TMPFS is not set 740 | # CONFIG_HUGETLBFS is not set 741 | # CONFIG_HUGETLB_PAGE is not set 742 | # CONFIG_CONFIGFS_FS is not set 743 | # CONFIG_MISC_FILESYSTEMS is not set 744 | CONFIG_NLS=y 745 | CONFIG_NLS_DEFAULT="iso8859-1" 746 | # CONFIG_NLS_CODEPAGE_437 is not set 747 | # CONFIG_NLS_CODEPAGE_737 is not set 748 | # CONFIG_NLS_CODEPAGE_775 is not set 749 | # CONFIG_NLS_CODEPAGE_850 is not set 750 | # CONFIG_NLS_CODEPAGE_852 is not set 751 | # CONFIG_NLS_CODEPAGE_855 is not set 752 | # CONFIG_NLS_CODEPAGE_857 is not set 753 | # CONFIG_NLS_CODEPAGE_860 is not set 754 | # CONFIG_NLS_CODEPAGE_861 is not set 755 | # CONFIG_NLS_CODEPAGE_862 is not set 756 | # CONFIG_NLS_CODEPAGE_863 is not set 757 | # CONFIG_NLS_CODEPAGE_864 is not set 758 | # CONFIG_NLS_CODEPAGE_865 is not set 759 | # CONFIG_NLS_CODEPAGE_866 is not set 760 | # CONFIG_NLS_CODEPAGE_869 is not set 761 | # CONFIG_NLS_CODEPAGE_936 is not set 762 | # CONFIG_NLS_CODEPAGE_950 is not set 763 | # CONFIG_NLS_CODEPAGE_932 is not set 764 | # CONFIG_NLS_CODEPAGE_949 is not set 765 | # CONFIG_NLS_CODEPAGE_874 is not set 766 | # CONFIG_NLS_ISO8859_8 is not set 767 | # CONFIG_NLS_CODEPAGE_1250 is not set 768 | # CONFIG_NLS_CODEPAGE_1251 is not set 769 | # CONFIG_NLS_ASCII is not set 770 | # CONFIG_NLS_ISO8859_1 is not set 771 | # CONFIG_NLS_ISO8859_2 is not set 772 | # CONFIG_NLS_ISO8859_3 is not set 773 | # CONFIG_NLS_ISO8859_4 is not set 774 | # CONFIG_NLS_ISO8859_5 is not set 775 | # CONFIG_NLS_ISO8859_6 is not set 776 | # CONFIG_NLS_ISO8859_7 is not set 777 | # CONFIG_NLS_ISO8859_9 is not set 778 | # CONFIG_NLS_ISO8859_13 is not set 779 | # CONFIG_NLS_ISO8859_14 is not set 780 | # CONFIG_NLS_ISO8859_15 is not set 781 | # CONFIG_NLS_KOI8_R is not set 782 | # CONFIG_NLS_KOI8_U is not set 783 | # CONFIG_NLS_MAC_ROMAN is not set 784 | # CONFIG_NLS_MAC_CELTIC is not set 785 | # CONFIG_NLS_MAC_CENTEURO is not set 786 | # CONFIG_NLS_MAC_CROATIAN is not set 787 | # CONFIG_NLS_MAC_CYRILLIC is not set 788 | # CONFIG_NLS_MAC_GAELIC is not set 789 | # CONFIG_NLS_MAC_GREEK is not set 790 | # CONFIG_NLS_MAC_ICELAND is not set 791 | # CONFIG_NLS_MAC_INUIT is not set 792 | # CONFIG_NLS_MAC_ROMANIAN is not set 793 | # CONFIG_NLS_MAC_TURKISH is not set 794 | # CONFIG_NLS_UTF8 is not set 795 | 796 | # 797 | # Kernel hacking 798 | # 799 | CONFIG_TRACE_IRQFLAGS_SUPPORT=y 800 | # CONFIG_PRINTK_TIME is not set 801 | CONFIG_DEFAULT_MESSAGE_LOGLEVEL=4 802 | # CONFIG_ENABLE_WARN_DEPRECATED is not set 803 | # CONFIG_ENABLE_MUST_CHECK is not set 804 | CONFIG_FRAME_WARN=1024 805 | # CONFIG_MAGIC_SYSRQ is not set 806 | # CONFIG_STRIP_ASM_SYMS is not set 807 | # CONFIG_UNUSED_SYMBOLS is not set 808 | # CONFIG_DEBUG_FS is not set 809 | # CONFIG_HEADERS_CHECK is not set 810 | # CONFIG_DEBUG_SECTION_MISMATCH is not set 811 | # CONFIG_DEBUG_KERNEL is not set 812 | # CONFIG_PANIC_ON_OOPS is not set 813 | CONFIG_PANIC_ON_OOPS_VALUE=0 814 | # CONFIG_SLUB_DEBUG_ON is not set 815 | # CONFIG_SLUB_STATS is not set 816 | CONFIG_HAVE_DEBUG_KMEMLEAK=y 817 | CONFIG_DEBUG_BUGVERBOSE=y 818 | CONFIG_DEBUG_MEMORY_INIT=y 819 | CONFIG_ARCH_WANT_FRAME_POINTERS=y 820 | # CONFIG_FRAME_POINTER is not set 821 | 822 | # 823 | # RCU Debugging 824 | # 825 | # CONFIG_SPARSE_RCU_POINTER is not set 826 | CONFIG_USER_STACKTRACE_SUPPORT=y 827 | CONFIG_HAVE_FUNCTION_TRACER=y 828 | CONFIG_HAVE_FUNCTION_GRAPH_TRACER=y 829 | CONFIG_HAVE_FUNCTION_GRAPH_FP_TEST=y 830 | CONFIG_HAVE_FUNCTION_TRACE_MCOUNT_TEST=y 831 | CONFIG_HAVE_DYNAMIC_FTRACE=y 832 | CONFIG_HAVE_DYNAMIC_FTRACE_WITH_REGS=y 833 | CONFIG_HAVE_FTRACE_MCOUNT_RECORD=y 834 | CONFIG_HAVE_SYSCALL_TRACEPOINTS=y 835 | CONFIG_HAVE_C_RECORDMCOUNT=y 836 | CONFIG_TRACING_SUPPORT=y 837 | # CONFIG_FTRACE is not set 838 | # CONFIG_DMA_API_DEBUG is not set 839 | # CONFIG_ATOMIC64_SELFTEST is not set 840 | # CONFIG_SAMPLES is not set 841 | CONFIG_HAVE_ARCH_KGDB=y 842 | CONFIG_HAVE_ARCH_KMEMCHECK=y 843 | # CONFIG_TEST_KSTRTOX is not set 844 | # CONFIG_STRICT_DEVMEM is not set 845 | # CONFIG_X86_VERBOSE_BOOTUP is not set 846 | CONFIG_EARLY_PRINTK=y 847 | CONFIG_DOUBLEFAULT=y 848 | # CONFIG_IOMMU_STRESS is not set 849 | CONFIG_HAVE_MMIOTRACE_SUPPORT=y 850 | CONFIG_IO_DELAY_TYPE_0X80=0 851 | CONFIG_IO_DELAY_TYPE_0XED=1 852 | CONFIG_IO_DELAY_TYPE_UDELAY=2 853 | CONFIG_IO_DELAY_TYPE_NONE=3 854 | CONFIG_IO_DELAY_0X80=y 855 | # CONFIG_IO_DELAY_0XED is not set 856 | # CONFIG_IO_DELAY_UDELAY is not set 857 | # CONFIG_IO_DELAY_NONE is not set 858 | CONFIG_DEFAULT_IO_DELAY_TYPE=0 859 | # CONFIG_OPTIMIZE_INLINING is not set 860 | 861 | # 862 | # Security options 863 | # 864 | # CONFIG_KEYS is not set 865 | # CONFIG_SECURITY_DMESG_RESTRICT is not set 866 | # CONFIG_SECURITY is not set 867 | # CONFIG_SECURITYFS is not set 868 | CONFIG_DEFAULT_SECURITY_DAC=y 869 | CONFIG_DEFAULT_SECURITY="" 870 | # CONFIG_CRYPTO is not set 871 | CONFIG_HAVE_KVM=y 872 | # CONFIG_VIRTUALIZATION is not set 873 | # CONFIG_BINARY_PRINTF is not set 874 | 875 | # 876 | # Library routines 877 | # 878 | CONFIG_BITREVERSE=y 879 | CONFIG_GENERIC_STRNCPY_FROM_USER=y 880 | CONFIG_GENERIC_STRNLEN_USER=y 881 | CONFIG_GENERIC_FIND_FIRST_BIT=y 882 | CONFIG_GENERIC_PCI_IOMAP=y 883 | CONFIG_GENERIC_IOMAP=y 884 | CONFIG_GENERIC_IO=y 885 | # CONFIG_CRC_CCITT is not set 886 | # CONFIG_CRC16 is not set 887 | # CONFIG_CRC_T10DIF is not set 888 | # CONFIG_CRC_ITU_T is not set 889 | CONFIG_CRC32=y 890 | # CONFIG_CRC32_SELFTEST is not set 891 | CONFIG_CRC32_SLICEBY8=y 892 | # CONFIG_CRC32_SLICEBY4 is not set 893 | # CONFIG_CRC32_SARWATE is not set 894 | # CONFIG_CRC32_BIT is not set 895 | # CONFIG_CRC7 is not set 896 | # CONFIG_LIBCRC32C is not set 897 | # CONFIG_CRC8 is not set 898 | # CONFIG_XZ_DEC is not set 899 | # CONFIG_XZ_DEC_BCJ is not set 900 | CONFIG_HAS_IOMEM=y 901 | CONFIG_HAS_IOPORT=y 902 | CONFIG_HAS_DMA=y 903 | CONFIG_ARCH_HAS_ATOMIC64_DEC_IF_POSITIVE=y 904 | # CONFIG_AVERAGE is not set 905 | # CONFIG_CORDIC is not set 906 | # CONFIG_DDR is not set 907 | -------------------------------------------------------------------------------- /mykernel-3.9.4/patches/linux-3.9.4-mykernel.patch: -------------------------------------------------------------------------------- 1 | diff -Naur linux-3.9.4.src/arch/x86/kernel/time.c linux-3.9.4.new/arch/x86/kernel/time.c 2 | --- linux-3.9.4.src/arch/x86/kernel/time.c 2016-07-20 20:06:47.750806769 +0800 3 | +++ linux-3.9.4.new/arch/x86/kernel/time.c 2016-07-20 20:08:17.874807278 +0800 4 | @@ -13,6 +13,7 @@ 5 | #include 6 | #include 7 | #include 8 | +#include 9 | #include 10 | 11 | #include 12 | @@ -57,6 +58,7 @@ 13 | static irqreturn_t timer_interrupt(int irq, void *dev_id) 14 | { 15 | global_clock_event->event_handler(global_clock_event); 16 | + my_timer_handler(); 17 | return IRQ_HANDLED; 18 | } 19 | 20 | @@ -68,6 +70,7 @@ 21 | 22 | void __init setup_default_timer_irq(void) 23 | { 24 | + printk(KERN_NOTICE "timer interrupt setup\n"); 25 | setup_irq(0, &irq0); 26 | } 27 | 28 | diff -Naur linux-3.9.4.src/include/linux/start_kernel.h linux-3.9.4.new/include/linux/start_kernel.h 29 | --- linux-3.9.4.src/include/linux/start_kernel.h 2016-07-20 20:06:29.418806666 +0800 30 | +++ linux-3.9.4.new/include/linux/start_kernel.h 2016-07-20 20:08:17.874807278 +0800 31 | @@ -8,5 +8,6 @@ 32 | up something else. */ 33 | 34 | extern asmlinkage void __init start_kernel(void); 35 | +extern void __init my_start_kernel(void); 36 | 37 | #endif /* _LINUX_START_KERNEL_H */ 38 | diff -Naur linux-3.9.4.src/include/linux/timer.h linux-3.9.4.new/include/linux/timer.h 39 | --- linux-3.9.4.src/include/linux/timer.h 2016-07-20 20:06:29.406806666 +0800 40 | +++ linux-3.9.4.new/include/linux/timer.h 2016-07-20 20:08:17.874807278 +0800 41 | @@ -251,6 +251,8 @@ 42 | 43 | extern void init_timers(void); 44 | extern void run_local_timers(void); 45 | +extern void my_timer_handler(void); 46 | + 47 | struct hrtimer; 48 | extern enum hrtimer_restart it_real_fn(struct hrtimer *); 49 | 50 | diff -Naur linux-3.9.4.src/init/main.c linux-3.9.4.new/init/main.c 51 | --- linux-3.9.4.src/init/main.c 2016-07-20 20:06:51.986806793 +0800 52 | +++ linux-3.9.4.new/init/main.c 2016-07-20 20:08:17.878807278 +0800 53 | @@ -574,7 +574,6 @@ 54 | console_init(); 55 | if (panic_later) 56 | panic(panic_later, panic_param); 57 | - 58 | lockdep_info(); 59 | 60 | /* 61 | @@ -641,6 +640,7 @@ 62 | 63 | ftrace_init(); 64 | 65 | + my_start_kernel(); 66 | /* Do the rest non-__init'ed, we're now alive */ 67 | rest_init(); 68 | } 69 | diff -Naur linux-3.9.4.src/Makefile linux-3.9.4.new/Makefile 70 | --- linux-3.9.4.src/Makefile 2016-07-20 20:06:43.022806743 +0800 71 | +++ linux-3.9.4.new/Makefile 2016-07-20 20:09:13.834807594 +0800 72 | @@ -733,7 +733,7 @@ 73 | 74 | 75 | ifeq ($(KBUILD_EXTMOD),) 76 | -core-y += kernel/ mm/ fs/ ipc/ security/ crypto/ block/ 77 | +core-y += kernel/ mm/ fs/ ipc/ security/ crypto/ block/ mysrc/ 78 | 79 | vmlinux-dirs := $(patsubst %/,%,$(filter %/, $(init-y) $(init-m) \ 80 | $(core-y) $(core-m) $(drivers-y) $(drivers-m) \ 81 | -------------------------------------------------------------------------------- /mykernel-3.9.4/src/Makefile: -------------------------------------------------------------------------------- 1 | # 2 | # Makefile for the linux mykernel. 3 | # 4 | 5 | obj-y = interrupt.o scheduler.o main.o 6 | 7 | -------------------------------------------------------------------------------- /mykernel-3.9.4/src/README.md: -------------------------------------------------------------------------------- 1 | # Welcome to the mykernel 1.1 2 | 3 | 增加了优先级调度方式 -------------------------------------------------------------------------------- /mykernel-3.9.4/src/interrupt.c: -------------------------------------------------------------------------------- 1 | /* mykernel--Simple simulation of the linux OS process schedule 2 | * 3 | * linux/mykernel/myinterrupt.c 4 | * 5 | * Kernel internal my_timer_handler 6 | * 7 | * Copyright (C) 2013 Mengning 8 | * 9 | * Modified 2014 zhyq 10 | * 11 | * 12 | * You can redistribute or modify this program under the terms 13 | * of the GNU General Public License as published by 14 | * the Free Software Foundation. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with this program. If not, see . 18 | */ 19 | 20 | #include 21 | #include 22 | #include 23 | #include 24 | #include 25 | #include 26 | #include 27 | #include 28 | #include 29 | #include 30 | #include 31 | #include 32 | #include 33 | #include 34 | #include 35 | #include 36 | #include 37 | #include 38 | #include 39 | #include 40 | #include 41 | #include 42 | 43 | #include 44 | #include 45 | #include 46 | #include 47 | #include 48 | 49 | #include 50 | #include 51 | #include 52 | #include 53 | #include 54 | 55 | #include "pcb.h" 56 | 57 | #define CREATE_TRACE_POINTS 58 | #include 59 | 60 | extern tPCB task[MAX_TASK_NUM]; 61 | extern tPCB * my_current_task; 62 | extern volatile int my_need_sched; 63 | volatile int time_count = 0; 64 | 65 | /* 66 | * Called by timer interrupt. 67 | * it runs in the name of current running process, 68 | * so it use kernel stack of current running process 69 | */ 70 | void my_timer_handler(void) 71 | { 72 | #if 1 73 | // make sure need schedule after system circle 2000 times. 74 | if(time_count%2000 == 0 && my_need_sched != 1) 75 | { 76 | my_need_sched = 1; 77 | //time_count=0; 78 | } 79 | time_count ++ ; 80 | #endif 81 | return; 82 | } 83 | 84 | -------------------------------------------------------------------------------- /mykernel-3.9.4/src/main.c: -------------------------------------------------------------------------------- 1 | /* mykernel--Simple simulation of the linux OS process schedule 2 | * 3 | * linux/mykernel/mymain.c 4 | * 5 | * Kernel internal my_timer_handler 6 | * 7 | * Copyright (C) 2013 Mengning 8 | * 9 | * Modified zhyq 10 | * 11 | * 12 | * You can redistribute or modify this program under the terms 13 | * of the GNU General Public License as published by 14 | * the Free Software Foundation. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with this program. If not, see . 18 | */ 19 | 20 | 21 | #include 22 | #include 23 | #include 24 | #include 25 | #include 26 | #include 27 | #include 28 | #include 29 | #include 30 | #include 31 | #include 32 | #include 33 | #include 34 | #include 35 | #include 36 | #include 37 | #include 38 | #include 39 | #include 40 | #include 41 | #include 42 | #include 43 | #include 44 | #include 45 | #include 46 | #include 47 | #include 48 | #include 49 | #include 50 | #include 51 | #include 52 | #include 53 | #include 54 | #include 55 | #include 56 | #include 57 | #include 58 | #include 59 | #include 60 | #include 61 | #include 62 | #include 63 | #include 64 | #include 65 | #include 66 | #include 67 | #include 68 | #include 69 | #include 70 | #include 71 | #include 72 | #include 73 | #include 74 | #include 75 | #include 76 | #include 77 | #include 78 | #include 79 | #include 80 | #include 81 | #include 82 | #include 83 | #include 84 | 85 | #include 86 | #include 87 | #include 88 | #include 89 | #include 90 | 91 | #include 92 | 93 | #include 94 | #include 95 | 96 | #ifdef CONFIG_X86_LOCAL_APIC 97 | #include 98 | #endif 99 | #include "pcb.h" 100 | 101 | tPCB task[MAX_TASK_NUM]; 102 | tPCB * my_current_task = NULL; 103 | volatile int my_need_sched = 0; 104 | 105 | void my_process(void); 106 | unsigned long get_rand(int ); 107 | 108 | void sand_priority(void) 109 | { 110 | int i; 111 | for(i=0;i0 stopped */ 120 | // set task 0 execute entry address to my_process 121 | task[pid].task_entry = task[pid].thread.ip = (unsigned long)my_process; 122 | task[pid].thread.sp = (unsigned long)&task[pid].stack[KERNEL_STACK_SIZE-1]; 123 | task[pid].next = &task[pid]; 124 | /*fork more process */ 125 | for(pid=1;pid>>process 0 running!!!<<<\n\n"); 135 | /* start process 0 by task[0] */ 136 | pid = 0; 137 | my_current_task = &task[pid]; 138 | asm volatile( 139 | "movl %1,%%esp\n\t" /* set task[pid].thread.sp to esp */ 140 | "pushl %1\n\t" /* push ebp */ 141 | "pushl %0\n\t" /* push task[pid].thread.ip */ 142 | "ret\n\t" /* pop task[pid].thread.ip to eip */ 143 | "popl %%ebp\n\t" 144 | : 145 | : "c" (task[pid].thread.ip),"d" (task[pid].thread.sp) /* input c or d mean %ecx/%edx*/ 146 | ); 147 | } 148 | void my_process(void) 149 | { 150 | int i = 0; 151 | while(1) 152 | { 153 | i++; 154 | if(i%10000000 == 0) 155 | { 156 | //printk(KERN_NOTICE "this is process %d - =WangPanPan(Soleprincess)=\n", 157 | // my_current_task->pid); 158 | 159 | if(my_need_sched == 1) 160 | { 161 | //printk(KERN_NOTICE "process %d schedule\n", my_current_task->pid); 162 | my_need_sched = 0; 163 | sand_priority(); 164 | my_schedule(); 165 | 166 | //printk(KERN_NOTICE "process %d re-schedule\n", my_current_task->pid); 167 | } 168 | //printk(KERN_NOTICE "this is process %d - =ChengJian(Gatieme)=\n", 169 | // my_current_task->pid); 170 | } 171 | } 172 | }//end of my_process 173 | 174 | //produce a random priority to a task 175 | unsigned long get_rand(max) 176 | { 177 | unsigned long a; 178 | unsigned long umax; 179 | umax=(unsigned long)max; 180 | get_random_bytes(&a, sizeof(unsigned long )); 181 | a=(a+umax)%umax; 182 | return a; 183 | } 184 | -------------------------------------------------------------------------------- /mykernel-3.9.4/src/pcb.h: -------------------------------------------------------------------------------- 1 | /* mykernel--Simple simulation of the linux OS process schedule 2 | * 3 | * linux/mykernel/mypcb.h 4 | * 5 | * Kernel internal my_timer_handler 6 | * 7 | * Copyright (C) 2013 Mengning 8 | * 9 | * Modified 2014 Yunquan Zhang 10 | * 11 | * 12 | * You can redistribute or modify this program under the terms 13 | * of the GNU General Public License as published by 14 | * the Free Software Foundation. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with this program. If not, see . 18 | */ 19 | 20 | #define MAX_TASK_NUM 10 // max num of task in system 21 | #define KERNEL_STACK_SIZE 1024*8 22 | #define PRIORITY_MAX 30 //priority range from 0 to 30 23 | 24 | /* CPU-specific state of this task */ 25 | struct Thread { 26 | unsigned long ip;//point to cpu run address 27 | unsigned long sp;//point to the thread stack's top address 28 | //todo add other attrubte of system thread 29 | }; 30 | 31 | //PCB Struct 32 | typedef struct PCB{ 33 | int pid; // pcb id 34 | volatile long state; /* -1 unrunnable, 0 runnable, >0 stopped */ 35 | char stack[KERNEL_STACK_SIZE];// each pcb stack size is 1024*8 36 | /* CPU-specific state of this task */ 37 | struct Thread thread; 38 | unsigned long task_entry;//the task execute entry memory address 39 | struct PCB *next;//pcb is a circular linked list 40 | unsigned long priority;// task priority //////// 41 | //todo add other attrubte of process control block 42 | }tPCB; 43 | 44 | //void my_schedule(int pid); 45 | void my_schedule(void); 46 | -------------------------------------------------------------------------------- /mykernel-3.9.4/src/scheduler.c: -------------------------------------------------------------------------------- 1 | /* mykernel--Simple simulation of the linux OS process schedule 2 | * 3 | * linux/mykernel/myinterrupt.c 4 | * 5 | * Kernel internal my_timer_handler 6 | * 7 | * Copyright (C) 2013 Mengning 8 | * 9 | * Modified 2014 zhyq 10 | * 11 | * 12 | * You can redistribute or modify this program under the terms 13 | * of the GNU General Public License as published by 14 | * the Free Software Foundation. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with this program. If not, see . 18 | */ 19 | 20 | #include 21 | #include 22 | #include 23 | #include 24 | #include 25 | #include 26 | #include 27 | #include 28 | #include 29 | #include 30 | #include 31 | #include 32 | #include 33 | #include 34 | #include 35 | #include 36 | #include 37 | #include 38 | #include 39 | #include 40 | #include 41 | #include 42 | 43 | #include 44 | #include 45 | #include 46 | #include 47 | #include 48 | 49 | #include 50 | #include 51 | #include 52 | #include 53 | #include 54 | 55 | #include "pcb.h" 56 | 57 | #define CREATE_TRACE_POINTS 58 | #include 59 | 60 | extern tPCB task[MAX_TASK_NUM]; 61 | extern tPCB * my_current_task; 62 | extern volatile int my_need_sched; 63 | 64 | 65 | void all_task_print(void) 66 | { 67 | int i, cnum = 62; // 68 | printk(KERN_NOTICE "\n current task is:%d all task in OS are:\n", my_current_task->pid); 69 | 70 | printk(" "); 71 | for(i = 0; i < cnum; i++) 72 | printk("-"); 73 | printk("\n | process:"); 74 | for(i = 0; i < MAX_TASK_NUM; i++) 75 | printk("| %2d ", i); 76 | printk("|\n | priority:"); 77 | for(i = 0; i < MAX_TASK_NUM; i++) 78 | printk("| %2d ", task[i].priority); 79 | 80 | printk("|\n "); 81 | for(i = 0; i < cnum; i++) 82 | printk("-"); 83 | printk("\n"); 84 | } 85 | 86 | tPCB * get_next(void) 87 | { 88 | int pid, i; 89 | tPCB * point = NULL; 90 | tPCB * hig_pri = NULL; //points to the the hightest task 91 | all_task_print( ); 92 | hig_pri = my_current_task; 93 | for(i = 0; ipriority) 95 | hig_pri = &task[i]; 96 | printk(" higst process is:%d priority is:%d\n", hig_pri->pid,hig_pri->priority); 97 | return hig_pri; 98 | 99 | }//end of priority_schedule 100 | 101 | void my_schedule(void) 102 | { 103 | tPCB * next; 104 | tPCB * prev; 105 | // if there no task running or only a task , it shouldn't need schedule 106 | if(my_current_task == NULL 107 | || my_current_task->next == NULL) 108 | { 109 | printk(KERN_NOTICE " time out!!!, but no more than 2 task,need not schedule\n"); 110 | return; 111 | } 112 | /* schedule */ 113 | 114 | next = get_next(); 115 | prev = my_current_task; 116 | printk(KERN_NOTICE " the next task is %d priority is %u\n", next->pid,next->priority); 117 | if(next->state == 0)/* -1 unrunnable, 0 runnable, >0 stopped */ 118 | {//save current scene 119 | /* switch to next process */ 120 | asm volatile( 121 | "pushl %%ebp\n\t" /* save ebp */ 122 | "movl %%esp, %0\n\t" /* save esp */ 123 | "movl %2, %%esp\n\t" /* restore esp */ 124 | "movl $1f, %1\n\t" /* save eip */ 125 | "pushl %3\n\t" 126 | "ret\n\t" /* restore eip */ 127 | "1:\t" /* next process start here */ 128 | "popl %%ebp\n\t" 129 | : "=m" (prev->thread.sp), "=m" (prev->thread.ip) 130 | : "m" (next->thread.sp), "m" (next->thread.ip) 131 | ); 132 | my_current_task = next; //switch to the next task 133 | printk(KERN_NOTICE " switch from %d process to %d process\n >>>process %d running!!!<<<\n\n", prev->pid,next->pid,next->pid); 134 | 135 | } 136 | else 137 | { 138 | next->state = 0; 139 | my_current_task = next; 140 | printk(KERN_NOTICE " switch from %d process to %d process\n >>>process %d running!!!<<<\n\n\n", prev->pid,next->pid,next->pid); 141 | 142 | /* switch to new process */ 143 | asm volatile( 144 | "pushl %%ebp\n\t" /* save ebp */ 145 | "movl %%esp, %0\n\t" /* save esp */ 146 | "movl %2, %%esp\n\t" /* restore esp */ 147 | "movl %2, %%ebp\n\t" /* restore ebp */ 148 | "movl $1f, %1\n\t" /* save eip */ 149 | "pushl %3\n\t" 150 | "ret\n\t" /* restore eip */ 151 | : "=m" (prev->thread.sp), "=m" (prev->thread.ip) 152 | : "m" (next->thread.sp), "m" (next->thread.ip) 153 | ); 154 | } 155 | 156 | return; 157 | }//end of my_schedule 158 | 159 | -------------------------------------------------------------------------------- /mykernel-4.1.0/Makefile: -------------------------------------------------------------------------------- 1 | # used by Linux kernel 2 | obj-y = mymain.o myinterrupt.o 3 | 4 | 5 | KERNEL = linux-4.1 6 | 7 | ROOT_DIR=$(shell pwd) 8 | DOWNLOAD_DIR = $(ROOT_DIR)/downloads 9 | KERNEL_DIR = $(ROOT_DIR)/kernel 10 | KERNEL_PATCH_DIR = $(KERNEL_DIR)/$(KERNEL).new 11 | KERNEL_SRC_DIR = $(KERNEL_DIR)/$(KERNEL).src 12 | 13 | 14 | PATCH_DIR = $(ROOT_DIR)/patches 15 | PATCH_FILE = linux-4_1-mykernel.patch 16 | 17 | CONFIG_DIR = $(ROOT_DIR)/configs 18 | 19 | # the generic parts 20 | LINUX_URL = https://www.kernel.org/pub/linux/kernel/v4.x 21 | LINUX_FILE = downloads/$(KERNEL).tar.xz 22 | LINUX_MD5 = "fe9dc0f6729f36400ea81aa41d614c37" 23 | #LINUX_MD5 = "8c7499c672af2e7adb88c3ea3ad03fbb" 24 | 25 | 26 | 27 | 28 | OUT = $(PWD)/.out 29 | 30 | ALL = .stamps/downloads .stamps/setup .stamps/build 31 | .PHONY: all 32 | all: $(ALL) 33 | 34 | TMPFILE := $(shell mktemp) 35 | 36 | .stamps: 37 | @mkdir -p $@ 38 | 39 | to-md5 = $1 $(addsuffix .md5,$1) 40 | %.md5: FORCE 41 | @$(if $(filter-out $(shell cat $@ 2>/dev/null),$(shell md5sum $*)),md5sum $* > $@) 42 | FORCE: 43 | 44 | $(LINUX_FILE): 45 | mkdir -p $(DOWNLOAD_DIR) 46 | (cd downloads; wget -c $(LINUX_URL)/$(KERNEL).tar.xz) 47 | 48 | .stamps/downloads: $(call to-md5,$(LINUX_FILE)) .stamps 49 | @echo $(LINUX_MD5) > $(TMPFILE) 50 | @cmp -n 32 $(TMPFILE) $<.md5 >/dev/null || (echo "File checksum mismatch!"; exit 1) 51 | @touch $@ 52 | 53 | .stamps/setup: .stamps/extract .stamps/patch .stamps/config 54 | @touch $@ 55 | 56 | .stamps/extract: $(LINUX_FILE) 57 | mkdir -p $(KERNEL_DIR) 58 | tar Jxf $< -C $(KERNEL_DIR) 59 | (cd $(KERNEL_DIR); \ 60 | mv $(KERNEL) $(KERNEL).src; \ 61 | cp -rf $(KERNEL).src $(KERNEL).new) 62 | (cd $(KERNEL_PATCH_DIR); ln -s ../../src mysrc) 63 | @touch $@ 64 | 65 | .stamps/patch: 66 | (cd $(KERNEL_PATCH_DIR); \ 67 | patch --dry-run -f -p1 < $(PATCH_DIR)/$(PATCH_FILE) >/dev/null && \ 68 | patch -p1 < $(PATCH_DIR)/$(PATCH_FILE)) || touch $@ 69 | 70 | .stamps/config: 71 | @mkdir -p $(OUT) 72 | (cd $(KERNEL_PATCH_DIR); \ 73 | cp -f $(CONFIG_DIR)/mini-x86.config $(OUT)/.config; \ 74 | make O=$(OUT) oldconfig) 75 | @touch $@ 76 | 77 | # number of CPUs 78 | ifndef CPUS 79 | CPUS := $(shell grep -c ^processor /proc/cpuinfo 2>/dev/null || \ 80 | sysctl -n hw.ncpu) 81 | endif 82 | 83 | .stamps/build: $(KERNEL_PATCH_DIR)/Makefile \ 84 | src/interrupt.c src/scheduler.c src/main.c src/pcb.h 85 | (cd $(KERNEL_PATCH_DIR); $(MAKE) O=$(OUT) -j $(CPUS)) 86 | @touch $@ 87 | 88 | .PHNOY : run 89 | run: $(OUT)/arch/x86/boot/bzImage 90 | qemu -kernel $< 91 | 92 | # --------------------------- 93 | # generate patch and patch it 94 | # --------------------------- 95 | 96 | # generate your kernel patch 97 | .PHNOY : genpatch 98 | genpatch: .stamps/extract 99 | cd $(KERNEL_DIR) 100 | diff -Naur linux-4.1.src linux-4.1.new/ >linux-4.1-mykernel.patch 101 | 102 | # patch your kernel 103 | .PHNOY : patch 104 | patch : .stamps/extract 105 | (cd $(KERNEL_PATCH_DIR); \ 106 | patch --dry-run -f -p1 < $(PATCH_DIR)/$(PATCH_FILE) >/dev/null && \ 107 | patch -p1 < $(PATCH_DIR)/$(PATCH_FILE)) || touch $@ 108 | 109 | 110 | # ---------------------------------------------------- 111 | # link and rmlink ./src to /kernel/linux-4.1.new/mysrc 112 | # ---------------------------------------------------- 113 | 114 | # remove your links 115 | .PHNOY : rmlink 116 | rmlink : 117 | rm $(KERNEL_PATCH_DIR)/mysrc 118 | 119 | # relink ./src to /kernel/linux-4.1.new/mysrc 120 | .PHNOY : link 121 | link : 122 | (cd $(KERNEL_PATCH_DIR); ln -s ../../src mysrc) 123 | 124 | 125 | # ------------ 126 | # build kernel 127 | # ------------ 128 | .PHNOY : build 129 | build : 130 | (cd $(KERNEL_PATCH_DIR); $(MAKE) O=$(OUT)) 131 | 132 | 133 | # ------------------- 134 | # clean and distclean 135 | # ------------------- 136 | 137 | # clean your work 138 | .PHONY : clean 139 | clean: 140 | $(MAKE) -C $(KERNEL_PATCH_DIR) O=$(OUT) clean 141 | rm -f .stamps/build 142 | 143 | # distclean all your work 144 | .PHONY : distclean 145 | distclean: clean 146 | rm -rf .stamps $(OUT) 147 | rm -rf $(KERNEL_DIR) 148 | -------------------------------------------------------------------------------- /mykernel-4.1.0/README.md: -------------------------------------------------------------------------------- 1 | 本项目基于kernel in kernel项目修改 2 | 3 | | name | github | website | 4 | |:-------:|:-------:|:-------:| 5 | | kernel in kernel |git@github.com:jserv/kernel-in-kernel.git | https://github.com/jserv/kernel-in-kernel | 6 | 7 | Welcome to the kernel-in-kernel repository. Here you will find the 8 | straightfoward environment to develop your own operating system kernel 9 | by means of reusing Linux kernel, that implies that you do not have to 10 | worry about low-level initilizations, platform-specific configurations, 11 | and even device drivers. 12 | 13 | This work was inspired by [mykernel](https://github.com/mengning/mykernel/), 14 | the simple simulation of the linux process scheduling. 15 | Maintained by `Jim Huang `. 16 | 17 | Build Instructions 18 | ------------------ 19 | Unless otherwise noted, file and directory names refer to this repository. 20 | 21 | 1. Install [QEMU](http://www.qemu.org) and ensure its availability of x86 support. 22 | For Debian/Ubuntu Linux, you can simply do `sudo apt-get install qemu-system-x86`. 23 | 24 | 2. Return to the kernel-in-kernel top-level directory. Do a `make`. This will 25 | do several things including downloading Linux kernel 4.1 as the base of 26 | your own kernel, configuring the minimal development environment, and 27 | building everything from scratch. 28 | 29 | 3. At present, only IA32 image is generated, but it should be reasonably easy 30 | to enable other architectures originally supported by Linux kernel. 31 | 32 | Modify Your Own Kernel 33 | ---------------------- 34 | Hacking kernel is interesting, and you should take a look over the files in 35 | the `src` directory: 36 | * `mypcb.h`: the cutomized process control block 37 | * `scheduler.c`: timer interrupt handler and simple scheduler 38 | * `main.c`: entry point 39 | 40 | Running kernel-in-kernel 41 | ------------------------ 42 | Run `make run` and and you should see this: 43 | 44 | ``` 45 | this is process 0 - 46 | this is process 0 + 47 | this is process 1 - 48 | this is process 1 + 49 | this is process 2 - 50 | this is process 2 + 51 | this is process 3 - 52 | this is process 3 + 53 | ``` 54 | 55 | Licensing 56 | ========= 57 | Since kernel-in-kernel is built directly upon Linux kernel, it is certainly 58 | licensed under GNU GPL v2. -------------------------------------------------------------------------------- /mykernel-4.1.0/configs/mini-x86.config: -------------------------------------------------------------------------------- 1 | # CONFIG_64BIT is not set 2 | 3 | CONFIG_X86_32=y 4 | CONFIG_X86=y 5 | CONFIG_INSTRUCTION_DECODER=y 6 | CONFIG_OUTPUT_FORMAT="elf32-i386" 7 | CONFIG_ARCH_DEFCONFIG="arch/x86/configs/i386_defconfig" 8 | CONFIG_LOCKDEP_SUPPORT=y 9 | CONFIG_STACKTRACE_SUPPORT=y 10 | CONFIG_HAVE_LATENCYTOP_SUPPORT=y 11 | CONFIG_MMU=y 12 | CONFIG_NEED_SG_DMA_LENGTH=y 13 | CONFIG_GENERIC_ISA_DMA=y 14 | CONFIG_GENERIC_HWEIGHT=y 15 | CONFIG_ARCH_MAY_HAVE_PC_FDC=y 16 | CONFIG_RWSEM_XCHGADD_ALGORITHM=y 17 | CONFIG_GENERIC_CALIBRATE_DELAY=y 18 | CONFIG_ARCH_HAS_CPU_RELAX=y 19 | CONFIG_ARCH_HAS_CACHE_LINE_SIZE=y 20 | CONFIG_HAVE_SETUP_PER_CPU_AREA=y 21 | CONFIG_NEED_PER_CPU_EMBED_FIRST_CHUNK=y 22 | CONFIG_NEED_PER_CPU_PAGE_FIRST_CHUNK=y 23 | CONFIG_ARCH_HIBERNATION_POSSIBLE=y 24 | CONFIG_ARCH_SUSPEND_POSSIBLE=y 25 | CONFIG_ARCH_WANT_HUGE_PMD_SHARE=y 26 | CONFIG_ARCH_WANT_GENERAL_HUGETLB=y 27 | CONFIG_ARCH_SUPPORTS_OPTIMIZED_INLINING=y 28 | CONFIG_ARCH_SUPPORTS_DEBUG_PAGEALLOC=y 29 | CONFIG_X86_32_LAZY_GS=y 30 | CONFIG_ARCH_HWEIGHT_CFLAGS="-fcall-saved-ecx -fcall-saved-edx" 31 | CONFIG_ARCH_SUPPORTS_UPROBES=y 32 | CONFIG_FIX_EARLYCON_MEM=y 33 | CONFIG_PGTABLE_LEVELS=2 34 | CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config" 35 | CONFIG_IRQ_WORK=y 36 | CONFIG_BUILDTIME_EXTABLE_SORT=y 37 | 38 | # 39 | # General setup 40 | # 41 | CONFIG_BROKEN_ON_SMP=y 42 | CONFIG_INIT_ENV_ARG_LIMIT=32 43 | CONFIG_CROSS_COMPILE="" 44 | # CONFIG_COMPILE_TEST is not set 45 | CONFIG_LOCALVERSION="" 46 | # CONFIG_LOCALVERSION_AUTO is not set 47 | CONFIG_HAVE_KERNEL_GZIP=y 48 | CONFIG_HAVE_KERNEL_BZIP2=y 49 | CONFIG_HAVE_KERNEL_LZMA=y 50 | CONFIG_HAVE_KERNEL_XZ=y 51 | CONFIG_HAVE_KERNEL_LZO=y 52 | CONFIG_HAVE_KERNEL_LZ4=y 53 | CONFIG_KERNEL_GZIP=y 54 | # CONFIG_KERNEL_BZIP2 is not set 55 | # CONFIG_KERNEL_LZMA is not set 56 | # CONFIG_KERNEL_XZ is not set 57 | # CONFIG_KERNEL_LZO is not set 58 | # CONFIG_KERNEL_LZ4 is not set 59 | CONFIG_DEFAULT_HOSTNAME="(none)" 60 | # CONFIG_SYSVIPC is not set 61 | # CONFIG_CROSS_MEMORY_ATTACH is not set 62 | # CONFIG_FHANDLE is not set 63 | # CONFIG_USELIB is not set 64 | CONFIG_HAVE_ARCH_AUDITSYSCALL=y 65 | 66 | # 67 | # IRQ subsystem 68 | # 69 | CONFIG_GENERIC_IRQ_PROBE=y 70 | CONFIG_GENERIC_IRQ_SHOW=y 71 | CONFIG_IRQ_FORCED_THREADING=y 72 | CONFIG_SPARSE_IRQ=y 73 | CONFIG_CLOCKSOURCE_WATCHDOG=y 74 | CONFIG_ARCH_CLOCKSOURCE_DATA=y 75 | CONFIG_CLOCKSOURCE_VALIDATE_LAST_CYCLE=y 76 | CONFIG_GENERIC_TIME_VSYSCALL=y 77 | CONFIG_GENERIC_CLOCKEVENTS=y 78 | CONFIG_GENERIC_CLOCKEVENTS_MIN_ADJUST=y 79 | CONFIG_GENERIC_CMOS_UPDATE=y 80 | 81 | # 82 | # Timers subsystem 83 | # 84 | CONFIG_TICK_ONESHOT=y 85 | CONFIG_HZ_PERIODIC=y 86 | # CONFIG_NO_HZ_IDLE is not set 87 | # CONFIG_NO_HZ is not set 88 | CONFIG_HIGH_RES_TIMERS=y 89 | 90 | # 91 | # CPU/Task time and stats accounting 92 | # 93 | CONFIG_TICK_CPU_ACCOUNTING=y 94 | # CONFIG_IRQ_TIME_ACCOUNTING is not set 95 | 96 | # 97 | # RCU Subsystem 98 | # 99 | CONFIG_TINY_RCU=y 100 | CONFIG_SRCU=y 101 | # CONFIG_TASKS_RCU is not set 102 | # CONFIG_RCU_STALL_COMMON is not set 103 | # CONFIG_TREE_RCU_TRACE is not set 104 | CONFIG_RCU_KTHREAD_PRIO=0 105 | # CONFIG_RCU_EXPEDITE_BOOT is not set 106 | # CONFIG_BUILD_BIN2C is not set 107 | # CONFIG_IKCONFIG is not set 108 | CONFIG_LOG_BUF_SHIFT=18 109 | CONFIG_HAVE_UNSTABLE_SCHED_CLOCK=y 110 | # CONFIG_CGROUPS is not set 111 | # CONFIG_CHECKPOINT_RESTORE is not set 112 | # CONFIG_SCHED_AUTOGROUP is not set 113 | # CONFIG_RELAY is not set 114 | # CONFIG_BLK_DEV_INITRD is not set 115 | # CONFIG_CC_OPTIMIZE_FOR_SIZE is not set 116 | CONFIG_ANON_INODES=y 117 | CONFIG_HAVE_UID16=y 118 | CONFIG_SYSCTL_EXCEPTION_TRACE=y 119 | CONFIG_HAVE_PCSPKR_PLATFORM=y 120 | CONFIG_EXPERT=y 121 | # CONFIG_MULTIUSER is not set 122 | # CONFIG_SGETMASK_SYSCALL is not set 123 | # CONFIG_SYSFS_SYSCALL is not set 124 | # CONFIG_KALLSYMS is not set 125 | CONFIG_PRINTK=y 126 | # CONFIG_BUG is not set 127 | # CONFIG_PCSPKR_PLATFORM is not set 128 | # CONFIG_BASE_FULL is not set 129 | # CONFIG_FUTEX is not set 130 | # CONFIG_EPOLL is not set 131 | # CONFIG_SIGNALFD is not set 132 | # CONFIG_TIMERFD is not set 133 | # CONFIG_EVENTFD is not set 134 | # CONFIG_BPF_SYSCALL is not set 135 | # CONFIG_SHMEM is not set 136 | # CONFIG_AIO is not set 137 | # CONFIG_ADVISE_SYSCALLS is not set 138 | # CONFIG_EMBEDDED is not set 139 | CONFIG_HAVE_PERF_EVENTS=y 140 | 141 | # 142 | # Kernel Performance Events And Counters 143 | # 144 | CONFIG_PERF_EVENTS=y 145 | # CONFIG_DEBUG_PERF_USE_VMALLOC is not set 146 | # CONFIG_VM_EVENT_COUNTERS is not set 147 | CONFIG_COMPAT_BRK=y 148 | # CONFIG_SLAB is not set 149 | # CONFIG_SLUB is not set 150 | CONFIG_SLOB=y 151 | # CONFIG_PROFILING is not set 152 | CONFIG_HAVE_OPROFILE=y 153 | CONFIG_OPROFILE_NMI_TIMER=y 154 | # CONFIG_JUMP_LABEL is not set 155 | # CONFIG_UPROBES is not set 156 | # CONFIG_HAVE_64BIT_ALIGNED_ACCESS is not set 157 | CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS=y 158 | CONFIG_ARCH_USE_BUILTIN_BSWAP=y 159 | CONFIG_HAVE_IOREMAP_PROT=y 160 | CONFIG_HAVE_KPROBES=y 161 | CONFIG_HAVE_KRETPROBES=y 162 | CONFIG_HAVE_OPTPROBES=y 163 | CONFIG_HAVE_KPROBES_ON_FTRACE=y 164 | CONFIG_HAVE_ARCH_TRACEHOOK=y 165 | CONFIG_HAVE_DMA_ATTRS=y 166 | CONFIG_HAVE_DMA_CONTIGUOUS=y 167 | CONFIG_GENERIC_SMP_IDLE_THREAD=y 168 | CONFIG_HAVE_REGS_AND_STACK_ACCESS_API=y 169 | CONFIG_HAVE_DMA_API_DEBUG=y 170 | CONFIG_HAVE_HW_BREAKPOINT=y 171 | CONFIG_HAVE_MIXED_BREAKPOINTS_REGS=y 172 | CONFIG_HAVE_USER_RETURN_NOTIFIER=y 173 | CONFIG_HAVE_PERF_EVENTS_NMI=y 174 | CONFIG_HAVE_PERF_REGS=y 175 | CONFIG_HAVE_PERF_USER_STACK_DUMP=y 176 | CONFIG_HAVE_ARCH_JUMP_LABEL=y 177 | CONFIG_ARCH_HAVE_NMI_SAFE_CMPXCHG=y 178 | CONFIG_HAVE_CMPXCHG_LOCAL=y 179 | CONFIG_HAVE_CMPXCHG_DOUBLE=y 180 | CONFIG_ARCH_WANT_IPC_PARSE_VERSION=y 181 | CONFIG_HAVE_ARCH_SECCOMP_FILTER=y 182 | CONFIG_HAVE_CC_STACKPROTECTOR=y 183 | # CONFIG_CC_STACKPROTECTOR is not set 184 | CONFIG_CC_STACKPROTECTOR_NONE=y 185 | # CONFIG_CC_STACKPROTECTOR_REGULAR is not set 186 | # CONFIG_CC_STACKPROTECTOR_STRONG is not set 187 | CONFIG_HAVE_IRQ_TIME_ACCOUNTING=y 188 | CONFIG_HAVE_ARCH_TRANSPARENT_HUGEPAGE=y 189 | CONFIG_MODULES_USE_ELF_REL=y 190 | CONFIG_ARCH_HAS_ELF_RANDOMIZE=y 191 | CONFIG_CLONE_BACKWARDS=y 192 | CONFIG_OLD_SIGSUSPEND3=y 193 | CONFIG_OLD_SIGACTION=y 194 | 195 | # 196 | # GCOV-based kernel profiling 197 | # 198 | CONFIG_ARCH_HAS_GCOV_PROFILE_ALL=y 199 | CONFIG_HAVE_GENERIC_DMA_COHERENT=y 200 | CONFIG_BASE_SMALL=1 201 | # CONFIG_MODULES is not set 202 | # CONFIG_BLOCK is not set 203 | CONFIG_INLINE_SPIN_UNLOCK_IRQ=y 204 | CONFIG_INLINE_READ_UNLOCK=y 205 | CONFIG_INLINE_READ_UNLOCK_IRQ=y 206 | CONFIG_INLINE_WRITE_UNLOCK=y 207 | CONFIG_INLINE_WRITE_UNLOCK_IRQ=y 208 | CONFIG_ARCH_SUPPORTS_ATOMIC_RMW=y 209 | CONFIG_ARCH_USE_QUEUE_RWLOCK=y 210 | # CONFIG_FREEZER is not set 211 | 212 | # 213 | # Processor type and features 214 | # 215 | # CONFIG_ZONE_DMA is not set 216 | # CONFIG_SMP is not set 217 | CONFIG_X86_FEATURE_NAMES=y 218 | # CONFIG_X86_EXTENDED_PLATFORM is not set 219 | # CONFIG_X86_32_IRIS is not set 220 | # CONFIG_SCHED_OMIT_FRAME_POINTER is not set 221 | # CONFIG_HYPERVISOR_GUEST is not set 222 | CONFIG_NO_BOOTMEM=y 223 | # CONFIG_M486 is not set 224 | # CONFIG_M586 is not set 225 | # CONFIG_M586TSC is not set 226 | # CONFIG_M586MMX is not set 227 | CONFIG_M686=y 228 | # CONFIG_MPENTIUMII is not set 229 | # CONFIG_MPENTIUMIII is not set 230 | # CONFIG_MPENTIUMM is not set 231 | # CONFIG_MPENTIUM4 is not set 232 | # CONFIG_MK6 is not set 233 | # CONFIG_MK7 is not set 234 | # CONFIG_MK8 is not set 235 | # CONFIG_MCRUSOE is not set 236 | # CONFIG_MEFFICEON is not set 237 | # CONFIG_MWINCHIPC6 is not set 238 | # CONFIG_MWINCHIP3D is not set 239 | # CONFIG_MELAN is not set 240 | # CONFIG_MGEODEGX1 is not set 241 | # CONFIG_MGEODE_LX is not set 242 | # CONFIG_MCYRIXIII is not set 243 | # CONFIG_MVIAC3_2 is not set 244 | # CONFIG_MVIAC7 is not set 245 | # CONFIG_MCORE2 is not set 246 | # CONFIG_MATOM is not set 247 | CONFIG_X86_GENERIC=y 248 | CONFIG_X86_INTERNODE_CACHE_SHIFT=6 249 | CONFIG_X86_L1_CACHE_SHIFT=6 250 | # CONFIG_X86_PPRO_FENCE is not set 251 | CONFIG_X86_INTEL_USERCOPY=y 252 | CONFIG_X86_USE_PPRO_CHECKSUM=y 253 | CONFIG_X86_TSC=y 254 | CONFIG_X86_CMPXCHG64=y 255 | CONFIG_X86_CMOV=y 256 | CONFIG_X86_MINIMUM_CPU_FAMILY=5 257 | CONFIG_X86_DEBUGCTLMSR=y 258 | # CONFIG_PROCESSOR_SELECT is not set 259 | CONFIG_CPU_SUP_INTEL=y 260 | CONFIG_CPU_SUP_CYRIX_32=y 261 | CONFIG_CPU_SUP_AMD=y 262 | CONFIG_CPU_SUP_CENTAUR=y 263 | CONFIG_CPU_SUP_TRANSMETA_32=y 264 | CONFIG_CPU_SUP_UMC_32=y 265 | # CONFIG_HPET_TIMER is not set 266 | # CONFIG_DMI is not set 267 | CONFIG_NR_CPUS=1 268 | CONFIG_PREEMPT_NONE=y 269 | # CONFIG_PREEMPT_VOLUNTARY is not set 270 | # CONFIG_PREEMPT is not set 271 | # CONFIG_X86_UP_APIC is not set 272 | # CONFIG_X86_MCE is not set 273 | # CONFIG_VM86 is not set 274 | # CONFIG_X86_16BIT is not set 275 | # CONFIG_TOSHIBA is not set 276 | # CONFIG_I8K is not set 277 | # CONFIG_X86_REBOOTFIXUPS is not set 278 | # CONFIG_MICROCODE is not set 279 | # CONFIG_X86_MSR is not set 280 | # CONFIG_X86_CPUID is not set 281 | CONFIG_NOHIGHMEM=y 282 | # CONFIG_HIGHMEM4G is not set 283 | # CONFIG_HIGHMEM64G is not set 284 | CONFIG_VMSPLIT_3G=y 285 | # CONFIG_VMSPLIT_3G_OPT is not set 286 | # CONFIG_VMSPLIT_2G is not set 287 | # CONFIG_VMSPLIT_2G_OPT is not set 288 | # CONFIG_VMSPLIT_1G is not set 289 | CONFIG_PAGE_OFFSET=0xC0000000 290 | # CONFIG_X86_PAE is not set 291 | CONFIG_ARCH_FLATMEM_ENABLE=y 292 | CONFIG_ARCH_SPARSEMEM_ENABLE=y 293 | CONFIG_ARCH_SELECT_MEMORY_MODEL=y 294 | CONFIG_ILLEGAL_POINTER_VALUE=0 295 | CONFIG_SELECT_MEMORY_MODEL=y 296 | CONFIG_FLATMEM_MANUAL=y 297 | # CONFIG_SPARSEMEM_MANUAL is not set 298 | CONFIG_FLATMEM=y 299 | CONFIG_FLAT_NODE_MEM_MAP=y 300 | CONFIG_SPARSEMEM_STATIC=y 301 | CONFIG_HAVE_MEMBLOCK=y 302 | CONFIG_HAVE_MEMBLOCK_NODE_MAP=y 303 | CONFIG_ARCH_DISCARD_MEMBLOCK=y 304 | # CONFIG_HAVE_BOOTMEM_INFO_NODE is not set 305 | CONFIG_PAGEFLAGS_EXTENDED=y 306 | CONFIG_SPLIT_PTLOCK_CPUS=4 307 | # CONFIG_COMPACTION is not set 308 | # CONFIG_PHYS_ADDR_T_64BIT is not set 309 | CONFIG_ZONE_DMA_FLAG=0 310 | CONFIG_VIRT_TO_BUS=y 311 | # CONFIG_KSM is not set 312 | CONFIG_DEFAULT_MMAP_MIN_ADDR=4096 313 | # CONFIG_TRANSPARENT_HUGEPAGE is not set 314 | CONFIG_NEED_PER_CPU_KM=y 315 | # CONFIG_CLEANCACHE is not set 316 | # CONFIG_CMA is not set 317 | # CONFIG_ZPOOL is not set 318 | # CONFIG_ZBUD is not set 319 | # CONFIG_ZSMALLOC is not set 320 | CONFIG_GENERIC_EARLY_IOREMAP=y 321 | # CONFIG_X86_PMEM_LEGACY is not set 322 | # CONFIG_X86_CHECK_BIOS_CORRUPTION is not set 323 | CONFIG_X86_RESERVE_LOW=64 324 | # CONFIG_MATH_EMULATION is not set 325 | # CONFIG_MTRR is not set 326 | # CONFIG_ARCH_RANDOM is not set 327 | # CONFIG_X86_SMAP is not set 328 | # CONFIG_X86_INTEL_MPX is not set 329 | # CONFIG_SECCOMP is not set 330 | # CONFIG_HZ_100 is not set 331 | # CONFIG_HZ_250 is not set 332 | # CONFIG_HZ_300 is not set 333 | CONFIG_HZ_1000=y 334 | CONFIG_HZ=1000 335 | CONFIG_SCHED_HRTICK=y 336 | # CONFIG_KEXEC is not set 337 | CONFIG_PHYSICAL_START=0x1000000 338 | # CONFIG_RELOCATABLE is not set 339 | CONFIG_PHYSICAL_ALIGN=0x200000 340 | # CONFIG_COMPAT_VDSO is not set 341 | # CONFIG_CMDLINE_BOOL is not set 342 | 343 | # 344 | # Power management and ACPI options 345 | # 346 | # CONFIG_SUSPEND is not set 347 | # CONFIG_PM is not set 348 | # CONFIG_SFI is not set 349 | 350 | # 351 | # CPU Frequency scaling 352 | # 353 | # CONFIG_CPU_FREQ is not set 354 | 355 | # 356 | # CPU Idle 357 | # 358 | # CONFIG_CPU_IDLE is not set 359 | # CONFIG_ARCH_NEEDS_CPU_IDLE_COUPLED is not set 360 | 361 | # 362 | # Bus options (PCI etc.) 363 | # 364 | # CONFIG_PCI is not set 365 | CONFIG_ISA_DMA_API=y 366 | # CONFIG_ISA is not set 367 | # CONFIG_SCx200 is not set 368 | # CONFIG_OLPC is not set 369 | # CONFIG_ALIX is not set 370 | # CONFIG_NET5501 is not set 371 | # CONFIG_PCCARD is not set 372 | # CONFIG_X86_SYSFB is not set 373 | 374 | # 375 | # Executable file formats / Emulations 376 | # 377 | # CONFIG_BINFMT_ELF is not set 378 | # CONFIG_BINFMT_SCRIPT is not set 379 | CONFIG_HAVE_AOUT=y 380 | # CONFIG_BINFMT_AOUT is not set 381 | # CONFIG_BINFMT_MISC is not set 382 | # CONFIG_COREDUMP is not set 383 | CONFIG_HAVE_ATOMIC_IOMAP=y 384 | # CONFIG_NET is not set 385 | 386 | # 387 | # Device Drivers 388 | # 389 | 390 | # 391 | # Generic Driver Options 392 | # 393 | # CONFIG_UEVENT_HELPER is not set 394 | # CONFIG_DEVTMPFS is not set 395 | # CONFIG_STANDALONE is not set 396 | # CONFIG_PREVENT_FIRMWARE_BUILD is not set 397 | # CONFIG_FW_LOADER is not set 398 | # CONFIG_ALLOW_DEV_COREDUMP is not set 399 | # CONFIG_DEBUG_DRIVER is not set 400 | # CONFIG_DEBUG_DEVRES is not set 401 | # CONFIG_SYS_HYPERVISOR is not set 402 | # CONFIG_GENERIC_CPU_DEVICES is not set 403 | CONFIG_GENERIC_CPU_AUTOPROBE=y 404 | # CONFIG_DMA_SHARED_BUFFER is not set 405 | 406 | # 407 | # Bus devices 408 | # 409 | # CONFIG_MTD is not set 410 | CONFIG_ARCH_MIGHT_HAVE_PC_PARPORT=y 411 | # CONFIG_PARPORT is not set 412 | 413 | # 414 | # Misc devices 415 | # 416 | # CONFIG_SENSORS_LIS3LV02D is not set 417 | # CONFIG_DUMMY_IRQ is not set 418 | # CONFIG_ENCLOSURE_SERVICES is not set 419 | # CONFIG_SRAM is not set 420 | # CONFIG_C2PORT is not set 421 | 422 | # 423 | # EEPROM support 424 | # 425 | # CONFIG_EEPROM_93CX6 is not set 426 | 427 | # 428 | # Texas Instruments shared transport line discipline 429 | # 430 | 431 | # 432 | # Altera FPGA firmware download module 433 | # 434 | 435 | # 436 | # Intel MIC Bus Driver 437 | # 438 | 439 | # 440 | # Intel MIC Host Driver 441 | # 442 | 443 | # 444 | # Intel MIC Card Driver 445 | # 446 | # CONFIG_ECHO is not set 447 | # CONFIG_CXL_BASE is not set 448 | CONFIG_HAVE_IDE=y 449 | 450 | # 451 | # SCSI device support 452 | # 453 | CONFIG_SCSI_MOD=y 454 | # CONFIG_SCSI_DMA is not set 455 | # CONFIG_MACINTOSH_DRIVERS is not set 456 | 457 | # 458 | # Input device support 459 | # 460 | CONFIG_INPUT=y 461 | # CONFIG_INPUT_FF_MEMLESS is not set 462 | # CONFIG_INPUT_POLLDEV is not set 463 | # CONFIG_INPUT_SPARSEKMAP is not set 464 | # CONFIG_INPUT_MATRIXKMAP is not set 465 | 466 | # 467 | # Userland interfaces 468 | # 469 | # CONFIG_INPUT_MOUSEDEV is not set 470 | # CONFIG_INPUT_JOYDEV is not set 471 | # CONFIG_INPUT_EVDEV is not set 472 | # CONFIG_INPUT_EVBUG is not set 473 | 474 | # 475 | # Input Device Drivers 476 | # 477 | # CONFIG_INPUT_KEYBOARD is not set 478 | # CONFIG_INPUT_MOUSE is not set 479 | # CONFIG_INPUT_JOYSTICK is not set 480 | # CONFIG_INPUT_TABLET is not set 481 | # CONFIG_INPUT_TOUCHSCREEN is not set 482 | # CONFIG_INPUT_MISC is not set 483 | 484 | # 485 | # Hardware I/O ports 486 | # 487 | # CONFIG_SERIO is not set 488 | CONFIG_ARCH_MIGHT_HAVE_PC_SERIO=y 489 | # CONFIG_GAMEPORT is not set 490 | 491 | # 492 | # Character devices 493 | # 494 | CONFIG_TTY=y 495 | CONFIG_VT=y 496 | # CONFIG_CONSOLE_TRANSLATIONS is not set 497 | CONFIG_VT_CONSOLE=y 498 | CONFIG_HW_CONSOLE=y 499 | # CONFIG_VT_HW_CONSOLE_BINDING is not set 500 | # CONFIG_UNIX98_PTYS is not set 501 | # CONFIG_LEGACY_PTYS is not set 502 | # CONFIG_SERIAL_NONSTANDARD is not set 503 | # CONFIG_TRACE_SINK is not set 504 | # CONFIG_DEVMEM is not set 505 | # CONFIG_DEVKMEM is not set 506 | 507 | # 508 | # Serial drivers 509 | # 510 | # CONFIG_SERIAL_8250 is not set 511 | 512 | # 513 | # Non-8250 serial port support 514 | # 515 | # CONFIG_SERIAL_SCCNXP is not set 516 | # CONFIG_SERIAL_TIMBERDALE is not set 517 | # CONFIG_SERIAL_ALTERA_JTAGUART is not set 518 | # CONFIG_SERIAL_ALTERA_UART is not set 519 | # CONFIG_SERIAL_ARC is not set 520 | # CONFIG_SERIAL_FSL_LPUART is not set 521 | # CONFIG_TTY_PRINTK is not set 522 | # CONFIG_IPMI_HANDLER is not set 523 | # CONFIG_HW_RANDOM is not set 524 | # CONFIG_NVRAM is not set 525 | # CONFIG_R3964 is not set 526 | # CONFIG_MWAVE is not set 527 | # CONFIG_PC8736x_GPIO is not set 528 | # CONFIG_NSC_GPIO is not set 529 | # CONFIG_HANGCHECK_TIMER is not set 530 | # CONFIG_TCG_TPM is not set 531 | # CONFIG_TELCLOCK is not set 532 | 533 | # 534 | # I2C support 535 | # 536 | # CONFIG_I2C is not set 537 | # CONFIG_SPI is not set 538 | # CONFIG_SPMI is not set 539 | # CONFIG_HSI is not set 540 | 541 | # 542 | # PPS support 543 | # 544 | # CONFIG_PPS is not set 545 | 546 | # 547 | # PPS generators support 548 | # 549 | 550 | # 551 | # PTP clock support 552 | # 553 | 554 | # 555 | # Enable PHYLIB and NETWORK_PHY_TIMESTAMPING to see the additional clocks. 556 | # 557 | CONFIG_ARCH_WANT_OPTIONAL_GPIOLIB=y 558 | # CONFIG_GPIOLIB is not set 559 | # CONFIG_W1 is not set 560 | # CONFIG_POWER_SUPPLY is not set 561 | # CONFIG_POWER_AVS is not set 562 | # CONFIG_HWMON is not set 563 | # CONFIG_THERMAL is not set 564 | # CONFIG_WATCHDOG is not set 565 | CONFIG_SSB_POSSIBLE=y 566 | 567 | # 568 | # Sonics Silicon Backplane 569 | # 570 | # CONFIG_SSB is not set 571 | CONFIG_BCMA_POSSIBLE=y 572 | 573 | # 574 | # Broadcom specific AMBA 575 | # 576 | # CONFIG_BCMA is not set 577 | 578 | # 579 | # Multifunction device drivers 580 | # 581 | # CONFIG_MFD_CORE is not set 582 | # CONFIG_MFD_CROS_EC is not set 583 | # CONFIG_HTC_PASIC3 is not set 584 | # CONFIG_MFD_KEMPLD is not set 585 | # CONFIG_MFD_MT6397 is not set 586 | # CONFIG_MFD_SM501 is not set 587 | # CONFIG_ABX500_CORE is not set 588 | # CONFIG_MFD_SYSCON is not set 589 | # CONFIG_MFD_TI_AM335X_TSCADC is not set 590 | # CONFIG_MFD_TMIO is not set 591 | # CONFIG_REGULATOR is not set 592 | # CONFIG_MEDIA_SUPPORT is not set 593 | 594 | # 595 | # Graphics support 596 | # 597 | 598 | # 599 | # Direct Rendering Manager 600 | # 601 | # CONFIG_DRM is not set 602 | 603 | # 604 | # Frame buffer Devices 605 | # 606 | # CONFIG_FB is not set 607 | # CONFIG_BACKLIGHT_LCD_SUPPORT is not set 608 | # CONFIG_VGASTATE is not set 609 | 610 | # 611 | # Console display driver support 612 | # 613 | CONFIG_VGA_CONSOLE=y 614 | # CONFIG_VGACON_SOFT_SCROLLBACK is not set 615 | CONFIG_DUMMY_CONSOLE=y 616 | CONFIG_DUMMY_CONSOLE_COLUMNS=80 617 | CONFIG_DUMMY_CONSOLE_ROWS=25 618 | # CONFIG_SOUND is not set 619 | 620 | # 621 | # HID support 622 | # 623 | # CONFIG_HID is not set 624 | CONFIG_USB_OHCI_LITTLE_ENDIAN=y 625 | # CONFIG_USB_SUPPORT is not set 626 | # CONFIG_UWB is not set 627 | # CONFIG_MMC is not set 628 | # CONFIG_MEMSTICK is not set 629 | # CONFIG_NEW_LEDS is not set 630 | # CONFIG_ACCESSIBILITY is not set 631 | # CONFIG_EDAC is not set 632 | CONFIG_RTC_LIB=y 633 | # CONFIG_RTC_CLASS is not set 634 | # CONFIG_DMADEVICES is not set 635 | # CONFIG_AUXDISPLAY is not set 636 | # CONFIG_UIO is not set 637 | # CONFIG_VIRT_DRIVERS is not set 638 | 639 | # 640 | # Virtio drivers 641 | # 642 | # CONFIG_VIRTIO_MMIO is not set 643 | 644 | # 645 | # Microsoft Hyper-V guest support 646 | # 647 | # CONFIG_STAGING is not set 648 | # CONFIG_X86_PLATFORM_DEVICES is not set 649 | # CONFIG_CHROME_PLATFORMS is not set 650 | 651 | # 652 | # Hardware Spinlock drivers 653 | # 654 | 655 | # 656 | # Clock Source drivers 657 | # 658 | CONFIG_CLKSRC_I8253=y 659 | CONFIG_CLKEVT_I8253=y 660 | CONFIG_CLKBLD_I8253=y 661 | # CONFIG_ATMEL_PIT is not set 662 | # CONFIG_SH_TIMER_CMT is not set 663 | # CONFIG_SH_TIMER_MTU2 is not set 664 | # CONFIG_SH_TIMER_TMU is not set 665 | # CONFIG_EM_TIMER_STI is not set 666 | # CONFIG_MAILBOX is not set 667 | # CONFIG_IOMMU_SUPPORT is not set 668 | 669 | # 670 | # Remoteproc drivers 671 | # 672 | # CONFIG_STE_MODEM_RPROC is not set 673 | 674 | # 675 | # Rpmsg drivers 676 | # 677 | 678 | # 679 | # SOC (System On Chip) specific Drivers 680 | # 681 | # CONFIG_SOC_TI is not set 682 | # CONFIG_PM_DEVFREQ is not set 683 | # CONFIG_EXTCON is not set 684 | # CONFIG_MEMORY is not set 685 | # CONFIG_IIO is not set 686 | # CONFIG_PWM is not set 687 | # CONFIG_IPACK_BUS is not set 688 | # CONFIG_RESET_CONTROLLER is not set 689 | # CONFIG_FMC is not set 690 | 691 | # 692 | # PHY Subsystem 693 | # 694 | # CONFIG_GENERIC_PHY is not set 695 | # CONFIG_BCM_KONA_USB2_PHY is not set 696 | # CONFIG_POWERCAP is not set 697 | # CONFIG_MCB is not set 698 | 699 | # 700 | # Android 701 | # 702 | # CONFIG_ANDROID is not set 703 | 704 | # 705 | # Firmware Drivers 706 | # 707 | # CONFIG_EDD is not set 708 | # CONFIG_FIRMWARE_MEMMAP is not set 709 | # CONFIG_DELL_RBU is not set 710 | # CONFIG_DCDBAS is not set 711 | # CONFIG_GOOGLE_FIRMWARE is not set 712 | 713 | # 714 | # File systems 715 | # 716 | CONFIG_DCACHE_WORD_ACCESS=y 717 | # CONFIG_FS_POSIX_ACL is not set 718 | # CONFIG_FILE_LOCKING is not set 719 | # CONFIG_FSNOTIFY is not set 720 | # CONFIG_DNOTIFY is not set 721 | # CONFIG_INOTIFY_USER is not set 722 | # CONFIG_FANOTIFY is not set 723 | # CONFIG_QUOTA is not set 724 | # CONFIG_QUOTACTL is not set 725 | # CONFIG_AUTOFS4_FS is not set 726 | # CONFIG_FUSE_FS is not set 727 | # CONFIG_OVERLAY_FS is not set 728 | 729 | # 730 | # Caches 731 | # 732 | # CONFIG_FSCACHE is not set 733 | 734 | # 735 | # Pseudo filesystems 736 | # 737 | # CONFIG_PROC_FS is not set 738 | # CONFIG_KERNFS is not set 739 | # CONFIG_SYSFS is not set 740 | # CONFIG_HUGETLBFS is not set 741 | # CONFIG_HUGETLB_PAGE is not set 742 | # CONFIG_CONFIGFS_FS is not set 743 | # CONFIG_MISC_FILESYSTEMS is not set 744 | # CONFIG_NLS is not set 745 | 746 | # 747 | # Kernel hacking 748 | # 749 | CONFIG_TRACE_IRQFLAGS_SUPPORT=y 750 | 751 | # 752 | # printk and dmesg options 753 | # 754 | CONFIG_PRINTK_TIME=y 755 | CONFIG_MESSAGE_LOGLEVEL_DEFAULT=4 756 | # CONFIG_BOOT_PRINTK_DELAY is not set 757 | 758 | # 759 | # Compile-time checks and compiler options 760 | # 761 | # CONFIG_DEBUG_INFO is not set 762 | # CONFIG_ENABLE_WARN_DEPRECATED is not set 763 | # CONFIG_ENABLE_MUST_CHECK is not set 764 | CONFIG_FRAME_WARN=2048 765 | # CONFIG_STRIP_ASM_SYMS is not set 766 | # CONFIG_READABLE_ASM is not set 767 | # CONFIG_UNUSED_SYMBOLS is not set 768 | # CONFIG_PAGE_OWNER is not set 769 | # CONFIG_DEBUG_FS is not set 770 | # CONFIG_HEADERS_CHECK is not set 771 | # CONFIG_DEBUG_SECTION_MISMATCH is not set 772 | CONFIG_ARCH_WANT_FRAME_POINTERS=y 773 | CONFIG_FRAME_POINTER=y 774 | # CONFIG_DEBUG_FORCE_WEAK_PER_CPU is not set 775 | # CONFIG_MAGIC_SYSRQ is not set 776 | CONFIG_DEBUG_KERNEL=y 777 | 778 | # 779 | # Memory Debugging 780 | # 781 | # CONFIG_PAGE_EXTENSION is not set 782 | # CONFIG_DEBUG_PAGEALLOC is not set 783 | # CONFIG_DEBUG_OBJECTS is not set 784 | CONFIG_HAVE_DEBUG_KMEMLEAK=y 785 | # CONFIG_DEBUG_KMEMLEAK is not set 786 | # CONFIG_DEBUG_STACK_USAGE is not set 787 | # CONFIG_DEBUG_VM is not set 788 | # CONFIG_DEBUG_VIRTUAL is not set 789 | # CONFIG_DEBUG_MEMORY_INIT is not set 790 | CONFIG_HAVE_DEBUG_STACKOVERFLOW=y 791 | # CONFIG_DEBUG_STACKOVERFLOW is not set 792 | CONFIG_HAVE_ARCH_KMEMCHECK=y 793 | # CONFIG_DEBUG_SHIRQ is not set 794 | 795 | # 796 | # Debug Lockups and Hangs 797 | # 798 | # CONFIG_LOCKUP_DETECTOR is not set 799 | # CONFIG_DETECT_HUNG_TASK is not set 800 | # CONFIG_PANIC_ON_OOPS is not set 801 | CONFIG_PANIC_ON_OOPS_VALUE=0 802 | CONFIG_PANIC_TIMEOUT=0 803 | # CONFIG_SCHED_STACK_END_CHECK is not set 804 | # CONFIG_DEBUG_TIMEKEEPING is not set 805 | 806 | # 807 | # Lock Debugging (spinlocks, mutexes, etc...) 808 | # 809 | # CONFIG_DEBUG_SPINLOCK is not set 810 | # CONFIG_DEBUG_MUTEXES is not set 811 | # CONFIG_DEBUG_WW_MUTEX_SLOWPATH is not set 812 | # CONFIG_DEBUG_LOCK_ALLOC is not set 813 | # CONFIG_PROVE_LOCKING is not set 814 | # CONFIG_LOCK_STAT is not set 815 | # CONFIG_DEBUG_ATOMIC_SLEEP is not set 816 | # CONFIG_DEBUG_LOCKING_API_SELFTESTS is not set 817 | # CONFIG_LOCK_TORTURE_TEST is not set 818 | # CONFIG_STACKTRACE is not set 819 | # CONFIG_DEBUG_KOBJECT is not set 820 | # CONFIG_DEBUG_LIST is not set 821 | # CONFIG_DEBUG_PI_LIST is not set 822 | # CONFIG_DEBUG_SG is not set 823 | # CONFIG_DEBUG_NOTIFIERS is not set 824 | # CONFIG_DEBUG_CREDENTIALS is not set 825 | 826 | # 827 | # RCU Debugging 828 | # 829 | # CONFIG_PROVE_RCU is not set 830 | # CONFIG_SPARSE_RCU_POINTER is not set 831 | # CONFIG_TORTURE_TEST is not set 832 | # CONFIG_RCU_TORTURE_TEST is not set 833 | # CONFIG_RCU_TRACE is not set 834 | # CONFIG_NOTIFIER_ERROR_INJECTION is not set 835 | # CONFIG_FAULT_INJECTION is not set 836 | CONFIG_ARCH_HAS_DEBUG_STRICT_USER_COPY_CHECKS=y 837 | # CONFIG_DEBUG_STRICT_USER_COPY_CHECKS is not set 838 | CONFIG_USER_STACKTRACE_SUPPORT=y 839 | CONFIG_HAVE_FUNCTION_TRACER=y 840 | CONFIG_HAVE_FUNCTION_GRAPH_TRACER=y 841 | CONFIG_HAVE_FUNCTION_GRAPH_FP_TEST=y 842 | CONFIG_HAVE_DYNAMIC_FTRACE=y 843 | CONFIG_HAVE_DYNAMIC_FTRACE_WITH_REGS=y 844 | CONFIG_HAVE_FTRACE_MCOUNT_RECORD=y 845 | CONFIG_HAVE_SYSCALL_TRACEPOINTS=y 846 | CONFIG_HAVE_C_RECORDMCOUNT=y 847 | CONFIG_TRACING_SUPPORT=y 848 | # CONFIG_FTRACE is not set 849 | 850 | # 851 | # Runtime Testing 852 | # 853 | # CONFIG_TEST_LIST_SORT is not set 854 | # CONFIG_BACKTRACE_SELF_TEST is not set 855 | # CONFIG_RBTREE_TEST is not set 856 | # CONFIG_ATOMIC64_SELFTEST is not set 857 | # CONFIG_TEST_HEXDUMP is not set 858 | # CONFIG_TEST_STRING_HELPERS is not set 859 | # CONFIG_TEST_KSTRTOX is not set 860 | # CONFIG_TEST_RHASHTABLE is not set 861 | # CONFIG_DMA_API_DEBUG is not set 862 | # CONFIG_TEST_UDELAY is not set 863 | # CONFIG_MEMTEST is not set 864 | # CONFIG_SAMPLES is not set 865 | CONFIG_HAVE_ARCH_KGDB=y 866 | # CONFIG_KGDB is not set 867 | # CONFIG_STRICT_DEVMEM is not set 868 | CONFIG_X86_VERBOSE_BOOTUP=y 869 | CONFIG_EARLY_PRINTK=y 870 | # CONFIG_X86_PTDUMP is not set 871 | # CONFIG_DEBUG_RODATA is not set 872 | # CONFIG_DOUBLEFAULT is not set 873 | # CONFIG_DEBUG_TLBFLUSH is not set 874 | # CONFIG_IOMMU_STRESS is not set 875 | CONFIG_HAVE_MMIOTRACE_SUPPORT=y 876 | CONFIG_IO_DELAY_TYPE_0X80=0 877 | CONFIG_IO_DELAY_TYPE_0XED=1 878 | CONFIG_IO_DELAY_TYPE_UDELAY=2 879 | CONFIG_IO_DELAY_TYPE_NONE=3 880 | CONFIG_IO_DELAY_0X80=y 881 | # CONFIG_IO_DELAY_0XED is not set 882 | # CONFIG_IO_DELAY_UDELAY is not set 883 | # CONFIG_IO_DELAY_NONE is not set 884 | CONFIG_DEFAULT_IO_DELAY_TYPE=0 885 | # CONFIG_CPA_DEBUG is not set 886 | # CONFIG_OPTIMIZE_INLINING is not set 887 | # CONFIG_X86_DEBUG_STATIC_CPU_HAS is not set 888 | 889 | # 890 | # Security options 891 | # 892 | # CONFIG_KEYS is not set 893 | # CONFIG_SECURITY_DMESG_RESTRICT is not set 894 | # CONFIG_SECURITYFS is not set 895 | CONFIG_DEFAULT_SECURITY_DAC=y 896 | CONFIG_DEFAULT_SECURITY="" 897 | # CONFIG_CRYPTO is not set 898 | CONFIG_HAVE_KVM=y 899 | # CONFIG_VIRTUALIZATION is not set 900 | # CONFIG_BINARY_PRINTF is not set 901 | 902 | # 903 | # Library routines 904 | # 905 | CONFIG_GENERIC_STRNCPY_FROM_USER=y 906 | CONFIG_GENERIC_STRNLEN_USER=y 907 | CONFIG_GENERIC_FIND_FIRST_BIT=y 908 | CONFIG_GENERIC_PCI_IOMAP=y 909 | CONFIG_GENERIC_IOMAP=y 910 | CONFIG_GENERIC_IO=y 911 | CONFIG_ARCH_HAS_FAST_MULTIPLIER=y 912 | # CONFIG_CRC_CCITT is not set 913 | # CONFIG_CRC16 is not set 914 | # CONFIG_CRC_T10DIF is not set 915 | # CONFIG_CRC_ITU_T is not set 916 | # CONFIG_CRC32 is not set 917 | # CONFIG_CRC7 is not set 918 | # CONFIG_LIBCRC32C is not set 919 | # CONFIG_CRC8 is not set 920 | # CONFIG_AUDIT_ARCH_COMPAT_GENERIC is not set 921 | # CONFIG_RANDOM32_SELFTEST is not set 922 | # CONFIG_XZ_DEC is not set 923 | # CONFIG_XZ_DEC_BCJ is not set 924 | CONFIG_HAS_IOMEM=y 925 | CONFIG_HAS_IOPORT_MAP=y 926 | CONFIG_HAS_DMA=y 927 | CONFIG_ARCH_HAS_ATOMIC64_DEC_IF_POSITIVE=y 928 | # CONFIG_AVERAGE is not set 929 | # CONFIG_CORDIC is not set 930 | # CONFIG_DDR is not set 931 | CONFIG_ARCH_HAS_SG_CHAIN=y 932 | -------------------------------------------------------------------------------- /mykernel-4.1.0/patches/linux-4_1-mykernel.patch: -------------------------------------------------------------------------------- 1 | diff --git a/Makefile b/Makefile 2 | index f5c8983..0cfa80d 100644 3 | --- a/Makefile 4 | +++ b/Makefile 5 | @@ -883,7 +883,7 @@ export mod_sign_cmd 6 | 7 | 8 | ifeq ($(KBUILD_EXTMOD),) 9 | -core-y += kernel/ mm/ fs/ ipc/ security/ crypto/ block/ 10 | +core-y += kernel/ mm/ fs/ ipc/ security/ crypto/ block/ mysrc/ 11 | 12 | vmlinux-dirs := $(patsubst %/,%,$(filter %/, $(init-y) $(init-m) \ 13 | $(core-y) $(core-m) $(drivers-y) $(drivers-m) \ 14 | diff --git a/arch/x86/kernel/time.c b/arch/x86/kernel/time.c 15 | index d39c091..28d1af5 100644 16 | --- a/arch/x86/kernel/time.c 17 | +++ b/arch/x86/kernel/time.c 18 | @@ -57,6 +57,7 @@ EXPORT_SYMBOL(profile_pc); 19 | static irqreturn_t timer_interrupt(int irq, void *dev_id) 20 | { 21 | global_clock_event->event_handler(global_clock_event); 22 | + my_timer_handler(); 23 | return IRQ_HANDLED; 24 | } 25 | 26 | @@ -68,6 +69,7 @@ static struct irqaction irq0 = { 27 | 28 | void __init setup_default_timer_irq(void) 29 | { 30 | + printk(KERN_NOTICE "timer interrupt setup\n"); 31 | if (!nr_legacy_irqs()) 32 | return; 33 | setup_irq(0, &irq0); 34 | diff --git a/include/linux/start_kernel.h b/include/linux/start_kernel.h 35 | index d3e5f27..9004b44 100644 36 | --- a/include/linux/start_kernel.h 37 | +++ b/include/linux/start_kernel.h 38 | @@ -8,5 +8,6 @@ 39 | up something else. */ 40 | 41 | extern asmlinkage void __init start_kernel(void); 42 | +extern void __init my_start_kernel(void); 43 | 44 | #endif /* _LINUX_START_KERNEL_H */ 45 | diff --git a/include/linux/timer.h b/include/linux/timer.h 46 | index 8c5a197..d22e9c0 100644 47 | --- a/include/linux/timer.h 48 | +++ b/include/linux/timer.h 49 | @@ -251,6 +251,8 @@ extern int try_to_del_timer_sync(struct timer_list *timer); 50 | 51 | extern void init_timers(void); 52 | extern void run_local_timers(void); 53 | +extern void my_timer_handler(void); 54 | + 55 | struct hrtimer; 56 | extern enum hrtimer_restart it_real_fn(struct hrtimer *); 57 | 58 | diff --git a/init/main.c b/init/main.c 59 | index 2115055..d93a869 100644 60 | --- a/init/main.c 61 | +++ b/init/main.c 62 | @@ -673,6 +673,7 @@ asmlinkage __visible void __init start_kernel(void) 63 | 64 | ftrace_init(); 65 | 66 | + my_start_kernel(); 67 | /* Do the rest non-__init'ed, we're now alive */ 68 | rest_init(); 69 | } 70 | -------------------------------------------------------------------------------- /mykernel-4.1.0/src/Makefile: -------------------------------------------------------------------------------- 1 | # used by Linux kernel 2 | obj-y = interrupt.o scheduler.o main.o 3 | -------------------------------------------------------------------------------- /mykernel-4.1.0/src/interrupt.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #include "pcb.h" 4 | 5 | extern myPCB task[MAX_TASK_NUM], *my_current_task; 6 | extern volatile int my_need_sched; 7 | volatile int time_count = 0; 8 | 9 | /* 10 | * Called by timer interrupt. 11 | * it runs in the name of current running process, 12 | * so it use kernel stack of current running process 13 | */ 14 | void my_timer_handler(void) 15 | { 16 | if (time_count % 1000 == 0 && my_need_sched != 1) 17 | my_need_sched = 1; 18 | time_count++; 19 | } 20 | -------------------------------------------------------------------------------- /mykernel-4.1.0/src/main.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #include "pcb.h" 4 | 5 | myPCB task[MAX_TASK_NUM], *my_current_task = NULL; 6 | volatile int my_need_sched = 0; 7 | 8 | static void my_process(void); 9 | 10 | void __init my_start_kernel(void) 11 | { 12 | int pid = 0; 13 | int i; 14 | 15 | /* Initialize process 0 */ 16 | task[pid].pid = pid; 17 | task[pid].state = S_runnable; 18 | task[pid].task_entry = task[pid].thread.ip = (uintptr_t) my_process; 19 | task[pid].thread.sp = 20 | (uintptr_t) &task[pid].stack[KERNEL_STACK_SIZE - 1]; 21 | task[pid].next = &task[pid]; 22 | 23 | /* fork more process */ 24 | for (i = 1; i < MAX_TASK_NUM; i++) { 25 | memcpy(&task[i], &task[0], sizeof(myPCB)); 26 | task[i].pid = i; 27 | task[i].state = S_stopped; 28 | task[i].thread.sp = 29 | (uintptr_t) &task[i].stack[KERNEL_STACK_SIZE - 1]; 30 | task[i].next = task[i-1].next; 31 | task[i-1].next = &task[i]; 32 | } 33 | 34 | /* start process 0 by task[0] */ 35 | pid = 0; 36 | my_current_task = &task[pid]; 37 | asm volatile( 38 | "movl %0, %%esp\n\t" /* set task[pid].thread.sp to esp */ 39 | "jmp my_process\n" 40 | : 41 | : "c" (task[pid].thread.sp) /* input c mean /%edx */ 42 | ); 43 | } 44 | 45 | static void my_process(void) 46 | { 47 | unsigned long i = 0; 48 | while (1) 49 | { 50 | if (i++ % 10000000) 51 | continue; 52 | 53 | //printk(KERN_NOTICE "this is process %d - =WangPanPan(Soleprincess)=\n", 54 | // my_current_task->pid); 55 | 56 | if (my_need_sched == 1) 57 | { 58 | printk(KERN_NOTICE "process %d schedule\n", my_current_task->pid); 59 | my_need_sched = 0; 60 | my_schedule(); 61 | printk(KERN_NOTICE "process %d re-schedule\n", my_current_task->pid); 62 | } 63 | 64 | //printk(KERN_NOTICE "this is process %d + =ChengJian(Gatieme)=\n", 65 | // my_current_task->pid); 66 | } 67 | } 68 | -------------------------------------------------------------------------------- /mykernel-4.1.0/src/pcb.h: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #define MAX_TASK_NUM 4 4 | #define KERNEL_STACK_SIZE (1024 * 8) 5 | 6 | /* CPU-specific state of this task */ 7 | struct myThread { 8 | uintptr_t ip; 9 | uintptr_t sp; 10 | }; 11 | 12 | enum myState { S_unrunnable = -1, S_runnable = 0, S_stopped = 1 }; 13 | typedef struct _myPCB { 14 | int pid; 15 | volatile enum myState state; 16 | char stack[KERNEL_STACK_SIZE]; 17 | /* CPU-specific state of this task */ 18 | struct myThread thread; 19 | uintptr_t task_entry; 20 | struct _myPCB *next; 21 | } myPCB; 22 | 23 | void my_schedule(void); 24 | -------------------------------------------------------------------------------- /mykernel-4.1.0/src/scheduler.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #include "pcb.h" 4 | 5 | extern myPCB task[MAX_TASK_NUM], *my_current_task; 6 | extern volatile int my_need_sched; 7 | 8 | 9 | void my_schedule(void) 10 | { 11 | myPCB *next, *prev; 12 | 13 | if (my_current_task == NULL 14 | || my_current_task->next == NULL) 15 | { 16 | printk(KERN_NOTICE " time out!!!,but no more than 2 task,need not schedule\n"); 17 | return; 18 | } 19 | printk(KERN_NOTICE ">>> %s <<<\n", __func__); 20 | /* schedule */ 21 | next = my_current_task->next; 22 | prev = my_current_task; 23 | if (next->state == S_runnable) { 24 | my_current_task = next; 25 | printk(KERN_NOTICE ">>>switch from %d to %d<<<\n", 26 | prev->pid, next->pid); 27 | /* switch to next process */ 28 | asm volatile( 29 | "movl %%esp, %0\n\t" /* save esp */ 30 | "movl %2, %%esp\n\t" /* restore esp */ 31 | "movl $1f, %1\n\t" /* save eip */ 32 | "jmp *%3\n" 33 | "1:\t" /* next process start here */ 34 | : "=m" (prev->thread.sp), "=m" (prev->thread.ip) 35 | : "m" (next->thread.sp), "m" (next->thread.ip) 36 | ); 37 | } else { 38 | next->state = S_runnable; 39 | my_current_task = next; 40 | printk(KERN_NOTICE ">>>switch to new process %d<<<\n", 41 | next->pid); 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /mykernel.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | 4 | if which qemu-system-i386 5 | then 6 | echo "" 7 | echo "**************** QEMUE has been install already ***" 8 | echo "" 9 | echo "**************** Checking for existing file *******" 10 | else 11 | echo "" 12 | echo "**************** QEMUE doesn't install ************" 13 | echo "" 14 | echo "**************** Install qemu now *****************" 15 | 16 | sudo apt-get install -y qemu >> /dev/null 17 | sudo ln -s /usr/bin/qemu-system-x86_64 /usr/bin/qemu 18 | fi 19 | 20 | 21 | if [ -d "mykernel" ]; 22 | then 23 | echo "" 24 | echo "**************** directory mykernel exist ******" 25 | echo "" 26 | echo "**************** Checking for existing file *******" 27 | else 28 | echo "git mykernel" 29 | git clone git@github.com:gatieme/mykernel.git 30 | fi 31 | 32 | if [ -d "linux-3.9.4" ]; 33 | then 34 | echo "" 35 | echo "**************** directory linux-3.9.4 exist ******" 36 | echo "" 37 | echo "**************** Checking for existing file *******" 38 | 39 | if [ ! -a "./linux-3.9.4/arch/x86/boot/bzImage" ]; 40 | then 41 | echo "" 42 | echo "**************** bzImage exist *******" 43 | 44 | else 45 | cd linux-3.9.4 46 | patch -p1 < ../mykernel/mykernel_for_linux3.9.4sc.patch 47 | make allnoconfig 48 | make 49 | cd .. 50 | fi 51 | else 52 | wget https://www.kernel.org/pub/linux/kernel/v3.x/linux-3.9.4.tar.xz 53 | xz -d linux-3.9.4.tar.xz 54 | tar -xvf linux-3.9.4.tar 55 | 56 | cd linux-3.9.4 57 | patch -p1 < ../mykernel/mykernel_for_linux3.9.4sc.patch 58 | make allnoconfig 59 | make 60 | cd .. 61 | fi 62 | 63 | pwd 64 | qemu -kernel linux-3.9.4/arch/x86/boot/bzImage 65 | --------------------------------------------------------------------------------