Search code examples
filemakefileadditionxv6

Add a generic file in xv6 makefile


I'm currently studying the xv6 OS. I found out here how to add a system call by modifying the MAKEFILE file. My question is: how do we add simple text files or any other kind of file to be seen in the xv6 system once it boots?


Solution

  • README file in Xv6 is a generic file too. Searching for occurrences of README in the MakeFile and adding your required file will be sufficient.

    Suppose new.txt is the file you want to add.

    Parts of the MakeFile to be changed are:

    1)

    fs.img: mkfs README new.txt $(UPROGS)
    ./mkfs fs.img README new.txt $(UPROGS)
    

    2)

    PRINT = runoff.list runoff.spec README new.txt toc.hdr toc.ftr $(FILES)
    

    3)

    EXTRA=\
    mkfs.c ulib.c user.h cat.c echo.c forktest.c grep.c kill.c\
    ln.c ls.c mkdir.c rm.c stressfs.c usertests.c wc.c zombie.c\
    printf.c umalloc.c\
    README new.txt dot-bochsrc *.pl toc.* runoff runoff1 runoff.list\
    .gdbinit.tmpl gdbutil\