linux
找到README文件
cd /mnt/e/CLionProjects/linux-3.10.99/linux-3.10.99 sudo useradd linux3x sudo passwd linux3x sudo mkdir /home/linux3x sudo chown linux3x:linu3x /home/linux3x sudo chmod 755 /home/linux3x su - linux3x mkdir ~/build mkdir ~/build/kernel exit make O=/home/linux3x/build/kernel menuconfig make O=/home/linux3x/build/kernel # sudo make O=/home/linux3x/build/kernel modules_install install
mzh@DESKTOP-GITL67P:~$ gcc --version
gcc (Ubuntu 9.4.0-1ubuntu1~20.04.1) 9.4.0
Copyright (C) 2019 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
因为当前gcc版本是9.x, 找不到 compiler-gcc9.h, 复制compiler-gcc5.h成compiler-gcc9.h
Kernel doesn't support PIC mode for compiling?
# force no-pie for distro compilers that enable pie by default
KBUILD_CFLAGS += $(call cc-option, -fno-pie)
KBUILD_CFLAGS += $(call cc-option, -no-pie)
KBUILD_AFLAGS += $(call cc-option, -fno-pie)
KBUILD_CPPFLAGS += $(call cc-option, -fno-pie)
cp E:\CLionProjects\linux-3.10.99\linux-3.10.99\include\linux\compiler-gcc5.h E:\CLionProjects\linux-3.10.99\linux-3.10.99\include\linux\compiler-gcc9.h
CLion头文件报错
标红,不能跳转
sudo cp -r ./include/linux/ /usr/local/include/
不要copy到/usr/include, 否则当前运行的操作系统坏了。
mzh@DESKTOP-GITL67P:/mnt/e/CLionProjects/linux-3.10.99/linux-3.10.99$ sudo rsync -avz ./include/ /usr/local/include/
对于报错Time skewed
sudo ntpdate -uv time.windows.com