w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
How to port a linux driver , which is compiled in 2.6 kernel ,without compiling in other new version of kernel
now it's not possible: usually, a "driver" is a binary kernel-module porting will involve code-changes to the kernel module. if you change the code, you need to compile it, in order to get a binary. since kernel modules run in kernel space, it is crucial that they are robust. since parts of the kernel-API change every now and then, trying to use a module compiled for kernel-X with another kernel-Y, might either not load because of missing symbols (if you are lucky) or lead to a kernel panic because semantics have changed. btw, all this is not really related to 2.6.x vs 3.y, but holds true for any kernel version but then: of course in theory it is possible to "write" a kernel-module as binary code in your favourite hex-editor, without resorting to compilers and such. this would allow yo

Categories : Linux

Meaning of version info in .mod.c file in Linux kernel
The __versions section contained in all the individual *.mod.c files CRC Symbol { 0xa6d8dcb5, "module_layout" }, { 0x16c2b958, "register_netdevice" }, ... ... is a list of symbols and their corresponding CRCs. This has 2 main uses : Global list of all exported symbols. Module versioning check when loading ko modules. Rationale behind Module versioning Module versioning is enabled by the CONFIG_MODVERSIONS tag, and is used as a simple ABI consistency check. A CRC value of the full prototype for an exported symbol is created. When a module is loaded/used, the CRC values contained in the kernel are compared with similar values in the module; if they are not equal, the kernel refuses to load the module as it indicates that the module is built with

Categories : C

How to compile ixgbe network drivers on other linux kernel version
Install the kernel-devel rpm for 2.6.39.4 and compile against the new kernel. In Makefile use the Kernel directory as 2.6.39.4. Usually located in /usr/src/kernels/

Categories : Linux

"scripts recordmcount: Syntax error" when I try to build a linux kernel module on a 64-bit 3.9 kernel
This was an issue of cross-compiling. I used a 32-bit Ubuntu system to build a 64-bit kernel and it's been nothing but headaches. Apparently the scripts etc still get built as 32-bit. (They'd have to since my 32-bit system needed to use them to build the kernel.) But then if bring that /usr/src/linux-headers-x.x.x dir over to my 64-bit system I can't use it to build any kernel modules because its /scripts dir is 32-bit. I rebuilt recordmcount on the 64-bit machine and that worked. But then there was another script that was incompatible with 64-bits, that wasn't as easy to build without rebuilding the entire kernel. Anyway, if you cross compile you don't get a /usr/src/linux-header-x.x.x/scripts dir that's usable on your target system.

Categories : Misc

Linux Kernel - stoping a running kernel timer from user space
Have you considered trying netlink? It's a powerful method for user-to-kernel (or process-to-process) communication which both simple and lightweight.

Categories : Linux

Are the services offered by the linux kernel implemented as kernel threads?
Some are, some aren't. The terms "process management" and "memory management" are kind of broad and cover a fair bit of kernel code. For memory management, a call to mmap() will just require changing some data structures and can be done by the current thread, but if pages are swapped out it will be done by kswapd, which is a kernel thread. You might consider the scheduler a special case: since the scheduler is responsible for scheduling all threads, it itself is not a thread and does not execute on any thread (otherwise it would need to schedule itself... but how would it schedule itself, if it had to schedule itself first in order to do that?). You might think of the scheduler as running directly on each processor core when necessary.

Categories : Multithreading

In linux, all kernel processes share the same kernel stack, each user process has its own stack, correct?
Incorrect. There's one kernel address space, and no kernel processes. There are kernel threads, and there are user space threads that enter the kernel. These run in the kernel address space. Each of these has a separate stack, within the kernel address space.

Categories : Linux

which registers is changed when we move from user mode to kernel mode ?! and what is the reason to move to kernel mode?
From your questions i found that you are very poor in operating system concepts. Ok let me explain,(I am assuming you are using linux not windows). "which registers is changed when we move from user mode to kernel mode ?" For knowing answer for this question you need to learn about process management. But i can simply say, linux uses system call interface for changing from user space to kernel space. system call interface uses some registers (Based on your processor) to pass system call number and arguments for system call.

Categories : C++

Which Linux platfrom required for Installation of ingres database version 9.2 and openROAD version 4.0
If you want answers don't use Stackoverflow as its ridiculous policies prevent me supplying the four links that would have been helpful to you. Google for the Actian community, which you will find far more helpful with fewer egos struggling to rule the world.

Categories : Misc

