I'm a beginner at Linux Kernel. Now I'm trying to write a module to set page table by myself.
My computer is x86 and the kernel version is 5.4.0.
First I use the kernel parameter memmap to reserve some memory, then I try to set page table for the reserved memory.
I use pud_alloc in my code and include <linux/mm.h>, but then I see this error:
ERROR: "__pud_alloc" [/root/sun_fs/sunfs.ko] undefined!
ERROR: "init_mm" [/root/sun_fs/sunfs.ko] undefined!
make[2]: *** [scripts/Makefile.modpost:94: __modpost] Error 1
make[1]: *** [Makefile:1670: modules] Error 2
make[1]: Leaving directory '/usr/src/linux-headers-5.4.0-65-generic'
make: *** [Makefile:9: default] Error 2
Both __pud_alloc and init_mm are undefined.
I find __pud_alloc is declared in /include/linux/mm.h and defined in mm/memory.c. But why I can't use it?
Do I have another way to set page table manually?
Related
Here's what's going on. I'm trying to set up OpenSceneGraph, however I run into the following error during the make process (spaces added for easier reading):
/usr/bin/ld: /usr/local/lib/libavformat.a(allformats.o): relocation R_X86_64_32 against `ff_a64_muxer' can not be used when making a shared object; recompile with -fPIC
/usr/local/lib/libavformat.a: error adding symbols: Bad value
collect2: error: ld returned 1 exit status
src/osgPlugins/ffmpeg/CMakeFiles/osgdb_ffmpeg.dir/build.make:291: recipe for target 'lib/osgPlugins-3.4.0/osgdb_ffmpeg.so' failed
make[2]: *** [lib/osgPlugins-3.4.0/osgdb_ffmpeg.so] Error 1
CMakeFiles/Makefile2:6663: recipe for target
'src/osgPlugins/ffmpeg/CMakeFiles/osgdb_ffmpeg.dir/all' failed
make[1]: *** [src/osgPlugins/ffmpeg/CMakeFiles/osgdb_ffmpeg.dir/all] Error 2
make[1]: *** Waiting for unfinished jobs....
This error does not stop the cmake process. A little later (error above occurs at 39%, process fails at 46%), I get this error:
Makefile:127: recipe for target 'all' failed
make: *** [all] Error 2
Then the process stops.
I've looked at some other solutions, but they didn't have what I needed (here and here). I've run cmake with the -fPIC flag and that didn't solve anything.
I found a potential solution here but I don't know how to implement "recompile your FFmpeg/libavcodec/libavformat with pic enabled". Can anyone talk me through it or give me a good resource? I've never done it before and I don't want to mess up my computer.
Any help would be much appreciated. Thanks in advance!
I have modified the clang. It was working properly. But then I had some git related issues so I cleaned the git and checked out again. Now when I try to run make clean in clang I am getting the following error. How can I fix this?
#A set of warnings here
make[5]: Entering directory `/home/test/llvm/projects/compiler-rt'
make/platform/clang_linux.mk:16: *** "unable to infer compiler target triple for clang". Stop.
make[5]: Leaving directory `/home/test/llvm/projects/compiler-rt'
make[4]: *** [CleanRuntimeLibraries] Error 2
make[4]: Leaving directory `/home/test/llvm/tools/clang/runtime/compiler-rt'
make[3]: *** [compiler-rt/.makeclean] Error 2
make[3]: Leaving directory `/home/test/llvm/tools/clang/runtime'
make[2]: *** [clean] Error 1
make[2]: Leaving directory `/home/test/llvm/tools/clang'
make[1]: *** [clang/.makeclean] Error 2
make[1]: Leaving directory `/home/test/llvm/tools'
make: *** [clean] Error 1
I had this problem, and solved it. My problem was the link for clang failed (error 9) because I didn't have enough memory. It needs about 4 gig of memory to link, and I only had 3.5 total real memory and swap available.
Look just before these errors and possibly, you'll see that the link for clang failed.
ls the clang executable at {your build directory}/Debug+Asserts/bin/clang mine was zero bytes (because of link failure).
It then generated the "unable to infer compiler target triple" because it didn't have a clang to execute.
My solution was to create a swap file (because I didn't have any space to expand my swap partition) following the instructions at geek swap definition
I solved this error by setting the LD_LIBRARY_PATH environment variable correctly. At first, I set it without the lib64.
I installed llvm on my $HOME/local so, the correct LD_LIBRARY_PATH would be.
export LD_LIBRARY_PATH="$LD_LIBRARY_PATH”:$HOME/local/lib:$HOME/local/lib64
I am trying to compile GCC for Cygwin with support for targeting i386-elf so I can compile some simple OSes (search Benu, by l30nard0, on Github). I've successfully compiled the binutils for i386-elf, and compiled all of GCC's floating-point numbers dependencies.
Problem is, it says windows.h can not be found. I do have w32api successfully installed, and tried including each of those one at a time in the include path for GCC, but none of them work. If I try any of them, I get so many errors and warnings that not all will show up in the Cygwin console. The dozens upon dozens of warnings are most if not all unused parameter.
Does anyone know where the problem might lie?
I've wasted the last three entire days of my life trying to get Linux Mint set up with everything I want, but for reasons I shan't go into I gave up on that. I'd love to be able to get just one thing to work so I can enjoy my life again. :) Thanks!
BTW: The configure arguments I used were --target=i386-elf --enable-threads=win32 --enable-languages=c,c++ Was I supposed to use --enable-targets instead?
And here's part of the log:
In file included from ../../../gcc/libgcc/gthr.h:150:0,
from ../../../gcc/libgcc/unwind-dw2.c:38:
./gthr-default.h:541:21: fatal error: windows.h: No such file or directory
compilation terminated.
../../../gcc/libgcc/static-object.mk:17: recipe for target 'unwind-dw2.o' failed
make[2]: *** [unwind-dw2.o] Error 1
make[2]: *** Waiting for unfinished jobs....
In file included from ../../../gcc/libgcc/gthr.h:150:0,
from ../../../gcc/libgcc/unwind-dw2-fde.c:38:
./gthr-default.h:541:21: fatal error: windows.h: No such file or directory
compilation terminated.
../../../gcc/libgcc/static-object.mk:17: recipe for target 'unwind-dw2-fde.o' failed
make[2]: *** [unwind-dw2-fde.o] Error 1
make[2]: Leaving directory '/home/Sean/gccbuild/i386-elf/libgcc'
Makefile:10055: recipe for target 'all-target-libgcc' failed
make[1]: *** [all-target-libgcc] Error 2
make[1]: Leaving directory '/home/Sean/gccbuild'
Makefile:870: recipe for target 'all' failed
make: *** [all] Error 2
Remove the --enable-threads=win32 flag; it is intended to specify thread support on the target system, not the build system.
I'm having a problem installing a driver for my Silabs USB to UART bridge.
I download my driver from here:
http://www.silabs.com/products/mcu/Pages/USBtoUARTBridgeVCPDrivers.aspx
I'm running Ubuntu 12.04 32bit Kernel Linux 3.5.0-27-generic
The instructions say that make (your cp2010x driver)
cp cp2010x.ko to /libmodules/<kernel>/kernel/driver/usb/serial
insmod /libmodules/<kernel>/kernel/driver/usb/serial/usbserial.ko
insmod xp2010x.ko
However, I get this error when I try to call make:
root#grace:/home/admin/Desktop/usb# make
make -C /lib/modules/3.5.0-27-generic/build M=/home/admin/Desktop/usb modules
make[1]: Entering directory `/usr/src/linux-headers-3.5.0-27-generic'
CC [M] /home/admin/Desktop/usb/cp210x.o
/home/admin/Desktop/usb/cp210x.c:164:12: error: ‘usb_serial_probe’ undeclared here (not in a function)
/home/admin/Desktop/usb/cp210x.c:165:16: error: ‘usb_serial_disconnect’ undeclared here (not in a function)
/home/admin/Desktop/usb/cp210x.c: In function ‘cp210x_init’:
/home/admin/Desktop/usb/cp210x.c:989:2: error: implicit declaration of function ‘usb_serial_register’ [-Werror=implicit-function-declaration]
/home/admin/Desktop/usb/cp210x.c:996:3: error: implicit declaration of function ‘usb_serial_deregister’ [-Werror=implicit-function-declaration]
cc1: some warnings being treated as errors
make[2]: *** [/home/admin/Desktop/usb/cp210x.o] Error 1
make[1]: *** [_module_/home/admin/Desktop/usb] Error 2
make[1]: Leaving directory `/usr/src/linux-headers-3.5.0-27-generic'
make: *** [all] Error 2
I am new to Linux. I've Googled the error a lot but I can't find any answers that works.
According to this forum post, those drivers have actually been a part of the kernel since March 2009. You can see the file at drivers/usb/serial/cp210x.c (here is a link to the file in the latest stable version of the kernel).
I am trying to compile the Linux kernel on my Ubuntu machine
But I am getting the following error. I've searched on Google but have not been able to find any error related to this.
drivers/platform/x86/intel_scu_ipc.c: In function ‘pwr_reg_rdwr’:
drivers/platform/x86/intel_scu_ipc.c:175: error: ‘MRST_CPU_CHIP_PENWELL’ undeclared (first use in this function)
drivers/platform/x86/intel_scu_ipc.c:175: error: (Each undeclared identifier is reported only once
drivers/platform/x86/intel_scu_ipc.c:175: error: for each function it appears in.)
drivers/platform/x86/intel_scu_ipc.c: In function ‘intel_scu_ipc_init’:
drivers/platform/x86/intel_scu_ipc.c:741: error: implicit declaration of function ‘mrst_identify_cpu’
make[3]: *** [drivers/platform/x86/intel_scu_ipc.o] Error 1
make[2]: *** [drivers/platform/x86] Error 2
make[1]: *** [drivers/platform] Error 2
make: *** [drivers] Error 2
It is highly likely that you are building the kernel with a configuration that has a mistake. It happens occasionally; there are hundreds of configuration options, and they can't all be checked.
The first thing you want to do is confirm that you are able to build at least some configuration. So, just build a default configuration. This is primarily to rule out operator error:
make distclean
make defconfig
make
If that fails there may be problems with your setup / environment. Try an older kernel, and report back here. If you are able to build the default configuration then you should report the failed configuration to the Linux Kernel Mailing List
http://www.lkml.org
From there they will be able to help you, tell you to wait, or direct you to a subsystem maintainer for the failed driver.