wiki:Dev/KernelHack

Version 21 (modified by mitty, 12 years ago) (diff)

--

tools

  • 4.3.5. Tracking Most Frequently Used System Calls
  • Kernel/CrashdumpRecipe - Ubuntu Wiki

    LKCD is a project that tries to enable enterprise style post-mortem crash analysis in Linux operating systems. It uses a special mode of kexec which allows to automatically boot a secondary kernel whenever a crash (Oops/panic) occurs. This secondary kernel will then save the state and memory of the primary kernel to a certain location of the filesystem (/var/crash on newer releases). This file can then be used by crash to gather detailed information about the problem.

how to build kernel

  • カーネルソースを展開して、「make help」でmakeオプションが表示される

(example) build 3.6.1 on Ubuntu 12.04 and install to 12.10

  • ソースの入手
  • ビルド環境構築
    • mitty@precise:~$ sudo aptitude build-dep linux
    • mitty@precise:~/linux-3.6.1$ scp mitty@quantal64:/boot/config-3.5.0-17-generic .config
  • ビルド
    • mitty@precise:~/linux-3.6.1$ make oldconfig
    • mitty@precise:~/linux-3.6.1$ make -j9
    • mitty@precise:~/linux-3.6.1$ make -j9 deb-pkg
  • debパッケージのインストール
    • mitty@precise:~$ scp linux-image-3.6.1_3.6.1-3_amd64.deb mitty@quantal64:~
    • mitty@quantal64:~$ sudo dpkg -i linux-image-3.6.1_3.6.1-3_amd64.deb

how to enhancement kernel

debugging Linux Kernel with VMware Workstation

  • http://wiki.osdev.org/VMWare
    • Guest debugging
      • These options are valid in Workstation 6.0+, and should be set in the virtual machine's .vmx file.
        debugStub.listen.guest32 = "TRUE"
        debugStub.listen.guest64 = "TRUE"
        
      • If using these options, Workstation prints a message "VMware Workstation is listening for debug connection on port 8832." into the vmware.log file. Start a GDB session (using a copy of your kernel that includes debug information), then:
        target remote localhost:8832
        
      • Standard gdb commands work in this mode (e.g. printing memory, backtrace). Note that this is a debug stub attached to the KERNEL, not a userspace program.
      • Other useful options:
        debugStub.listen.guest32.remote = "TRUE" # Allows debugging from a different computer / VM instead of localhost. # The IP for remote debugging will be that of the host.
        debugStub.listen.guest64.remote = "TRUE" # Same, but for 64-bit code
        monitor.debugOnStartGuest32 = "TRUE" # Breaks into debug stub on first instruction (warning: in BIOS!) # This will halt the VM at the very first instruction at 0xFFFF0, you could set the next breakpoint to break *0x7c00 to break when the bootloader is loaded by the BIOS
        debugStub.hideBreakpoints = "TRUE" # Allows gdb breakpoints to work
        bios.bootDelay = "3000" # Delay booting the BIOS code.
        
  • windellはVistaとのデュアルブートなため、UTCではなくlocal timeでRTCが設定されている
    • Ubuntu インストール時に、UTCにすると時計が9時間進む

x86

x64

  • viola0[1-6]でビルドする場合、そのままではx86_64のカーネルが作られるので注意