Search code examples
cminixramdisk

Change /dev/zero in MINIX to produce 'a'


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?


Solution

  • 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.