which fuse version in my kernel?
On my system (Slackware 14) the following command shows you which fuse package is installed, thus including its version: $ ls /var/log/packages/ | grep fuse According to which package manager you use, you may find its log file under /var/log/[dpkg,yum,apt].log; you should find there the history of your installations, including versions. An other alternative method: check your installed packages through your package manager GUI.

Categories : Linux

How to get kernel version without arch
Given that regex can be used, you can match the string against ^(.*).[^.]*$ and take the first capture group. ((.*)..* will generally also work, with "greedy" quantifiers, but cf. a reference for your regex engine.)

Categories : Linux

How can I get the builder name of the linux kernel
dmesg gives the kernel log, so you should be able to grep/sed it from there: dmesg | grep 'Linux version ' | sed 's/[^(]*(([^)]*)).*/1/' (There are smarter ways of doing this.)

Categories : Shell

Role of tty in Linux kernel
This file is to support tty on user level interface or console.This also implements echoing. tty: Print file name of terminal on standard input.For more info give info tty command on shell.

Categories : C

About usb otg driver in linux kernel
I've found the answer to my first question. Checkout this link: http://www.spinics.net/lists/linux-omap/msg87665.html

Categories : Linux

what is __ksymtab? in linux kernel
The format is similar to that of the output of nm utility, see also this page. To put it simple, 'T' usually denotes a global (non-static but not necessarily exported) function, 't' - a function local to the compilation unit (i.e. static), 'D' - global data, 'd' - data local to the compilation unit. 'R' and 'r' - same as 'D'/'d' but for read-only data. These are the items from the special sections needed to export symbols so that the symbols could be used by kernel modules. For each exported symbol, al least the following is defined by EXPORT_SYMBOL(): __kstrtab_<symbol_name> - name of the symbol as a string __ksymtab_<symbol_name> - a structure with the information about the symbol: its address, address of __kstrtab_<symbol_name>, etc. __kcrctab_<symbol_name>

Categories : Linux

Using TunTap with linux kernel 2.6
The tuntap documentation is outdated. Also, in newer versions of linux, you might need to use tunctl instead of ip tuntap add To install tunctl on debian Squeeze, install the package 'uml-utilities' which provides the tunctl command. You can add a new tunnel using tunctl -t tun1

Categories : Networking

Getting the Windows kernel version in Java?
Did you try : System.getProperty("os.version"); If you want to check the same on Linux or Android you can do so by this statement: Runtime.getRuntime().exec("uname -r");

Categories : Java

How do I update my server's kernel version
This is not exactly the kind of question for stackoverflow. Anyway. You have to: download the kernel source from kernel.org configure the kernel with make menuconfig or make xconfig compile the kernel with make -j4 (where the option -j is the number of processor) copy the kernel from /arch/x86/boot/bzImage to your boot directory (/boot/) add a new option in your boot loader to boot the system with the new kernel

Categories : Database

How do I know if an address in Linux kernel is readable or not?
The copy_from_user and related functions get the address from some untrusted user space program; they protect against invalid addresses by installing a special exception handler. (See this answer for details.) You could do the same, but this would protect only against addresses that the kernel has marked as invalid in the page tables; accesses to some random device's MMIO range might have unpredictable results. If you want to search for something in some BIOS ROM, remap that memory like any other PCI resource. If you want to search for something in main memory, you could use some function like ioremap or kmap to get a valid virtual address for a specific physical address.

Categories : Linux

page swap in Linux kernel
The best place to start looking is going to be in mm.h: http://lxr.linux.no/linux+v3.10.10/include/linux/mm.h Then take a look at the mm directory, which has files like page_io.c: http://lxr.linux.no/linux+v3.10.10/mm/page_io.c Keep in mind that any architecture specific stuff will likely be defined in the arch directory for the system you are looking at. For example, here is the x86 page table management code: http://lxr.linux.no/linux+v3.10.10/arch/x86/mm/pgtable.c Good luck! Remember, you are likely not going to find a section of code as clean as the example code you gave.

Categories : Linux

What happens after segmentation fault in linux kernel?
Data abort handler just assigns to the pc the same value as before the data abort handling started, and instruction gets executed again, with right data in place, so data abort won't happen again.

Categories : Linux

Switching into (Linux) Kernel Mode
All switches to kernel mode are made via system calls. In the case of network protocols these system calls are socket, listen, accept, ioctl, read, write, recvmsg, etc. You write a Linux kernel module. There is already a SCTP protocol stack for Linux though. You would likely be better off modifying it to do what you want. Once you have written and compiled your module you can load it into the kernel using insmod and rmmod. In my experience you rarely get a chance to use rmmod because if you made a mistake the system crashes or freezes. So use a virtual machine for your testing. It is faster to reboot, you lose less data, and it is easier to hook up a virtual serial console for debugging. I am sure this question is a duplicate by the way. You can find a lot of questions on this topic.

