How can I install a kernel version with a specific name? - linux-kernel

I'd like to manually compile multiple versions of the same Linux kernel which would differ only for few minor things (e.g. debug symbols) and install them on my host. I would need to have the modules installed in different paths so I could compare the different versions of the .ko files.
If possible in the end I would like to have one image called vmlinux-6.0.7-debug and one called vmlinux-6.0.7 and the modules to be installed in /lib/modules/debug and /lib/modules/nodebug
I tried to manually rename the bzImage and to export the INSTALL_DIR but I had no luck.
Anyone can show me the set of commands?
Thanks

Related

How do you share your GOPATH via Dropbox (or similar) across multiple platforms

I develop across 3 different platforms, Windows, OS X and Ubuntu Linux.
I use Dropbox to synchronize my code between all 3 platforms.
The problem I have is compiled binaries on OS X and Linux get the same name, so binaries in my GOPATH are always overwriting each other. I don't have this problem with Windows because binaries always compile with a .exe extension.
Has anyone else experienced this problem, and if so, how did you get around it?
The solution is simple: only share the $GOPATH/src folder across your computers, there is really no need to share the complete $GOPATH as package objects ($GOPATH/pkg) and binaries ($GOPATH/bin) compiled to one platform have no real use on other platforms, and they are reproducible by a simple compilation.
This will also reduce the storage and bandwidth. If for some reason you would still need the compiled binaries for other platforms, the go tool has built-in support for cross compilation, e.g. GOOS=windows go build will simply produce you the Windows executable binary of the package whose folder you're in in any OS, placed in the current folder (you can also change the architecture with GOARCH).
Another option would be to put your code under a source control e.g. git (github.com), which also preserves history. The go tool also has support to easily get the source code from a git repository, e.g. go get -u github.com/youruser/yourpackage.
1- set GOBIN to separate path (just e.g. for OS X) and use
go install
Command go :
If the GOBIN environment variable is set, commands are installed to the
directory it names instead of DIR/bin. GOBIN must be an absolute path.
2- Also you may rename the output file:
go build [-o output] [-i] [build flags] [packages]
Like this:
go build -o newname
The -o flag, only allowed when compiling a single package, forces
build to write the resulting executable or object to the named output
file.
Also see: How do I use a Samba server location for GOPATH?

How to extract kernel headers for compiling kernel module later

I compiled various Linux kernel from git repositories. There are times when I copied the kernel to other system and need the kernel header to compile external module.
I tried to run "make headers_install" but it only generated a include/ folder. When I tried to point external module to that folder, it complains it cannot find Makefile.
What is the proper way to package kernel-header for deployment?
Thanks.
Create kernel packages instead, that's "make deb-pkg" for dpkg based distros and "make rpm-pkg" for RPM based ones. These create multiple packages, one of those is a package usable for external modules building. That should be linux-headers-* for the Debian packages and a "devel" package for he RPM versions.
In some ways this is just an expansion of the previous answer. If you look at the file scripts/package/builddeb in the kernel sources you will find script code which selects the files needed for building external modules from a kernel build and puts them into /usr/src/linux-headers-$version. I can find that script code in my local kernel version by searching for the string "# Build kernel header package" in the builddeb file. If you want to do things by hand you could execute that script code manually.

clozure cl: cl-freetype2 on windows 7

