avoid system binary clashes
This commit is contained in:
parent
7678a19ecf
commit
94d7e25975
2 changed files with 31 additions and 25 deletions
48
Makefile
48
Makefile
|
@ -96,45 +96,43 @@ fstests : fstests.o $(ULIB)
|
||||||
$(LD) -N -e main -Ttext 0 -o fstests fstests.o $(ULIB)
|
$(LD) -N -e main -Ttext 0 -o fstests fstests.o $(ULIB)
|
||||||
$(OBJDUMP) -S fstests > fstests.asm
|
$(OBJDUMP) -S fstests > fstests.asm
|
||||||
|
|
||||||
echo : echo.o $(ULIB)
|
_echo : echo.o $(ULIB)
|
||||||
$(LD) -N -e main -Ttext 0 -o echo echo.o $(ULIB)
|
$(LD) -N -e main -Ttext 0 -o _echo echo.o $(ULIB)
|
||||||
$(OBJDUMP) -S echo > echo.asm
|
$(OBJDUMP) -S _echo > echo.asm
|
||||||
|
|
||||||
cat : cat.o $(ULIB)
|
_cat : cat.o $(ULIB)
|
||||||
$(LD) -N -e main -Ttext 0 -o cat cat.o $(ULIB)
|
$(LD) -N -e main -Ttext 0 -o _cat cat.o $(ULIB)
|
||||||
$(OBJDUMP) -S cat > cat.asm
|
$(OBJDUMP) -S _cat > cat.asm
|
||||||
|
|
||||||
userfs : userfs.o $(ULIB)
|
userfs : userfs.o $(ULIB)
|
||||||
$(LD) -N -e main -Ttext 0 -o userfs userfs.o $(ULIB)
|
$(LD) -N -e main -Ttext 0 -o userfs userfs.o $(ULIB)
|
||||||
$(OBJDUMP) -S userfs > userfs.asm
|
$(OBJDUMP) -S userfs > userfs.asm
|
||||||
|
|
||||||
init : init.o $(ULIB)
|
_init : init.o $(ULIB)
|
||||||
$(LD) -N -e main -Ttext 0 -o init init.o $(ULIB)
|
$(LD) -N -e main -Ttext 0 -o _init init.o $(ULIB)
|
||||||
$(OBJDUMP) -S init > init.asm
|
$(OBJDUMP) -S _init > init.asm
|
||||||
|
|
||||||
sh : sh.o $(ULIB)
|
_sh : sh.o $(ULIB)
|
||||||
$(LD) -N -e main -Ttext 0 -o sh sh.o $(ULIB)
|
$(LD) -N -e main -Ttext 0 -o _sh sh.o $(ULIB)
|
||||||
$(OBJDUMP) -S sh > sh.asm
|
$(OBJDUMP) -S _sh > sh.asm
|
||||||
|
|
||||||
ls : ls.o $(ULIB)
|
_ls : ls.o $(ULIB)
|
||||||
$(LD) -N -e main -Ttext 0 -o ls ls.o $(ULIB)
|
$(LD) -N -e main -Ttext 0 -o _ls ls.o $(ULIB)
|
||||||
$(OBJDUMP) -S ls > ls.asm
|
$(OBJDUMP) -S _ls > ls.asm
|
||||||
|
|
||||||
mkdir : mkdir.o $(ULIB)
|
_mkdir : mkdir.o $(ULIB)
|
||||||
$(LD) -N -e main -Ttext 0 -o mkdir mkdir.o $(ULIB)
|
$(LD) -N -e main -Ttext 0 -o _mkdir mkdir.o $(ULIB)
|
||||||
$(OBJDUMP) -S mkdir > mkdir.asm
|
$(OBJDUMP) -S _mkdir > mkdir.asm
|
||||||
|
|
||||||
rm : rm.o $(ULIB)
|
_rm : rm.o $(ULIB)
|
||||||
$(LD) -N -e main -Ttext 0 -o rm rm.o $(ULIB)
|
$(LD) -N -e main -Ttext 0 -o _rm rm.o $(ULIB)
|
||||||
$(OBJDUMP) -S rm > rm.asm
|
$(OBJDUMP) -S _rm > rm.asm
|
||||||
|
|
||||||
mkfs : mkfs.c fs.h
|
mkfs : mkfs.c fs.h
|
||||||
cc -o mkfs mkfs.c
|
cc -o mkfs mkfs.c
|
||||||
|
|
||||||
fs.img : mkfs userfs usertests echo cat README init sh ls mkdir rm fstests
|
fs.img : mkfs userfs usertests _echo _cat README _init _sh _ls _mkdir _rm fstests
|
||||||
./mkfs fs.img userfs usertests echo cat README init sh ls mkdir rm fstests
|
./mkfs fs.img userfs usertests _echo _cat README _init _sh _ls _mkdir _rm fstests
|
||||||
# Remove system binaries to avoid confusion.
|
|
||||||
/bin/rm -f echo cat sh ls mkdir rm
|
|
||||||
|
|
||||||
-include *.d
|
-include *.d
|
||||||
|
|
||||||
|
|
8
mkfs.c
8
mkfs.c
|
@ -51,6 +51,7 @@ xint(uint x)
|
||||||
return y;
|
return y;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int
|
||||||
main(int argc, char *argv[])
|
main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
int i, cc, fd;
|
int i, cc, fd;
|
||||||
|
@ -111,6 +112,13 @@ main(int argc, char *argv[])
|
||||||
perror(argv[i]);
|
perror(argv[i]);
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Skip leading _ in name when writing to file system.
|
||||||
|
// The binaries are named _rm, _cat, etc. to keep the
|
||||||
|
// build operating system from trying to execute them
|
||||||
|
// in place of system binaries like rm and cat.
|
||||||
|
if(argv[i][0] == '_')
|
||||||
|
++argv[i];
|
||||||
|
|
||||||
inum = ialloc(T_FILE);
|
inum = ialloc(T_FILE);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue