| 1 | [[PageOutline]] |
| 2 | |
| 3 | = 09/14 = |
| 4 | * Ubuntu 10.04 (x86)へVanilla Kernel 2.6.35の導入 |
| 5 | * VMゲストは、http://www.quotrader.org/vm/ubuntu1004t/ を使用 |
| 6 | |
| 7 | == download kernel source and build == |
| 8 | * windell57:linux s0711489$ wget https://github.com/torvalds/linux/tarball/v2.6.35 -O torvalds-linux-v2.6.35-0-g9fe6206.tar.gz --no-check-certificate |
| 9 | * windell57:linux s0711489$ tar xzfv torvalds-linux-v2.6.35-0-g9fe6206.tar.gz |
| 10 | * windell57:linux s0711489$ cd torvalds-linux-d786bf1/ |
| 11 | |
| 12 | * windell57:torvalds-linux-d786bf1 s0711489$ export INSTALL_PATH=/home/ugrad/07/s0711489/build/boot/ |
| 13 | * windell57:torvalds-linux-d786bf1 s0711489$ export INSTALL_MOD_PATH=/home/ugrad/07/s0711489/build/ |
| 14 | |
| 15 | * windell57:torvalds-linux-d786bf1 s0711489$ make defconfig |
| 16 | * windell57:torvalds-linux-d786bf1 s0711489$ make menuconfig |
| 17 | * 記録忘れ |
| 18 | * 覚えている限りだと、 |
| 19 | * Networking support からIPv6とWirelessなどの削除 |
| 20 | * Device Drivers へdevtmpfsとSCSI low-level driversのBusLogic SCSI supportの導入 |
| 21 | * File systems からNetwork File Systemsの削除 |
| 22 | * Kernel hacking へCompile the kernel with debug infoの導入 |
| 23 | * Virtualizationの削除 |
| 24 | |
| 25 | * windell57:torvalds-linux-d786bf1 s0711489$ make -j2 |
| 26 | * windell57:torvalds-linux-d786bf1 s0711489$ make modules |
| 27 | |
| 28 | * windell57:torvalds-linux-d786bf1 s0711489$ make install |
| 29 | {{{ |
| 30 | sh /tmp/linux/torvalds-linux-d786bf1/arch/x86/boot/install.sh 2.6.35 arch/x86/boot/bzImage \ |
| 31 | System.map "/home/ugrad/07/s0711489/build/boot/" |
| 32 | ln: `/home/ugrad/07/s0711489/build/boot///home/ugrad/07/s0711489/build/boot//System.map-2.6.35' へのシンボリックリンク `/boot/System.map' を作成します: 許可がありません |
| 33 | ln: `/home/ugrad/07/s0711489/build/boot///home/ugrad/07/s0711489/build/boot//vmlinuz-2.6.35' へのシンボリックリンク `/boot/vmlinuz' を作成します: 許可がありません |
| 34 | ln: `/home/ugrad/07/s0711489/build/boot///home/ugrad/07/s0711489/build/boot//System.map-2.6.35' へのシンボリックリンク `/boot/System.map' を作成します: 許可がありません |
| 35 | }}} |
| 36 | * どうやら環境変数を指定してのmake installは古いやり方らしく(?)、一部エラーとなる |
| 37 | * windell57:torvalds-linux-d786bf1 s0711489$ make modules_install |
| 38 | {{{ |
| 39 | INSTALL arch/x86/kernel/test_nx.ko |
| 40 | INSTALL drivers/scsi/scsi_wait_scan.ko |
| 41 | INSTALL lib/crc16.ko |
| 42 | INSTALL net/netfilter/xt_mark.ko |
| 43 | DEPMOD 2.6.35 |
| 44 | }}} |
| 45 | |
| 46 | == packaging kernel == |
| 47 | * ~/build にコピーされた物をとりあえずtarballにし、ゲストOSにscpする |
| 48 | |
| 49 | * windell57:build s0711489$ tar czf kernel-2.6.35.tar.gz * |
| 50 | |
| 51 | * windell57:build s0711489$ scp kernel-2.6.35.tar.gz user@172.16.237.130:~ |
| 52 | {{{ |
| 53 | user@172.16.237.130's password: |
| 54 | kernel-2.6.35.tar.gz 100% 8326KB 8.1MB/s 00:00 |
| 55 | }}} |
| 56 | |
| 57 | == install kernel == |
| 58 | * user@ubuntu:~$ sudo cp kernel-2.6.35.tar.gz / |
| 59 | * user@ubuntu:/$ sudo tar xzf kernel-2.6.35.tar.gz |
| 60 | |
| 61 | * user@ubuntu:/$ sudo mkinitramfs -o /boot/initrd.img-2.6.35 2.6.35 |
| 62 | |
| 63 | * user@ubuntu:/$ sudo vim /etc/default/grub |
| 64 | {{{ |
| 65 | # GRUB_HIDDEN_TIMEOUT=0 |
| 66 | GRUB_HIDDEN_TIMEOUT_QUIET=false |
| 67 | }}} |
| 68 | |
| 69 | * user@ubuntu:/$ sudo update-grub |
| 70 | {{{ |
| 71 | Generating grub.cfg ... |
| 72 | Found linux image: /boot/vmlinuz-2.6.35 |
| 73 | Found initrd image: /boot/initrd.img-2.6.35 |
| 74 | Found linux image: /boot/vmlinuz-2.6.35.old |
| 75 | Found initrd image: /boot/initrd.img-2.6.35 |
| 76 | Found linux image: /boot/vmlinuz-2.6.32-33-generic |
| 77 | Found initrd image: /boot/initrd.img-2.6.32-33-generic |
| 78 | Found memtest86+ image: /boot/memtest86+.bin |
| 79 | done |
| 80 | }}} |
| 81 | |
| 82 | == 結論 == |
| 83 | * 起動には成功 |
| 84 | * NICのドライバ(PCnet32)を設定し忘れたため、ゲスト側でNICが使えずはまる(気づかずにこの日を終える) |
| 85 | * gdbを使ったリモートデバッグの動作確認もOK |
| 86 | * windell57:torvalds-linux-d786bf1 s0711489$ gdb |
| 87 | {{{ |
| 88 | (gdb) file vmlinux |
| 89 | Reading symbols from /tmp/linux/torvalds-linux-d786bf1/vmlinux...(no debugging symbols found)...done. |
| 90 | (gdb) target remote localhost:8832 |
| 91 | Remote debugging using localhost:8832 |
| 92 | 0xc1007c23 in native_safe_halt () |
| 93 | at /tmp/linux/torvalds-linux-d786bf1/arch/x86/include/asm/irqflags.h:49 |
| 94 | 49 asm volatile("sti; hlt": : :"memory"); |
| 95 | (gdb) n |
| 96 | default_idle () at arch/x86/kernel/process.c:386 |
| 97 | 386 current_thread_info()->status |= TS_POLLING; |
| 98 | (gdb) |
| 99 | 392 } |
| 100 | (gdb) |
| 101 | cpu_idle () at arch/x86/kernel/process_32.c:101 |
| 102 | 101 while (!need_resched()) { |
| 103 | (gdb) |
| 104 | 115 tick_nohz_restart_sched_tick(); |
| 105 | (gdb) |
| 106 | 117 schedule(); |
| 107 | (gdb) |
| 108 | 100 tick_nohz_stop_sched_tick(1); |
| 109 | (gdb) |
| 110 | 101 while (!need_resched()) { |
| 111 | (gdb) |
| 112 | 115 tick_nohz_restart_sched_tick(); |
| 113 | (gdb) |
| 114 | 117 schedule(); |
| 115 | (gdb) |
| 116 | 100 tick_nohz_stop_sched_tick(1); |
| 117 | (gdb) detach |
| 118 | Ending remote debugging. |
| 119 | (gdb) quit |
| 120 | }}} |