Re: error in a compiling simple character device driver

2010-09-18 Thread Bond
On Sun, Sep 19, 2010 at 9:08 AM, Manoj Gupta  wrote:

> Change
>
> char *memory_buffer[];
>
> to
>
> char *memory_buffer;
>
Thanks a lot Manoj that did worked.


Re: where is usb_interface defined

2010-09-18 Thread Bond
On Sun, Sep 19, 2010 at 3:52 AM, Greg KH  wrote:

>
> Also note the age of that presentation, a much newer version can be
> found on github, along with the code examples.
>
> Can you give me a link I am new to all these things I was searching to
write device drivers found your USB driver code
started understanding that with what ever information I had.


Re: where is usb_interface defined

2010-09-18 Thread Greg KH
On Sun, Sep 19, 2010 at 02:23:54AM +0530, Bond wrote:
> On Sun, Sep 19, 2010 at 12:35 AM, Greg KH  wrote:
> 
> > I suggest you use a tool like 'grep', 'ack', 'cgvg', 'ctags', or
> > 'cscope' for future questions like this.  They are all good at finding
> >
> I have used csope but what to search that I am not clear.

I am not clear as to what you are asking, please be specific.

--
To unsubscribe from this list: send an email with
"unsubscribe kernelnewbies" to ecar...@nl.linux.org
Please read the FAQ at http://kernelnewbies.org/FAQ



Re: where is usb_interface defined

2010-09-18 Thread Greg KH
On Sun, Sep 19, 2010 at 02:35:32AM +0530, Bond wrote:
> On Sun, Sep 19, 2010 at 2:23 AM, Bond  wrote:
> 
> >
> >
> > On Sun, Sep 19, 2010 at 12:35 AM, Greg KH  wrote:
> >
> >> I suggest you use a tool like 'grep', 'ack', 'cgvg', 'ctags', or
> >> 'cscope' for future questions like this.  They are all good at finding
> >>
> > I have used csope but what to search that I am not clear.
> >
> For example on that page
> you used a function dev_info
> http://www.kroah.com/linux/talks/ols_2005_driver_tutorial/mgp00010.html
> I used cscope and got at least 28 lines
> not sure if
> struct dev_info {
> mdk_rdev_t  *rdev;
> sector_tend_sector;
> };
> is the structure you are pointing to.

dev_info() is a function, and the code uses it like that, why would you
be searching for a structure?

> I have read your book LDD first 5 chapters and still reading more.
> Is this dev in your presentation same as described in your book.

What "dev"?

Also note the age of that presentation, a much newer version can be
found on github, along with the code examples.

good luck,

greg k-h

--
To unsubscribe from this list: send an email with
"unsubscribe kernelnewbies" to ecar...@nl.linux.org
Please read the FAQ at http://kernelnewbies.org/FAQ



Re: error in a compiling simple character device driver

2010-09-18 Thread Manoj Gupta
Change

char *memory_buffer[];

to

char *memory_buffer;

- Manoj

On Sun, Sep 19, 2010 at 5:05 AM, Bond  wrote:

> Hi,
> I am modifying one of my drivers it had once worked but currently giving me
> some errors.
>
> The Makefile is at the end of the code
>
> Here is the code for
> bond.c
> --
> #include 
> #include 
> #include  /* printk() */
> #include  /* kmalloc() */
> #include  /* everything... */
> #include  /* error codes */
> #include  /* size_t */
> #include 
> #include  /* O_ACCMODE */
> #include  /* cli(), *_flags */
> #include  /* copy_from/to_user */
>
> MODULE_LICENSE("Dual BSD/GPL");
>
>
> int memory_open(struct inode *inode, struct file *filp);
> int memory_release(struct inode *inode, struct file *filp);
> ssize_t memory_read(struct file *filp, char *buf, size_t count, loff_t
> *f_pos);
> ssize_t memory_write(struct file *filp, char *buf, size_t count, loff_t
> *f_pos);
> void memory_exit(void);
> int memory_init(void);
>
> /* Structure that declares the usual file */
> /* access functions */
> struct file_operations memory_fops = {
>   read: memory_read,
>   write: memory_write,
>   open: memory_open,
>   release: memory_release
> };
> /* Declaration of the init and exit functions */
> module_init(memory_init);
> module_exit(memory_exit);
>
> /* Global variables of the driver */
> /* Major number */
> int memory_major = 60;
> /* Buffer to store data */
> char *memory_buffer[];
>
> int memory_init(void) {
>   int result;
>
>   /* Registering device */
>   result = register_chrdev(memory_major, "bond", &memory_fops);
>   if (result < 0) {
> printk(KERN_ALERT  "memory: cannot obtain major number %d\n",
> memory_major);
> return result;
>   }
>
>   /* Allocating memory for the buffer */
>   memory_buffer = kmalloc(1, GFP_KERNEL);
>   if (!memory_buffer) {
> result = -ENOMEM;
> goto fail;
>   }
>   memset(memory_buffer, 0, 10);
>
>   printk(KERN_ALERT "Inserting bond module\n");
>   return 0;
>
>   fail:
> memory_exit();
> return result;
> }
>
>
> void memory_exit(void) {
>   /* Freeing the major number */
>   unregister_chrdev(memory_major, "bond");
>
>   /* Freeing buffer memory */
>   if (memory_buffer) {
> kfree(memory_buffer);
>   }
>
>   printk( KERN_ALERT "Removing bond module\n");
>
> }
>
>
> int memory_open(struct inode *inode, struct file *filp) {
>
>   /* Success */
>   return 0;
> }
>
>
> int memory_release(struct inode *inode, struct file *filp) {
>
>   /* Success */
>   return 0;
> }
>
>
> ssize_t memory_read(struct file *filp, char *buf,
> size_t count, loff_t *f_pos) {
>
>   /* Transfering data to user space */
>   copy_to_user(buf,memory_buffer,10);
>
>   /* Changing reading position as best suits */
>   if (*f_pos == 0) {
> *f_pos+=1;
> return 1;
>   } else {
> return 0;
>   }
> }
>
> ssize_t memory_write( struct file *filp, char *buf,
>   size_t count, loff_t *f_pos) {
>
>   char *tmp;
>
>   tmp=buf+count-1;
>   copy_from_user(memory_buffer,tmp,1);
>   return 1;
> }
> --
>
> Makefile
> --
> ifeq ($(KERNELRELEASE),)
> KERNELDIR ?= /lib/modules/$(shell uname -r)/build
> PWD := $(shell pwd)
> .PHONY: build clean
> build:
> $(MAKE) -C $(KERNELDIR) M=$(PWD) modules
> clean:
> rm -rf *.o *~ core .depend .*.cmd *.ko *.mod.c
> rm -rf modules.order Module.symvers
> else
> $(info Building with KERNELRELEASE =${KERNELRELEASE})
> obj-m := bond.o
>
> endif
> --
>
> When ever I am compiling it I am getting following error
> --
> /home/s/programming/bond.c:29: warning: initialization from incompatible
> pointer type
> /home/s/programming/bond.c: In function ‘memory_init’:
> /home/s/programming/bond.c:54: error: ‘memory_buffer’ has an incomplete
> type
> /home/s/programming/bond.c:55: warning: the address of ‘memory_buffer’ will
> always evaluate as ‘true’
> /home/s/programming/bond.c: In function ‘memory_exit’:
> /home/s/programming/bond.c:75: warning: the address of ‘memory_buffer’ will
> always evaluate as ‘true’
> make[2]: *** [/home/s/programming/bond.o] Error 1
> make[1]: *** [_module_/home/s/programming] Error 2
> make: *** [build] Error 2
> --
>
> What could be the possible error ?
> I have checked kernel headers they are installed.
> but I am not clear with the error which the above is coming in above.
>
>


Re: Context of a kernel routine

2010-09-18 Thread Mulyadi Santosa
Hi..

