0

For a project I have to change the zero-driver to produce an infinite amount of 'a' instead of the usual zero. So I modified /usr/src/drivers/memory/memory.c

This was the original:

/* Initialize /dev/zero. Simply write zeros into the buffer. */
for (i=0; i<ZERO_BUF_SIZE; i++) {
    dev_zero[i] = '\0'; //This is line 247
}

This is my modification:

/* Initialize /dev/zero. Simply write zeros into the buffer. */
for (i=0; i<ZERO_BUF_SIZE; i++) {
    dev_zero[i] = 'a'; //This is line 247
}

So I save and close and recompile memory.c but no changes when I say cat /dev/zero. I even tried deleting /dev/zero and using mknod /dev/zero c 1 5 to create a new one. But still no changes. I also tried rebooting.

Am I changing the incorrect file or am I not compiling the right files?

Armand Maree
  • 488
  • 2
  • 6
  • 21

2 Answers2

0

Assuming you are editing the kernel source code, you probably need to reboot to see your changes take effect.

hymie
  • 1,982
  • 1
  • 13
  • 18
0

Okay I found that doing the following solves the problem:

cd /usr/src/drivers/memory/
make
cd ..
make clean
make build
make install
cd ..
make world
make install
cd kernel
make clean
make
shutdown

So basically recompiling a few directories and then restarting the OS.

Armand Maree
  • 488
  • 2
  • 6
  • 21