Package: powerpc-utils Severity: important Tags: patch Hi,
on recent kernels like 2.6.19 nvsetenv does work anymore: $ nvsetenv Error reading /dev/nvram: No such file or directory This is caused by the fact that nvsetenv tries to read from /dev/nvram with a single read call whereas Linux only supplies 4k and the data to be read is over 4k. The same applies for writing. The following patch fixes nvsetenv for me so that I can set options again. --- powerpc-utils-1.1.3/nwnvsetenv.c 2007-03-02 15:34:30.531458670 +0100 +++ powerpc-utils-1.1.3-al/nwnvsetenv.c 2007-03-02 15:54:04.320050019 +0100 @@ -75,7 +75,7 @@ /* seek NVRAM until common (OF) part return the lenght of the part in case of sucess, 0 otherwise. - chrph is set to the value of the "coommon" blocek eventually found + chrph is set to the value of the "common" block eventually found *nvstart is set to the seekpoint where common block starts. */ @@ -102,12 +102,18 @@ static char* nvload( int nvfd , int nvsize) { char* nvbuf = malloc(nvsize); + char *b = nvbuf; + int i; if (!nvbuf) { perror("Error allocating buffer"); exit(EXIT_FAILURE); } - if (read(nvfd, nvbuf, nvsize) != nvsize) { + while ((i = read(nvfd, b, nvsize)) > 0) { + b += i; + nvsize -= i; + } + if (i == -1) { perror("Error reading /dev/nvram"); exit(EXIT_FAILURE); } @@ -225,10 +231,15 @@ fprintf(stderr,"Error seeking /dev/nvram\n"); exit(EXIT_FAILURE); } - written = write(nvfd, nvbuf, nvsize); - if (written != nvsize) + + while ((written = write(nvfd, nvbuf, nvsize)) > 0) + { + nvsize -= written; + nvbuf += written; + } + if (written == -1) { - fprintf(stderr,"Error writing /dev/nvram %x %x\n", nvsize, seek); + fprintf(stderr,"Error writing /dev/nvram %x %x %x\n", nvsize, seek, written); exit(EXIT_FAILURE); } } Adam -- Adam [EMAIL PROTECTED] Lackorzynski http://os.inf.tu-dresden.de/~adam/ -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]