Categories : Linux

how is a memory barrier in linux kernel is used
From the section of the document titled "WHAT MAY NOT BE ASSUMED ABOUT MEMORY BARRIERS?": There is no guarantee that any of the memory accesses specified before a memory barrier will be complete by the completion of a memory barrier instruction; the barrier can be considered to draw a line in that CPU's access queue that accesses of the appropriate type may not cross. and There is no guarantee that a CPU will see the correct order of effects from a second CPU's accesses, even if the second CPU uses a memory barrier, unless the first CPU also uses a matching memory barrier (see the subsection on "SMP Barrier Pairing"). What memory barriers do (in a very simplified way, of course) is make sure neither the compiler nor in-CPU hardware perform any

Categories : Linux

Cyclictest for RT patched Linux Kernel
There's a lot that must be done to get hard realtime performance under PREEMPT_RT. Here are the things I am aware of. Entries marked with an asterisk apply to your current position. Patch the kernel with PREEMPT_RT (as you already did), and enable CONFIG_PREEMPT_RT_FULL (which used to be called CONFIG_PREEMPT_RT, as you correctly derived). Disable processor frequency scaling (either by removing it from the kernel configuration or by changing the governor or its settings). (*) Reasoning: Changing a core's frequency takes a while, during which the core does no useful work. This causes high latencies. To remove this, look under the ACPI options in the kernel settings. If you don't want to remove this capability from the kernel, you can set the cpufreq governor to "performance" to lock it i

Categories : Linux

How does the Linux kernel realize reentrancy?
[Edit - the term "reentrant" gets used in a couple of different senses. This answer uses the basic "multiple contexts can be executing the same code at the same time." This usually applies to a single routine, but can be extended to apply to a set of cooperating routines, generally routines which share data. An extreme case of this is when applied to a complete program - a web server, or an operating system. A web-server might be considered non-reentrant if it could only deal with one client at a time. (Ugh!) An operating system kernel might be called non-reentrant if only one process/thread/processor could be executing kernel code at a time. Operating systems like that occurred during the transition to multi-processor systems. Many went through a slow transition from written-for-uniproc

Categories : Linux

Linux Device Drivers 3rd Ed and 3.2 kernel
I like LDD3. The teaching style is outstanding. I see the most references to that text in SO, LWN etc. I tried just reading it, that had limited value. It was better to get the examples built and running, play some e.g. with scull, then study the text hard to see how the code was really working. But, to do that with modern kernels, you need updated code. I found martinezjavier code built OK with 3.1 kernel (I deleted tty from Makefile, and added simple_open() definition) then life was great. Also I found some nice work from cs.fsu, including online cross-reference. Cooperstein text also exists, and has exercise solutions with multiple kernel versions, but I haven't used this text.

Categories : Linux

Macros from linux kernel code
It seems to work the following way: Call the __chk_io_ptr(a) in order to check the memory available Read unsigned int from memory by dereferencing the pointer. I suppose you use this macro the following way: unsigned int data = __raw_readl(a); By preprocessor it is replaced by: unsigned int data = (__chk_io_ptr(a), *(volatile unsigned int __force *)(a)); So as result of the comma operator in data stored unsigned long value pointed by a. EDIT: The __chk_io_ptr(a) seems to be a macro in accordance to this. #define __chk_io_ptr(x) (void)0 That actually does nothing.

Categories : C

Booting a ppc linux kernel in qemu
Dont use nographic use below command , qemu-system-ppc -kernel vmlinux_2 -hda ss1.1.img -append "console=ttyS0 root=/dev/sda1" or qemu-system-ppc -kernel vmlinux_2 -hda ss1.1.img -append "root=/dev/sda1"

Categories : Linux

linux kernel head file
This struct is for kernel internal use only. It's definition is pretty long and largely varies depending on kernel configuration. So, the struct size also varies depending on kernel configuration, and you can't get it from user-space. Unless, you extract kernel config, which is bad idea, as for me. The better one is to write a kernel module.

Categories : Linux

Linux Kernel Check VID / PID Number?
Your program would be querying the serial number via the operating system. And you know what, your client has the ability to alter the operating system, so your program would not be able to completely trust the information provided by the OS. If you're willing to trust the client (not to alter the OS), see how the hdparm program in Linux obtains its HDD detail information (including the serial number), or alternatively crawl through the /sys/devices/ hierarchy to find out the hard disks and their detail data (couldn't find it for the moment, but I think the serial info would be there as well). If, on the other hand, you would like to expect your clients to cheat, then you would better not let them use your application at all.