On Sun, Sep 19, 2010 at 08:50, Vimal  wrote:
> Most of the times, I just end up tracing the code path manually from
> the source code.  I have another question, though:  Is it possible in
> gdb to break on all function calls?  Would be useful. :)


None that I know :) But maybe that is doable inside system emulator
such as Qemu. You need to trap the call of "call", "far jmp" or things
like that. But the problem here is it is done system widely...thus you
need a way to selectively filter which function calls you want to trap
and which ones are not

-- 
regards,

Mulyadi Santosa
Freelance Linux trainer and consultant

blog: the-hydra.blogspot.com
training: mulyaditraining.blogspot.com

--
To unsubscribe from this list: send an email with
"unsubscribe kernelnewbies" to ecar...@nl.linux.org
Please read the FAQ at http://kernelnewbies.org/FAQ



Re: mmap issue.

2010-09-18 Thread Mulyadi Santosa
Hi...

Let's see if my eye glasses take it right :D

On Fri, Sep 17, 2010 at 19:54, naveen yadav  wrote:
> Hi All,
>
> I am facing some issue while using mmap .
>
> Issue 1.msync(ptr, PageSize, MS_ASYNC) if i pass MS_SYNC it fail with
> bad option.
Hmm, first you did :
fd = open ("/dev/mem", O_RDWR|O_SYNC)

and then you did:
msync(ptr, PageSize, MS_ASYNC)??

Isn't that a contrary?

> Issue 2. If i run the above program on target(ARM). the value is not changing
>
> parent leaving critical section: -369098746
> parent leaving critical section: -369098746
> msync completed successfully
> parent leaving critical section: -369098746
> parent entered critical section -369098746

can you make this clearer? you're running it on x86 and ARM?

-- 
regards,

Mulyadi Santosa
Freelance Linux trainer and consultant

blog: the-hydra.blogspot.com
training: mulyaditraining.blogspot.com

--
To unsubscribe from this list: send an email with
"unsubscribe kernelnewbies" to ecar...@nl.linux.org
Please read the FAQ at http://kernelnewbies.org/FAQ



Re: Context of a kernel routine

2010-09-18 Thread Vimal
Mulyadi and Sri Ram,

Thanks for the inputs.  I didn't know about the in_atomic() functions.
 But I am taking care not to cause bad things by checking if current
is not null.

>
> The other way is to do code tracing by yourself. This method itself
> can be done by the help of gdb or other debugger (break at the target
> code and do backtracing) OR by doing manual code tracing.
>

Most of the times, I just end up tracing the code path manually from
the source code.  I have another question, though:  Is it possible in
gdb to break on all function calls?  Would be useful. :)

Thanks,
-- 
Vimal

--
To unsubscribe from this list: send an email with
"unsubscribe kernelnewbies" to ecar...@nl.linux.org
Please read the FAQ at http://kernelnewbies.org/FAQ



Question about "fclone_ref = (atomic_t *) (skb + 2)" in kfree_skbmem

2010-09-18 Thread Huangqiang Zhou
Hi all:
My questions are as follows.

///< code from linux-2.6.35.4
/*
 *  Free an skbuff by memory without cleaning the state.
 */
static void kfree_skbmem(struct sk_buff *skb)
{
struct sk_buff *other;
atomic_t *fclone_ref;

switch (skb->fclone) {
case SKB_FCLONE_UNAVAILABLE:
kmem_cache_free(skbuff_head_cache, skb);
break;

case SKB_FCLONE_ORIG:
fclone_ref = (atomic_t *) (skb + 2);  
///< question here
if (atomic_dec_and_test(fclone_ref))
kmem_cache_free(skbuff_fclone_cache, skb);
break;

case SKB_FCLONE_CLONE:
fclone_ref = (atomic_t *) (skb + 1);
/< question here
other = skb - 1;

/* The clone portion is available for
 * fast-cloning again.
 */
skb->fclone = SKB_FCLONE_UNAVAILABLE;

if (atomic_dec_and_test(fclone_ref))
kmem_cache_free(skbuff_fclone_cache, other);
break;
}
}

