william1357chen / xv7

xv6 w/ C++ == xv7
Other
1 stars 0 forks source link

Update project structure #2

Open william1357chen opened 6 months ago

william1357chen commented 6 months ago

Description

william1357chen commented 5 months ago

Found several issues while updating the Makefile.

  1. proc.c needs the linker defined symbol for initcode.S. Do some reading on how to handle linker symbols if our new path for initcode is user/initcode.S
  2. Some problems with .o files not being generated by implicit rules. Specifically ulib.o, usys.o
  3. UPROGS are required to be on the root directory since there's a check in mkfs.c to throw runtime error
  4. Faced issues with mkfs when moving it to its own directoy, speficially with #include fcntl.h

TODOs:

william1357chen commented 4 months ago

Discovery

$(LD) $(LDFLAGS) -T kernel.ld -o kernel entry.o $(OBJS) -b binary initcode entryother

The linker is going to embed the binary and automatically create some symbols so we can reference it in code.

See post: https://stackoverflow.com/questions/29034840/binutils-kernel-binary-meaning

Action item: test out what symbol is created with objcopy or ld when objfile is in a directory. If we cannot use the symbols, find another workaround.

Potential workaround: https://stackoverflow.com/questions/327609/include-binary-file-with-gnu-ld-linker-script

william1357chen commented 4 months ago

Update: was able to move user space assembly to user/ and updated symbols

Helpful posts: https://stupefydeveloper.blogspot.com/2008/08/cc-embed-binary-data-into-elf.html