# 2024q1 Homework6 (integration) contributed by < [yy214123](https://github.com/yy214123) > ## 前期準備 依照 [M06: integration](https://hackmd.io/@sysprog/linux2024-integration/%2F%40sysprog%2Flinux2024-integration-a#-%E6%92%B0%E5%AF%AB-Linux-%E6%A0%B8%E5%BF%83%E6%A8%A1%E7%B5%84) 的說明逐步執行對應的命令,但在編譯測試環節,當我輸入: ```shell $ make check ``` 並沒有下方說明所說的出現兩次綠色的 `Passed [-]`,其顯示出的資訊如下: ```shell! Git hooks are installed successfully. cc -Wall -Werror -o user user.c cc -Wall -Werror -o test_xoro test_xoro.c make -C /lib/modules/6.5.0-28-generic/build M=/home/boju/Linux2024/ksort modules make[1]: 進入目錄「/usr/src/linux-headers-6.5.0-28-generic」 warning: the compiler differs from the one used to build the kernel The kernel was built by: x86_64-linux-gnu-gcc-12 (Ubuntu 12.3.0-1ubuntu1~22.04) 12.3.0 You are using: gcc-12 (Ubuntu 12.3.0-1ubuntu1~22.04) 12.3.0 CC [M] /home/boju/Linux2024/ksort/sort_mod.o CC [M] /home/boju/Linux2024/ksort/sort_impl.o LD [M] /home/boju/Linux2024/ksort/sort.o CC [M] /home/boju/Linux2024/ksort/xoro_mod.o LD [M] /home/boju/Linux2024/ksort/xoro.o MODPOST /home/boju/Linux2024/ksort/Module.symvers CC [M] /home/boju/Linux2024/ksort/sort.mod.o LD [M] /home/boju/Linux2024/ksort/sort.ko BTF [M] /home/boju/Linux2024/ksort/sort.ko Skipping BTF generation for /home/boju/Linux2024/ksort/sort.ko due to unavailability of vmlinux CC [M] /home/boju/Linux2024/ksort/xoro.mod.o LD [M] /home/boju/Linux2024/ksort/xoro.ko BTF [M] /home/boju/Linux2024/ksort/xoro.ko Skipping BTF generation for /home/boju/Linux2024/ksort/xoro.ko due to unavailability of vmlinux make[1]: 離開目錄「/usr/src/linux-headers-6.5.0-28-generic」 make insmod make[1]: 進入目錄「/home/boju/Linux2024/ksort」 make -C /lib/modules/6.5.0-28-generic/build M=/home/boju/Linux2024/ksort modules make[2]: 進入目錄「/usr/src/linux-headers-6.5.0-28-generic」 warning: the compiler differs from the one used to build the kernel The kernel was built by: x86_64-linux-gnu-gcc-12 (Ubuntu 12.3.0-1ubuntu1~22.04) 12.3.0 You are using: gcc-12 (Ubuntu 12.3.0-1ubuntu1~22.04) 12.3.0 make[2]: 離開目錄「/usr/src/linux-headers-6.5.0-28-generic」 sudo insmod sort.ko sudo insmod xoro.ko make[1]: 離開目錄「/home/boju/Linux2024/ksort」 sudo ./user Sorting succeeded! sudo ./test_xoro n_bytes=0 n_bytes_read=0 value=0000000000000000 n_bytes=1 n_bytes_read=1 value=000000000000005f n_bytes=2 n_bytes_read=2 value=000000000000ed8e n_bytes=3 n_bytes_read=3 value=0000000000747c6a n_bytes=4 n_bytes_read=4 value=00000000c61be1dd n_bytes=5 n_bytes_read=5 value=000000f069befa4a n_bytes=6 n_bytes_read=6 value=0000ebab275f98f0 n_bytes=7 n_bytes_read=7 value=0042569408ac9f4b n_bytes=8 n_bytes_read=8 value=16b355d705d7d6d7 n_bytes=9 n_bytes_read=8 value=0b7f14b4fc108855 make rmmod make[1]: 進入目錄「/home/boju/Linux2024/ksort」 make[1]: 離開目錄「/home/boju/Linux2024/ksort」 ``` 而後續的執行其他命令輸出結果皆與作業說明一致。我不知道為什麼會沒出現兩次綠色 `Passed [-]`。 ## 自我檢查清單 - [x] 在自己的實體電腦運作 GNU/Linux - [ ] 閱讀〈[Linux 核心模組運作原理](https://hackmd.io/@sysprog/linux-kernel-module)〉 當執行編譯核心模組的命令時,出現了下面的敘述: ```shell $ make -C /lib/modules/6.5.0-28-generic/build M=`pwd` modules warning: the compiler differs from the one used to build the kernel The kernel was built by: x86_64-linux-gnu-gcc-12 (Ubuntu 12.3.0-1ubuntu1~22.04) 12.3.0 You are using: gcc-12 (Ubuntu 12.3.0-1ubuntu1~22.04) 12.3.0 ``` 根據教材中描述,這警告表示我的編譯器版本與 kernel 所用的版本可能不一致。