skb->||
 |struct sk_buff *next| 
 ||
 |struct sk_buff *prev| 
 ||
 |  ..| 
 ||
 |  automic_t users   | 
  skb+1->|| fclone_ref = (atomic_t *) (skb + 1);
 |struct sk_buff *next| 
 ||
 |struct sk_buff *prve| 
 ||
 |  ..| 
 ||
 |  automic_t users   | 
  skb+2->|| fclone_ref = (atomic_t *) (skb + 2);
 |struct sk_buff *next| 
 ||
 |struct sk_buff *prve| 
 ||
 |  ..| 
 ||
 |  automic_t users   | 
 ||

typedef struct {
int counter;
} atomic_t;

so when skb+1, it poins to  the member next. if we use  "(atomic_t *) (skb + 
1);", what the hell result is? and how can we visit the member "counter" of 
atomic_t?

Thanks
 
Huangqiang Zhou
--  
2010-09-19


--
To unsubscribe from this list: send an email with
"unsubscribe kernelnewbies" to ecar...@nl.linux.org
Please read the FAQ at http://kernelnewbies.org/FAQ



Re: Context of a kernel routine

2010-09-18 Thread Mulyadi Santosa
Hi...

On Sun, Sep 19, 2010 at 01:29, Vimal  wrote:
> Hi,
>
> How do I find out what functions in the kernel code are run in the
> context of the process they're meant for?  For e.g., when a TCP socket
> receives a packet and it's being processed by some function, is the
> code executing in the context of the process that created this socket?

IMHO it's hard to say that method X is the finest way to identify it.

I think the easiest way is to put the codes such as in_atomic(),
in_interrupt() (I can't really recall the names) in the related codes
and find out which codes that return true.

The other way is to do code tracing by yourself. This method itself
can be done by the help of gdb or other debugger (break at the target
code and do backtracing) OR by doing manual code tracing.

In both ways, you're tracking the execution path i.e where it is
rooted. Most likely, long code path is running inside process context.
In this case, it's piggybacking last process context (if executed by
kernel threads) or running on behalf of current running process (in
the case of syscalls).

Maybe I miss something here, but hopefully you get the idea.


-- 
regards,

Mulyadi Santosa
Freelance Linux trainer and consultant

blog: the-hydra.blogspot.com
training: mulyaditraining.blogspot.com

--
To unsubscribe from this list: send an email with
"unsubscribe kernelnewbies" to ecar...@nl.linux.org
Please read the FAQ at http://kernelnewbies.org/FAQ



Re: Regarding IDT

2010-09-18 Thread Mulyadi Santosa
Hi...

Let's see if I can clear some of your doubts...

On Sun, Sep 19, 2010 at 06:19, Sri Ram Vemulpali
 wrote:
>    Also, why is the IDT entry is 8 bytes long.

IIRC, because it contains the segmen descriptor (not really sure about
the term) and address of the handler. Usually I name it CS:IP--> Code
Segment : Instruction Pointer.

>And how is the interrupt line
> sharing is provided. Is sharing provided at OS code level.

AFAIK, interrupt sharing is set up by "plugging" several devices into
same address, due to the usage of the same IRQ line. IMO it is the
BIOS (or APIC? Perhaps local APIC) job. Short story, the devices first
are probed in which interrupt line they wish to stay, and in the case
of interrupt sharing, BIOS plug them into same bus/interrupt line.

In OS level, a handler for each devices are setup with IRQ_SHARING (or
IRQ_SHARED?) flag. The consequence is, for every interrupt shot, all
devices which share this same IRQ line are executed. It is a task of
the testing logic inside the each handlers themselves to find out
which device that really responsible to handle it.

-- 
regards,

Mulyadi Santosa
Freelance Linux trainer and consultant

blog: the-hydra.blogspot.com
training: mulyaditraining.blogspot.com

--
To unsubscribe from this list: send an email with
"unsubscribe kernelnewbies" to ecar...@nl.linux.org
Please read the FAQ at http://kernelnewbies.org/FAQ



error in a compiling simple character device driver