Categories : Linux

Linux kernel module programming: makefile
When you call the Makefile for the first time by typing #make on the console you are not passing any target. So, It will call the target name all: in the makefile by default. Inside the all: target you are passing the target as modules.So, this time it will build the modules instead of going to all: targets. SO its not going to be infinite Recursion.

Categories : Linux

Shutdown (embedded) linux from kernel-space
The most general way would be for your driver to invoke shutdown as a userspace helper: static const char * const shutdown_argv[] = { "/sbin/shutdown", "-h", "-P", "now", NULL }; call_usermodehelper(shutdown_argv[0], shutdown_argv, NULL, UMH_NO_WAIT); (Presuming you have a /sbin/shutdown binary installed). This will shut userspace down cleanly, unmount filesystems and then request the kernel shutdown and power off. However, you may be able to do better than this - for example if you can guarantee that there's no disk filesystems mounted read/write, you could tell a kernel thread to invoke the kernel_power_off() function (it shouldn't be done from interrupt context).

Categories : Linux

Critical Timing in an ARM Linux Kernel Driver
One possible workaround to the problem Chris mentioned (in addition to problems with paging of kernel module code) is to use a PWM peripheral where the duration of the pulse is pre-programmed and the timing is implemented in hardware. Fancy processors with caches are not suitable for hard realtime work. Execution time varies if cache misses are non-deterministic (and designs where cache misses are completely deterministic aren't complicated enough to justify a fancy processor). You can try to avoid memory controller latency during critical sections by aligning the critical section so that it doesn't straddle cache lines. Or prefetch the code you will need. But this is going to be very non-portable and create a nightmare for future maintenance. And still doesn't protect the access to

Categories : Linux

How Linux kernel function (bitmap_set ..) works
Not having more context makes answering difficult, but as these are defined as functions in the Linux kernel I suspect this is a fragment of an initializer somewhere defining an array of function addresses. http://lxr.free-electrons.com/source/lib/bitmap.c#L276 http://lxr.free-electrons.com/source/lib/bitmap.c#L330

Categories : C

reading linux kernel source code
You could try some source navigator, or use ctags (or etags with emacs), or cscope etc... You could consider also coccinelle. You could extend the GCC compiler, e.g. using MELT, to suit your needs. Most importantly, read some good books and tutorials about the kernel internals. Ask also on kernelnewbies.org

Categories : Linux

Why doesn't the Linux kernel use modulo for long?
It is done this way for cases where the programmer knows that the dividend is expected to only be a little larger than the divisor (so the iteration version will only loop once or twice). The compiler can't be expected to figure this out. This is explained by this comment in div64.c: /* * Iterative div/mod for use when dividend is not expected to be much * bigger than divisor. */ The modulo function you've pointed to is iter_div_u64_rem(), explicitly used when this is wanted; for the regular modulo version, there is div_u64_rem().

Categories : C

Which address space is occupied by the kernel in 64 bit linux
On a 64-bit Linux all 64-bit addresses with the highest order bit set to 1 are reserved for the kernel. In other words, the top half of the virtual address space. See http://en.wikipedia.org/wiki/X86-64#Virtual_address_space_details

Categories : C

Patch / replace linux kernel in memory
Take a look at this link It's for a project called Ksplice that allows one to patch a running kernel. At one point this code was open, but Oracle bought it... So they may have closed it up and made it cost money. If that's the case, look around and see if you can find the formerly open code in the wild...

Categories : Linux

Linux kernel regmap irq handler has an issue
Regmap entirely uses threaded irqs. In addition, I was using i2c calls in the nested calls which are again threaded irqs. Due to this, I would always remain in user space and not in irq context. I2c tranfer has schedule in it and that brings in a completely different execution flow. In addition, there were problems in wake enabling the irq.

Categories : Linux

Unable to run linux kernel image on qemu
Here missing component is kernel parameters to be passed , As you are using -initrd i.e initialramdisk you need to pass rdinit=/(your-app-executable) you can pass rdinit=/sbin/init or rdinit=/bin/sh try this qemu-system-x86_64 -kernel bzImage -initrd initrd.img-3.11 -append "root=/dev/ram rdinit=/sbin/init"

Categories : Linux



© Copyright 2017 w3hello.com Publishing Limited. All rights reserved.