I'm working on windows 7 64bit system using clozure cl (version 1.8-r15286m) with quicklisp installed.
I need some freetype2 bindings for common lisp. (map characters to glyphs + kerning info)
I've tried to install "cl-freetype2" using
(ql:quickload "cl-freetype")
from 32bit clozure cl, and I've run into several problems.
"grovel.lisp" (located in quicklisp/software/cffi_0.11.1/grovel/grovel.lisp) assumes that I have gcc installed at "c:/msys/1.0/bin/gcc.exe" (I have mingw-gcc in path, but not there). Fixed by replacing "c:/msys/1.0/bin/gcc.exe" with "gcc" in "grovel.lisp".
When trying to compile cffi bindings for freetype2, same file does not include drive letters when passing include directories to compiler (i.e. instead of -i"d:/somedir" it passes -i"/somedir" to gcc`).
"grovel.lisp" tries to include unix include directories.
I cannot fix #2 myself.
I found this discussions, tried both listed patches, and neither of them worked. (first one breaks cffi, because ccl can't find neither "namestring-prefix" function nor "pathname-prefix" function), second one does not fix the problem.
What can I do in this situation?
I'd prefer to avoid fixing "groveller" myself, I simply need some bindings for freetype2.
Basically, I need to be able to
Load truetype font.
Map unicode char to glyph.
Get kerning information for pair of glyphs.
Load glyph bitmap.
Any ideas?
Figured it out.
Installing cl-freetype2 via quicklisp requires fully functional installation of MinGW.
Ensure that mingw-gmp is installed. (mingw-get install gmp)
Ensure that mingw/bin directory is within system path (right click on "My Computer"->Properties->Advanced->Environment Variables). Is Set. Should be something like "D:/development/MinGW/bin " (assuming MinGW is installed in "d:/development").
Locate "grovel.lisp" within your ccl installation, and replace ""c:/msys/1.0/bin/gcc.exe" with "gcc". You don't have to do that if gcc is installed at this location.
Launch mingw shell.
download unpack and install latest Freetype2 tarball using ".configure && make && make install", similarly to unix enviornment.
Locate freetype-6.dll copy it into freetype.dll and move freetype.dll into location within system path.
(Assuming that MinGW is installed in "d:/development/MinGW"), create CPATH user environment variable with following context: D:\development\MinGW\msys\1.0\local\include\freetype2;D:\development\MinGW\msys\1.0\local\include. That is - if you didn't specify "/usr" prefix during freetype2 compilation.
From within mingw shell, launch wx86cl and try (ql:quickload "cl-freetype2"). It should work properly.
If it still doesn't work, in all your root drives create directory junctions to directory in which mingw is installed. (i.e. "c:/development" linking to "d:/development", etc).
I must admit that this was much hassle, so I still think that it'll be a better idea to make a small dll that provides minimal set of functions I need while using freetype internally, then load this dll using cffi. This should be much easier.

Should I care that the symbol version dump is missing? How do I get one?

I am trying to compile a driver that we have from source and I am working through the issues with a new target environment. One of the slightly disturbing things I see is the following warning:
WARNING: Symbol version dump /usr/src/linux-2.6.38/Module.symvers
is missing; modules will have no dependencies and modversions.
I spent a fair amount of time looking on the web and this is shown in output frequently when other questions are asked, but I didn't see any commentary about whether or not this is an issue.
In any case, how would I tell linux/ubuntu to generate Module.symvers?
Module.symvers is generated when the kernel itself is compiled and ought to be provided to the user as part of the kernel build environment package, however that may look on Ubuntu (possibly broken there?) Fedora and openSUSE for example ship one or more “kernel-devel” (and/or similarly-named) packages that ship this build environment and make the file reachable through /lib/modules/<version>/build/Module.symvers. When using a self-compiled kernel, substitue /lib/modules/version/build for the appropriate path to the build directory (where all the .o files are).

USB GCC Development Environment with Libraries

I'm trying to get something of an environment on a usb stick to develop C++ code in. I plan to use other computers, most of the time linux, to work on this from a command line using g++ and make.
The problem is I need to use some libraries, like Lua and OpenGL, which the computers don't have. I cannot add them to the normal directories, I do not have root on these computers. Most of the solutions I've found involve putting things in /usr/lib/ and the like, but I cannot do that. I've also attempted adding options like '-L/media//lib', which is where they are kept, and it didn't work. When compiling, I get the same errors I got when first switching to an OS with the libraries not installed.
Is there somewhere on the computer outside of /usr/ I can put them, or a way to make gcc 'see' them?
You need more than the libraries to be able to compile code utilizing those libraries. (I'm assuming Linux here, things might be slightly different on e.g. OSX,BSDs,Cygwin,Mingw..)
Libraries
For development you need these 3 things when your code uses a library:
The library header files, .h files
The library development files, libXXX.so or libXXX.a typically
The library runtime files , libXXX.so.Y where Y is a version number. These are not needed if you statically link in the library.
You seem to be missing the header files (?) Add them to your usb stick, say under /media/include
Development
Use (e.g.) the compiler flag -I/media/include when compiling source code to refer to a non-standard location of header files.
Use the compiler/linker flag -L/media/lib to refer to non-standard location of libraries.
You might be missing the first step.
Running
For dynamically linked libraries, the system will load those only from default locations, typically /lib/ , /usr/lib/
Learn the ldd tool to help debug this step.
You need to tell the system where to load additional libraries when you're running a program, here's 3 alternatives:
Systemwide: Edit /etc/ld.so.conf and add /media/libs there. Run ldconfig -a afterwards.
Local, to the current shell only. set the LD_LIBRARY_PATH environment variable to refer to /media/lib, run export LD_LIBRARY_PATH=/media/lib
Executable: Hardcode the non-standard library path in the executable. You add this to the linking step when creating your executable: -Wl,-rpath,/media/lib
Etc.
There could be other reasons things are not working out, if so,
show us the output of ls -l /media/libs , and where you put the library header files, the command line you use to compile/link, and the exact errors you get.
Missing the headers and/or development libraries (for dynamic libraries there is usually a symlink from a libXXX.so to a libXXX.so.Y , the linker needs the libXXX.so , it will not look directly at libXXX.so.Y)
using libraries not compatible with your current OS/architecture. (libraries compiled on one linux distro is often not compatible with another distro, or even another minor version of the same distro)
using an usb stick with a FAT32 filesystem, you'll get in trouble with symlinks..

Resources