2010-09-18 Thread Bond
Hi,
I am modifying one of my drivers it had once worked but currently giving me
some errors.

The Makefile is at the end of the code

Here is the code for
bond.c
--
#include 
#include 
#include  /* printk() */
#include  /* kmalloc() */
#include  /* everything... */
#include  /* error codes */
#include  /* size_t */
#include 
#include  /* O_ACCMODE */
#include  /* cli(), *_flags */
#include  /* copy_from/to_user */

MODULE_LICENSE("Dual BSD/GPL");


int memory_open(struct inode *inode, struct file *filp);
int memory_release(struct inode *inode, struct file *filp);
ssize_t memory_read(struct file *filp, char *buf, size_t count, loff_t
*f_pos);
ssize_t memory_write(struct file *filp, char *buf, size_t count, loff_t
*f_pos);
void memory_exit(void);
int memory_init(void);

/* Structure that declares the usual file */
/* access functions */
struct file_operations memory_fops = {
  read: memory_read,
  write: memory_write,
  open: memory_open,
  release: memory_release
};
/* Declaration of the init and exit functions */
module_init(memory_init);
module_exit(memory_exit);

/* Global variables of the driver */
/* Major number */
int memory_major = 60;
/* Buffer to store data */
char *memory_buffer[];

int memory_init(void) {
  int result;

  /* Registering device */
  result = register_chrdev(memory_major, "bond", &memory_fops);
  if (result < 0) {
printk(KERN_ALERT  "memory: cannot obtain major number %d\n",
memory_major);
return result;
  }

  /* Allocating memory for the buffer */
  memory_buffer = kmalloc(1, GFP_KERNEL);
  if (!memory_buffer) {
result = -ENOMEM;
goto fail;
  }
  memset(memory_buffer, 0, 10);

  printk(KERN_ALERT "Inserting bond module\n");
  return 0;

  fail:
memory_exit();
return result;
}


void memory_exit(void) {
  /* Freeing the major number */
  unregister_chrdev(memory_major, "bond");

  /* Freeing buffer memory */
  if (memory_buffer) {
kfree(memory_buffer);
  }

  printk( KERN_ALERT "Removing bond module\n");

}


int memory_open(struct inode *inode, struct file *filp) {

  /* Success */
  return 0;
}


int memory_release(struct inode *inode, struct file *filp) {

  /* Success */
  return 0;
}


ssize_t memory_read(struct file *filp, char *buf,
size_t count, loff_t *f_pos) {

  /* Transfering data to user space */
  copy_to_user(buf,memory_buffer,10);

  /* Changing reading position as best suits */
  if (*f_pos == 0) {
*f_pos+=1;
return 1;
  } else {
return 0;
  }
}

ssize_t memory_write( struct file *filp, char *buf,
  size_t count, loff_t *f_pos) {

  char *tmp;

  tmp=buf+count-1;
  copy_from_user(memory_buffer,tmp,1);
  return 1;
}
--

Makefile
--
ifeq ($(KERNELRELEASE),)
KERNELDIR ?= /lib/modules/$(shell uname -r)/build
PWD := $(shell pwd)
.PHONY: build clean
build:
$(MAKE) -C $(KERNELDIR) M=$(PWD) modules
clean:
rm -rf *.o *~ core .depend .*.cmd *.ko *.mod.c
rm -rf modules.order Module.symvers
else
$(info Building with KERNELRELEASE =${KERNELRELEASE})
obj-m := bond.o

endif
--

When ever I am compiling it I am getting following error
--
/home/s/programming/bond.c:29: warning: initialization from incompatible
pointer type
/home/s/programming/bond.c: In function ‘memory_init’:
/home/s/programming/bond.c:54: error: ‘memory_buffer’ has an incomplete type
/home/s/programming/bond.c:55: warning: the address of ‘memory_buffer’ will
always evaluate as ‘true’
/home/s/programming/bond.c: In function ‘memory_exit’:
/home/s/programming/bond.c:75: warning: the address of ‘memory_buffer’ will
always evaluate as ‘true’
make[2]: *** [/home/s/programming/bond.o] Error 1
make[1]: *** [_module_/home/s/programming] Error 2
make: *** [build] Error 2
--

What could be the possible error ?
I have checked kernel headers they are installed.
but I am not clear with the error which the above is coming in above.


Regarding IDT

2010-09-18 Thread Sri Ram Vemulpali
Hi all,

   This question is regarding Interrupt descriptor table. Why is the IDTR
48-bits wide and why do we need limit field in the IDTR.
   Since we know there are 256 interrupts or exceptions possible, can't we
know boundary by deriving it by length of IDT field.
   Also, why is the IDT entry is 8 bytes long. And how is the interrupt line
sharing is provided. Is sharing provided at OS code level.
   I did not see any explanation of sharing at Intel manual (data sheet of
x86 system programming guide). Any thoughts.

   Please clarify. Thanks.


-- 
Regards,
Sri.


Re: where is usb_interface defined

2010-09-18 Thread Bond
On Sun, Sep 19, 2010 at 12:35 AM, Greg KH  wrote:

> I suggest you use a tool like 'grep', 'ack', 'cgvg', 'ctags', or
> 'cscope' for future questions like this.  They are all good at finding
>
I have used csope but what to search that I am not clear.


Re: where is usb_interface defined

2010-09-18 Thread Bond
On Sun, Sep 19, 2010 at 2:23 AM, Bond  wrote:

>
>
> On Sun, Sep 19, 2010 at 12:35 AM, Greg KH  wrote:
>
>> I suggest you use a tool like 'grep', 'ack', 'cgvg', 'ctags', or
>> 'cscope' for future questions like this.  They are all good at finding
>>
> I have used csope but what to search that I am not clear.
>
For example on that page
you used a function dev_info
http://www.kroah.com/linux/talks/ols_2005_driver_tutorial/mgp00010.html
I used cscope and got at least 28 lines
not sure if
struct dev_info {
mdk_rdev_t  *rdev;
sector_tend_sector;
};
is the structure you are pointing to.
I have read your book LDD first 5 chapters and still reading more.
Is this dev in your presentation same as described in your book.


Re: my driver is dropping characters

2010-09-18 Thread Bond
On Sat, Sep 18, 2010 at 8:17 PM, Greg Freemyer wrote:

> your first problem is you only have a 1 char buffer, so until you fix
> that, the rest has no chance of working.
>
> >> bond_buffer = kmalloc(1, GFP_KERNEL);
> Ok I got your point have Googled this and got some relevant thing.
>
Had read about it in LDD chapter 3.


Re: my driver is dropping characters

2010-09-18 Thread Bond
On Sat, Sep 18, 2010 at 8:17 PM, Greg Freemyer wrote:

>
> Stealing someone's analogy, it's like race car mechanics discussing
> the finer points of setting up the fuel injection system and you're
> asking "What is fuel injection anyway?"
>
Ha ha that was quite nice explanation.Any way.
I did try to read man page of kmalloc but there is no man entry for that.


Re: where is usb_interface defined

2010-09-18 Thread Greg KH
On Wed, Sep 15, 2010 at 08:56:28AM +0530, Bond wrote:
> I am trying my hands at usb driver
> http://www.kroah.com/linux/talks/ols_2005_driver_tutorial/mgp00010.html
> can some one point me where is struct usb_interface defined.

include/linux/usb.h in the kernel source tree.

> I have going through a lot of lines but I could not find it.

I suggest you use a tool like 'grep', 'ack', 'cgvg', 'ctags', or
'cscope' for future questions like this.  They are all good at finding
where things are in large bodies of code.

good luck,

greg k-h

--
To unsubscribe from this list: send an email with
"unsubscribe kernelnewbies" to ecar...@nl.linux.org
Please read the FAQ at http://kernelnewbies.org/FAQ



Re: make with argument 0 is failing some where

2010-09-18 Thread Mulyadi Santosa
Hi..

On Sat, Sep 18, 2010 at 19:36, Tapas Mishra  wrote:
> Ok finally I have been able to fix this.
> To do so what I was trying
> I executed make mrproper at two places
> one is $HOME/linux-2.6
> and another was $HOME/btc

That's great! I suggest you put that steps somewhere in
wiki.kernelnewbies.org. Should be useful for other people.

-- 
regards,

Mulyadi Santosa
Freelance Linux trainer and consultant

blog: the-hydra.blogspot.com
training: mulyaditraining.blogspot.com

--
To unsubscribe from this list: send an email with
"unsubscribe kernelnewbies" to ecar...@nl.linux.org
Please read the FAQ at http://kernelnewbies.org/FAQ



Context of a kernel routine

2010-09-18 Thread Vimal
Hi,

How do I find out what functions in the kernel code are run in the
context of the process they're meant for?  For e.g., when a TCP socket
receives a packet and it's being processed by some function, is the
code executing in the context of the process that created this socket?

Thanks,
-- 
Vimal

--
To unsubscribe from this list: send an email with
"unsubscribe kernelnewbies" to ecar...@nl.linux.org
Please read the FAQ at http://kernelnewbies.org/FAQ



Re: my driver is dropping characters

2010-09-18 Thread Greg Freemyer
your first problem is you only have a 1 char buffer, so until you fix
that, the rest has no chance of working.

>> bond_buffer = kmalloc(1, GFP_KERNEL);

In 100% seriousness, you need to learn to program in user space before
you delve into the kernel.  The kernel is a very, very complex
environment.  Allocating a buffer of the right size is about as basic
as it gets in the kernel.

Stealing someone's analogy, it's like race car mechanics discussing
the finer points of setting up the fuel injection system and you're
asking "What is fuel injection anyway?"

Or in school terms, the kernel is like graduate studies and you're
asking freshman questions.

Greg

--
To unsubscribe from this list: send an email with
"unsubscribe kernelnewbies" to ecar...@nl.linux.org
Please read the FAQ at http://kernelnewbies.org/FAQ



Re: my driver is dropping characters

2010-09-18 Thread Bond
On Wed, Sep 15, 2010 at 10:34 PM, matthias wrote:

> Hi,
>
> the problem is your bond_buffer and how you handle read and writes from it.
> (see below)
>
> Hi thanks I have read and re read the code and many other man pages from
internet.

> > ssize_t bond_read(struct file *filp, char *buf, size_t count, loff_t
> *f_pos)
> > {
> >
> >   /* Transfering data to user space */
> >   copy_to_user(buf,bond_buffer,1);
> you just copy one byte to the buffer instead of count.
>
Yes you are right here but I am not getting as how do I get the exact
location from where I will copy data from kernel space to user space.

>
> >
> >
> >   /* Changing reading position as best suits */
> >   if (*f_pos == 0) {
> > *f_pos+=1;
> > return 1;
> >   } else {
> > return 0;
> >   }
> > };
> >
> >
> >
> >
> > ssize_t bond_write(struct file *filp, char *buf, size_t count, loff_t
> > *f_pos)
> >  {
> >
> >
> >   char *tmp;
> >
> >
> >   tmp=buf+count-1;
> >   copy_from_user(bond_buffer,tmp,1);
> you just copy the last byte from buf (buf+count-1) to your
> bond_buffer. you should copy count bytes, starting by buf.
>
Right I am not clear as how will I get the location of the region where user
has written some thing in the above error you pointed out
so that I can copy the complete characters you mentioned.


Re: make with argument 0 is failing some where

2010-09-18 Thread Tapas Mishra
On Sun, Sep 12, 2010 at 10:56 AM, Tapas Mishra  wrote:

>
> For the sake of simplicity I am rewriting all the steps that I did
>
> Step 1) copied the config from /boot to $HOME/linux-2.6
> Step 2) yes ' ' | make O=$HOME/btc oldconfig
> Step 3) make O=$HOME/btc
> got errors
>
> make O=$HOME/btc
Ok finally I have been able to fix this.
To do so what I was trying
I executed make mrproper at two places
one is $HOME/linux-2.6
and another was $HOME/btc
now I was in
Step 1) cd  $HOME/linux-2.6
Step 2) make mrproper
Step 3) cd $HOME/btc
Step 4) make $O=$HOME/btc mrproper
Step 5) cd $HOME/linux-2.6
Step 6) copied the config from /boot to $HOME/linux-2.6
Step 7) yes ' ' | make O=$HOME/btc oldconfig
upto here is all Ok.
Next step is
Step 8) make mrproper
Step 9) cd $HOME/btc
Step 10) make O=$HOME/btc

and then make with all modules install and rest of the stuff had worked.
-- 
Tapas

--
To unsubscribe from this list: send an email with
"unsubscribe kernelnewbies" to ecar...@nl.linux.org
Please read the FAQ at http://kernelnewbies.org/FAQ



Re: Kernel Panic when trying to install Ubuntu 10.04 on my Desktop w/ processor AMD K6/2-450.

2010-09-18 Thread arshad hussain

On 9/18/2010 3:53 AM, David Castillo Fuentes wrote:

Hello,

Some days back I tried to install Ubuntu 10.04 in my old Desktop which
has a processor AMD K6/2-450, but when I tried to do so, I got a Kernel
Panic, and the system reported that it was working under low memory
conditions.

Few months back i got an old machine booted with acpi=off
cmd line option. This machine was otherwise not booting
or very sluggish to boot. ( As far as i remember ). Maybe
old acpi is not your problem, but you can always try.

Thanks.




Did you face a similar issue with this before?

Note: The ISO image that I'm working on is
ubuntu-10.04.1-desktop-i386.iso


Is there any old ISO image where this worked fine?

Thanks fro your support.

David



--
To unsubscribe from this list: send an email with
"unsubscribe kernelnewbies" to ecar...@nl.linux.org
Please read the FAQ at http://kernelnewbies.org/FAQ



Re: Kernel Panic when trying to install Ubuntu 10.04 on my Desktop w/ processor AMD K6/2-450.

2010-09-18 Thread Michael Blizek
Hi!

On 18:08 Fri 17 Sep , Venkatram Tummala wrote:
> On Fri, Sep 17, 2010 at 3:23 PM, David Castillo Fuentes <
> david.castillo.fuen...@gmail.com> wrote:
> 
> > Hello,
> >
> > Some days back I tried to install Ubuntu 10.04 in my old Desktop which has
> > a processor AMD K6/2-450, but when I tried to do so, I got a Kernel Panic,
> > and the system reported that it was working under low memory conditions.
> >
> 
> Most probably, total RAM on your system must have been too low. What happens
> in that condition is that kernel invokes the Out-of-Memory Killer (OOM)
> which selects a process/processes & shoots it in the face.  As a result,
> things spiral out of control & may lead to a panic.

OOM should *not* lead to a panic. This is the reason why the oom-killer exists:
To kill processes so that the rest of the system can survive.

Maybe it has nothing to do with memory at all but there is a broken driver or
so for an old piece of hardware?

> You have a very limited
> control over the OOM killer & you cannot always predict which process it
> will select.

You have control an you can predict which process it will select. Take a look
at /proc//oom_{score|adj} .

> It is not a problem with the ISO or a specific linux distro.
> What is the total RAM on your system

It should be possible to run a "bare" linux desktop on systems with 64MB+swap,
but X11 will use a lot of memory. Some big applications like firefox/ooffice
and window mamager like KDE/Gnome will be *very* slow or constantly trigger the
oom killer tough - not very fun to use. However without X11 (e.g. as a server),
you should be fine. Some embedded linux systems you can buy *today* come with
16MB. If the *installer* has a problem with your hardware, try to find out
whether there is a smaller installer or use a different (debian?) distribution,
which does not have these problems.

-Michi
-- 
programing a layer 3+4 network protocol for mesh networks
see http://michaelblizek.twilightparadox.com


--
To unsubscribe from this list: send an email with
"unsubscribe kernelnewbies" to ecar...@nl.linux.org
Please read the FAQ at http://kernelnewbies.org/FAQ