Skip to content

Commit

Permalink
fix all compile on macOS
Browse files Browse the repository at this point in the history
  • Loading branch information
wangrunji0408 committed Dec 21, 2018
1 parent 2dbfb2d commit 271fcea
Show file tree
Hide file tree
Showing 31 changed files with 143 additions and 123 deletions.
1 change: 1 addition & 0 deletions labcodes/cleanall.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
set -e
cd lab1; make clean; cd ..
cd lab2; make clean; cd ..
cd lab3; make clean; cd ..
Expand Down
1 change: 1 addition & 0 deletions labcodes/gccbuildall.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
set -e
cd lab1; make clean; make; cd ..
cd lab2; make clean; make; cd ..
cd lab3; make clean; make; cd ..
Expand Down
12 changes: 6 additions & 6 deletions labcodes/lab2/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,15 @@ V := @
#USELLVM := 1
# try to infer the correct GCCPREFX
ifndef GCCPREFIX
GCCPREFIX := $(shell if i386-ucore-elf-objdump -i 2>&1 | grep '^elf32-i386$$' >/dev/null 2>&1; \
then echo 'i386-ucore-elf-'; \
GCCPREFIX := $(shell if i386-elf-objdump -i 2>&1 | grep '^elf32-i386$$' >/dev/null 2>&1; \
then echo 'i386-elf-'; \
elif objdump -i 2>&1 | grep 'elf32-i386' >/dev/null 2>&1; \
then echo ''; \
else echo "***" 1>&2; \
echo "*** Error: Couldn't find an i386-ucore-elf version of GCC/binutils." 1>&2; \
echo "*** Is the directory with i386-ucore-elf-gcc in your PATH?" 1>&2; \
echo "*** If your i386-ucore-elf toolchain is installed with a command" 1>&2; \
echo "*** prefix other than 'i386-ucore-elf-', set your GCCPREFIX" 1>&2; \
echo "*** Error: Couldn't find an i386-elf version of GCC/binutils." 1>&2; \
echo "*** Is the directory with i386-elf-gcc in your PATH?" 1>&2; \
echo "*** If your i386-elf toolchain is installed with a command" 1>&2; \
echo "*** prefix other than 'i386-elf-', set your GCCPREFIX" 1>&2; \
echo "*** environment variable to that prefix and run 'make' again." 1>&2; \
echo "*** To turn off this error, run 'gmake GCCPREFIX= ...'." 1>&2; \
echo "***" 1>&2; exit 1; fi)
Expand Down
2 changes: 1 addition & 1 deletion labcodes/lab2/kern/init/entry.S
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ __boot_pgdir:
.globl __boot_pgdir
# map va 0 ~ 4M to pa 0 ~ 4M (temporary)
.long REALLOC(__boot_pt1) + (PTE_P | PTE_U | PTE_W)
.space (KERNBASE / PGSIZE / 1024 * 4) - (. - __boot_pgdir) # pad to PDE of KERNBASE
.space (KERNBASE >> PGSHIFT >> 10 << 2) - (. - __boot_pgdir) # pad to PDE of KERNBASE
# map va KERNBASE + (0 ~ 4M) to pa 0 ~ 4M
.long REALLOC(__boot_pt1) + (PTE_P | PTE_U | PTE_W)
.space PGSIZE - (. - __boot_pgdir) # pad to PGSIZE
Expand Down
14 changes: 7 additions & 7 deletions labcodes/lab3/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,15 @@ V := @
#USELLVM := 1
# try to infer the correct GCCPREFX
ifndef GCCPREFIX
GCCPREFIX := $(shell if i386-ucore-elf-objdump -i 2>&1 | grep '^elf32-i386$$' >/dev/null 2>&1; \
then echo 'i386-ucore-elf-'; \
GCCPREFIX := $(shell if i386-elf-objdump -i 2>&1 | grep '^elf32-i386$$' >/dev/null 2>&1; \
then echo 'i386-elf-'; \
elif objdump -i 2>&1 | grep 'elf32-i386' >/dev/null 2>&1; \
then echo ''; \
else echo "***" 1>&2; \
echo "*** Error: Couldn't find an i386-ucore-elf version of GCC/binutils." 1>&2; \
echo "*** Is the directory with i386-ucore-elf-gcc in your PATH?" 1>&2; \
echo "*** If your i386-ucore-elf toolchain is installed with a command" 1>&2; \
echo "*** prefix other than 'i386-ucore-elf-', set your GCCPREFIX" 1>&2; \
echo "*** Error: Couldn't find an i386-elf version of GCC/binutils." 1>&2; \
echo "*** Is the directory with i386-elf-gcc in your PATH?" 1>&2; \
echo "*** If your i386-elf toolchain is installed with a command" 1>&2; \
echo "*** prefix other than 'i386-elf-', set your GCCPREFIX" 1>&2; \
echo "*** environment variable to that prefix and run 'make' again." 1>&2; \
echo "*** To turn off this error, run 'gmake GCCPREFIX= ...'." 1>&2; \
echo "***" 1>&2; exit 1; fi)
Expand Down Expand Up @@ -197,7 +197,7 @@ $(call create_target,ucore.img)
SWAPIMG := $(call totarget,swap.img)

$(SWAPIMG):
$(V)dd if=/dev/zero of=$@ bs=1M count=128
$(V)dd if=/dev/zero of=$@ bs=1024k count=128

$(call create_target,swap.img)

Expand Down
2 changes: 1 addition & 1 deletion labcodes/lab3/kern/init/entry.S
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ __boot_pgdir:
.globl __boot_pgdir
# map va 0 ~ 4M to pa 0 ~ 4M (temporary)
.long REALLOC(__boot_pt1) + (PTE_P | PTE_U | PTE_W)
.space (KERNBASE / PGSIZE / 1024 * 4) - (. - __boot_pgdir) # pad to PDE of KERNBASE
.space (KERNBASE >> PGSHIFT >> 10 << 2) - (. - __boot_pgdir) # pad to PDE of KERNBASE
# map va KERNBASE + (0 ~ 4M) to pa 0 ~ 4M
.long REALLOC(__boot_pt1) + (PTE_P | PTE_U | PTE_W)
.space PGSIZE - (. - __boot_pgdir) # pad to PGSIZE
Expand Down
14 changes: 7 additions & 7 deletions labcodes/lab4/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,15 @@ V := @
#USELLVM := 1
# try to infer the correct GCCPREFX
ifndef GCCPREFIX
GCCPREFIX := $(shell if i386-ucore-elf-objdump -i 2>&1 | grep '^elf32-i386$$' >/dev/null 2>&1; \
then echo 'i386-ucore-elf-'; \
GCCPREFIX := $(shell if i386-elf-objdump -i 2>&1 | grep '^elf32-i386$$' >/dev/null 2>&1; \
then echo 'i386-elf-'; \
elif objdump -i 2>&1 | grep 'elf32-i386' >/dev/null 2>&1; \
then echo ''; \
else echo "***" 1>&2; \
echo "*** Error: Couldn't find an i386-ucore-elf version of GCC/binutils." 1>&2; \
echo "*** Is the directory with i386-ucore-elf-gcc in your PATH?" 1>&2; \
echo "*** If your i386-ucore-elf toolchain is installed with a command" 1>&2; \
echo "*** prefix other than 'i386-ucore-elf-', set your GCCPREFIX" 1>&2; \
echo "*** Error: Couldn't find an i386-elf version of GCC/binutils." 1>&2; \
echo "*** Is the directory with i386-elf-gcc in your PATH?" 1>&2; \
echo "*** If your i386-elf toolchain is installed with a command" 1>&2; \
echo "*** prefix other than 'i386-elf-', set your GCCPREFIX" 1>&2; \
echo "*** environment variable to that prefix and run 'make' again." 1>&2; \
echo "*** To turn off this error, run 'gmake GCCPREFIX= ...'." 1>&2; \
echo "***" 1>&2; exit 1; fi)
Expand Down Expand Up @@ -201,7 +201,7 @@ $(call create_target,ucore.img)
SWAPIMG := $(call totarget,swap.img)

$(SWAPIMG):
$(V)dd if=/dev/zero of=$@ bs=1M count=128
$(V)dd if=/dev/zero of=$@ bs=1024k count=128

$(call create_target,swap.img)

Expand Down
2 changes: 1 addition & 1 deletion labcodes/lab4/kern/init/entry.S
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ __boot_pgdir:
.globl __boot_pgdir
# map va 0 ~ 4M to pa 0 ~ 4M (temporary)
.long REALLOC(__boot_pt1) + (PTE_P | PTE_U | PTE_W)
.space (KERNBASE / PGSIZE / 1024 * 4) - (. - __boot_pgdir) # pad to PDE of KERNBASE
.space (KERNBASE >> PGSHIFT >> 10 << 2) - (. - __boot_pgdir) # pad to PDE of KERNBASE
# map va KERNBASE + (0 ~ 4M) to pa 0 ~ 4M
.long REALLOC(__boot_pt1) + (PTE_P | PTE_U | PTE_W)
.space PGSIZE - (. - __boot_pgdir) # pad to PGSIZE
Expand Down
14 changes: 7 additions & 7 deletions labcodes/lab5/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,15 @@ V := @
#USELLVM := 1
# try to infer the correct GCCPREFX
ifndef GCCPREFIX
GCCPREFIX := $(shell if i386-ucore-elf-objdump -i 2>&1 | grep '^elf32-i386$$' >/dev/null 2>&1; \
then echo 'i386-ucore-elf-'; \
GCCPREFIX := $(shell if i386-elf-objdump -i 2>&1 | grep '^elf32-i386$$' >/dev/null 2>&1; \
then echo 'i386-elf-'; \
elif objdump -i 2>&1 | grep 'elf32-i386' >/dev/null 2>&1; \
then echo ''; \
else echo "***" 1>&2; \
echo "*** Error: Couldn't find an i386-ucore-elf version of GCC/binutils." 1>&2; \
echo "*** Is the directory with i386-ucore-elf-gcc in your PATH?" 1>&2; \
echo "*** If your i386-ucore-elf toolchain is installed with a command" 1>&2; \
echo "*** prefix other than 'i386-ucore-elf-', set your GCCPREFIX" 1>&2; \
echo "*** Error: Couldn't find an i386-elf version of GCC/binutils." 1>&2; \
echo "*** Is the directory with i386-elf-gcc in your PATH?" 1>&2; \
echo "*** If your i386-elf toolchain is installed with a command" 1>&2; \
echo "*** prefix other than 'i386-elf-', set your GCCPREFIX" 1>&2; \
echo "*** environment variable to that prefix and run 'make' again." 1>&2; \
echo "*** To turn off this error, run 'gmake GCCPREFIX= ...'." 1>&2; \
echo "***" 1>&2; exit 1; fi)
Expand Down Expand Up @@ -238,7 +238,7 @@ $(call create_target,ucore.img)
SWAPIMG := $(call totarget,swap.img)

$(SWAPIMG):
$(V)dd if=/dev/zero of=$@ bs=1M count=128
$(V)dd if=/dev/zero of=$@ bs=1024k count=128

$(call create_target,swap.img)

Expand Down
2 changes: 1 addition & 1 deletion labcodes/lab5/kern/init/entry.S
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ __boot_pgdir:
.globl __boot_pgdir
# map va 0 ~ 4M to pa 0 ~ 4M (temporary)
.long REALLOC(__boot_pt1) + (PTE_P | PTE_U | PTE_W)
.space (KERNBASE / PGSIZE / 1024 * 4) - (. - __boot_pgdir) # pad to PDE of KERNBASE
.space (KERNBASE >> PGSHIFT >> 10 << 2) - (. - __boot_pgdir) # pad to PDE of KERNBASE
# map va KERNBASE + (0 ~ 4M) to pa 0 ~ 4M
.long REALLOC(__boot_pt1) + (PTE_P | PTE_U | PTE_W)
.space PGSIZE - (. - __boot_pgdir) # pad to PGSIZE
Expand Down
14 changes: 7 additions & 7 deletions labcodes/lab6/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,15 @@ V := @
#USELLVM := 1
# try to infer the correct GCCPREFX
ifndef GCCPREFIX
GCCPREFIX := $(shell if i386-ucore-elf-objdump -i 2>&1 | grep '^elf32-i386$$' >/dev/null 2>&1; \
then echo 'i386-ucore-elf-'; \
GCCPREFIX := $(shell if i386-elf-objdump -i 2>&1 | grep '^elf32-i386$$' >/dev/null 2>&1; \
then echo 'i386-elf-'; \
elif objdump -i 2>&1 | grep 'elf32-i386' >/dev/null 2>&1; \
then echo ''; \
else echo "***" 1>&2; \
echo "*** Error: Couldn't find an i386-ucore-elf version of GCC/binutils." 1>&2; \
echo "*** Is the directory with i386-ucore-elf-gcc in your PATH?" 1>&2; \
echo "*** If your i386-ucore-elf toolchain is installed with a command" 1>&2; \
echo "*** prefix other than 'i386-ucore-elf-', set your GCCPREFIX" 1>&2; \
echo "*** Error: Couldn't find an i386-elf version of GCC/binutils." 1>&2; \
echo "*** Is the directory with i386-elf-gcc in your PATH?" 1>&2; \
echo "*** If your i386-elf toolchain is installed with a command" 1>&2; \
echo "*** prefix other than 'i386-elf-', set your GCCPREFIX" 1>&2; \
echo "*** environment variable to that prefix and run 'make' again." 1>&2; \
echo "*** To turn off this error, run 'gmake GCCPREFIX= ...'." 1>&2; \
echo "***" 1>&2; exit 1; fi)
Expand Down Expand Up @@ -238,7 +238,7 @@ $(call create_target,ucore.img)
SWAPIMG := $(call totarget,swap.img)

$(SWAPIMG):
$(V)dd if=/dev/zero of=$@ bs=1M count=128
$(V)dd if=/dev/zero of=$@ bs=1024k count=128

$(call create_target,swap.img)

Expand Down
2 changes: 1 addition & 1 deletion labcodes/lab6/kern/init/entry.S
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ __boot_pgdir:
.globl __boot_pgdir
# map va 0 ~ 4M to pa 0 ~ 4M (temporary)
.long REALLOC(__boot_pt1) + (PTE_P | PTE_U | PTE_W)
.space (KERNBASE / PGSIZE / 1024 * 4) - (. - __boot_pgdir) # pad to PDE of KERNBASE
.space (KERNBASE >> PGSHIFT >> 10 << 2) - (. - __boot_pgdir) # pad to PDE of KERNBASE
# map va KERNBASE + (0 ~ 4M) to pa 0 ~ 4M
.long REALLOC(__boot_pt1) + (PTE_P | PTE_U | PTE_W)
.space PGSIZE - (. - __boot_pgdir) # pad to PGSIZE
Expand Down
14 changes: 7 additions & 7 deletions labcodes/lab7/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,15 @@ V := @
#USELLVM := 1
# try to infer the correct GCCPREFX
ifndef GCCPREFIX
GCCPREFIX := $(shell if i386-ucore-elf-objdump -i 2>&1 | grep '^elf32-i386$$' >/dev/null 2>&1; \
then echo 'i386-ucore-elf-'; \
GCCPREFIX := $(shell if i386-elf-objdump -i 2>&1 | grep '^elf32-i386$$' >/dev/null 2>&1; \
then echo 'i386-elf-'; \
elif objdump -i 2>&1 | grep 'elf32-i386' >/dev/null 2>&1; \
then echo ''; \
else echo "***" 1>&2; \
echo "*** Error: Couldn't find an i386-ucore-elf version of GCC/binutils." 1>&2; \
echo "*** Is the directory with i386-ucore-elf-gcc in your PATH?" 1>&2; \
echo "*** If your i386-ucore-elf toolchain is installed with a command" 1>&2; \
echo "*** prefix other than 'i386-ucore-elf-', set your GCCPREFIX" 1>&2; \
echo "*** Error: Couldn't find an i386-elf version of GCC/binutils." 1>&2; \
echo "*** Is the directory with i386-elf-gcc in your PATH?" 1>&2; \
echo "*** If your i386-elf toolchain is installed with a command" 1>&2; \
echo "*** prefix other than 'i386-elf-', set your GCCPREFIX" 1>&2; \
echo "*** environment variable to that prefix and run 'make' again." 1>&2; \
echo "*** To turn off this error, run 'gmake GCCPREFIX= ...'." 1>&2; \
echo "***" 1>&2; exit 1; fi)
Expand Down Expand Up @@ -238,7 +238,7 @@ $(call create_target,ucore.img)
SWAPIMG := $(call totarget,swap.img)

$(SWAPIMG):
$(V)dd if=/dev/zero of=$@ bs=1M count=128
$(V)dd if=/dev/zero of=$@ bs=1024k count=128

$(call create_target,swap.img)

Expand Down
2 changes: 1 addition & 1 deletion labcodes/lab7/kern/init/entry.S
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ __boot_pgdir:
.globl __boot_pgdir
# map va 0 ~ 4M to pa 0 ~ 4M (temporary)
.long REALLOC(__boot_pt1) + (PTE_P | PTE_U | PTE_W)
.space (KERNBASE / PGSIZE / 1024 * 4) - (. - __boot_pgdir) # pad to PDE of KERNBASE
.space (KERNBASE >> PGSHIFT >> 10 << 2) - (. - __boot_pgdir) # pad to PDE of KERNBASE
# map va KERNBASE + (0 ~ 4M) to pa 0 ~ 4M
.long REALLOC(__boot_pt1) + (PTE_P | PTE_U | PTE_W)
.space PGSIZE - (. - __boot_pgdir) # pad to PGSIZE
Expand Down
16 changes: 8 additions & 8 deletions labcodes/lab8/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,15 @@ V := @
#USELLVM := 1
# try to infer the correct GCCPREFX
ifndef GCCPREFIX
GCCPREFIX := $(shell if i386-ucore-elf-objdump -i 2>&1 | grep '^elf32-i386$$' >/dev/null 2>&1; \
then echo 'i386-ucore-elf-'; \
GCCPREFIX := $(shell if i386-elf-objdump -i 2>&1 | grep '^elf32-i386$$' >/dev/null 2>&1; \
then echo 'i386-elf-'; \
elif objdump -i 2>&1 | grep 'elf32-i386' >/dev/null 2>&1; \
then echo ''; \
else echo "***" 1>&2; \
echo "*** Error: Couldn't find an i386-ucore-elf version of GCC/binutils." 1>&2; \
echo "*** Is the directory with i386-ucore-elf-gcc in your PATH?" 1>&2; \
echo "*** If your i386-ucore-elf toolchain is installed with a command" 1>&2; \
echo "*** prefix other than 'i386-ucore-elf-', set your GCCPREFIX" 1>&2; \
echo "*** Error: Couldn't find an i386-elf version of GCC/binutils." 1>&2; \
echo "*** Is the directory with i386-elf-gcc in your PATH?" 1>&2; \
echo "*** If your i386-elf toolchain is installed with a command" 1>&2; \
echo "*** prefix other than 'i386-elf-', set your GCCPREFIX" 1>&2; \
echo "*** environment variable to that prefix and run 'make' again." 1>&2; \
echo "*** To turn off this error, run 'gmake GCCPREFIX= ...'." 1>&2; \
echo "***" 1>&2; exit 1; fi)
Expand Down Expand Up @@ -255,7 +255,7 @@ $(call create_target,ucore.img)
SWAPIMG := $(call totarget,swap.img)

$(SWAPIMG):
$(V)dd if=/dev/zero of=$@ bs=1M count=128
$(V)dd if=/dev/zero of=$@ bs=1024k count=128

$(call create_target,swap.img)

Expand All @@ -281,7 +281,7 @@ $(SFSROOT):
$(V)$(MKDIR) $@

$(SFSIMG): $(SFSROOT) $(SFSBINS) | $(call totarget,mksfs)
$(V)dd if=/dev/zero of=$@ bs=1M count=128
$(V)dd if=/dev/zero of=$@ bs=1024k count=128
@$(call totarget,mksfs) $@ $(SFSROOT)

$(call create_target,sfs.img)
Expand Down
2 changes: 1 addition & 1 deletion labcodes/lab8/kern/init/entry.S
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ __boot_pgdir:
.globl __boot_pgdir
# map va 0 ~ 4M to pa 0 ~ 4M (temporary)
.long REALLOC(__boot_pt1) + (PTE_P | PTE_U | PTE_W)
.space (KERNBASE / PGSIZE / 1024 * 4) - (. - __boot_pgdir) # pad to PDE of KERNBASE
.space (KERNBASE >> PGSHIFT >> 10 << 2) - (. - __boot_pgdir) # pad to PDE of KERNBASE
# map va KERNBASE + (0 ~ 4M) to pa 0 ~ 4M
.long REALLOC(__boot_pt1) + (PTE_P | PTE_U | PTE_W)
.space PGSIZE - (. - __boot_pgdir) # pad to PGSIZE
Expand Down
9 changes: 9 additions & 0 deletions labcodes_answer/cleanall.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
set -e
cd lab1_result; make clean; cd ..
cd lab2_result; make clean; cd ..
cd lab3_result; make clean; cd ..
cd lab4_result; make clean; cd ..
cd lab5_result; make clean; cd ..
cd lab6_result; make clean; cd ..
cd lab7_result; make clean; cd ..
cd lab8_result; make clean; cd ..
9 changes: 9 additions & 0 deletions labcodes_answer/gccbuildall.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
set -e
cd lab1_result; make clean; make; cd ..
cd lab2_result; make clean; make; cd ..
cd lab3_result; make clean; make; cd ..
cd lab4_result; make clean; make; cd ..
cd lab5_result; make clean; make; cd ..
cd lab6_result; make clean; make; cd ..
cd lab7_result; make clean; make; cd ..
cd lab8_result; make clean; make; cd ..
16 changes: 8 additions & 8 deletions labcodes_answer/lab2_result/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,15 @@ V := @

# try to infer the correct GCCPREFX
ifndef GCCPREFIX
GCCPREFIX := $(shell if i386-ucore-elf-objdump -i 2>&1 | grep '^elf32-i386$$' >/dev/null 2>&1; \
then echo 'i386-ucore-elf-'; \
GCCPREFIX := $(shell if i386-elf-objdump -i 2>&1 | grep '^elf32-i386$$' >/dev/null 2>&1; \
then echo 'i386-elf-'; \
elif objdump -i 2>&1 | grep 'elf32-i386' >/dev/null 2>&1; \
then echo ''; \
else echo "***" 1>&2; \
echo "*** Error: Couldn't find an i386-ucore-elf version of GCC/binutils." 1>&2; \
echo "*** Is the directory with i386-ucore-elf-gcc in your PATH?" 1>&2; \
echo "*** If your i386-ucore-elf toolchain is installed with a command" 1>&2; \
echo "*** prefix other than 'i386-ucore-elf-', set your GCCPREFIX" 1>&2; \
echo "*** Error: Couldn't find an i386-elf version of GCC/binutils." 1>&2; \
echo "*** Is the directory with i386-elf-gcc in your PATH?" 1>&2; \
echo "*** If your i386-elf toolchain is installed with a command" 1>&2; \
echo "*** prefix other than 'i386-elf-', set your GCCPREFIX" 1>&2; \
echo "*** environment variable to that prefix and run 'make' again." 1>&2; \
echo "*** To turn off this error, run 'gmake GCCPREFIX= ...'." 1>&2; \
echo "***" 1>&2; exit 1; fi)
Expand All @@ -25,8 +25,8 @@ endif
ifndef QEMU
QEMU := $(shell if which qemu-system-i386 > /dev/null; \
then echo 'qemu-system-i386'; exit; \
elif which i386-ucore-elf-qemu > /dev/null; \
then echo 'i386-ucore-elf-qemu'; exit; \
elif which i386-elf-qemu > /dev/null; \
then echo 'i386-elf-qemu'; exit; \
else \
echo "***" 1>&2; \
echo "*** Error: Couldn't find a working QEMU executable." 1>&2; \
Expand Down
2 changes: 1 addition & 1 deletion labcodes_answer/lab2_result/kern/init/entry.S
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ __boot_pgdir:
.globl __boot_pgdir
# map va 0 ~ 4M to pa 0 ~ 4M (temporary)
.long REALLOC(__boot_pt1) + (PTE_P | PTE_U | PTE_W)
.space (KERNBASE / PGSIZE / 1024 * 4) - (. - __boot_pgdir) # pad to PDE of KERNBASE
.space (KERNBASE >> PGSHIFT >> 10 << 2) - (. - __boot_pgdir) # pad to PDE of KERNBASE
# map va KERNBASE + (0 ~ 4M) to pa 0 ~ 4M
.long REALLOC(__boot_pt1) + (PTE_P | PTE_U | PTE_W)
.space PGSIZE - (. - __boot_pgdir) # pad to PGSIZE
Expand Down
18 changes: 9 additions & 9 deletions labcodes_answer/lab3_result/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,15 @@ V := @

# try to infer the correct GCCPREFX
ifndef GCCPREFIX
GCCPREFIX := $(shell if i386-ucore-elf-objdump -i 2>&1 | grep '^elf32-i386$$' >/dev/null 2>&1; \
then echo 'i386-ucore-elf-'; \
GCCPREFIX := $(shell if i386-elf-objdump -i 2>&1 | grep '^elf32-i386$$' >/dev/null 2>&1; \
then echo 'i386-elf-'; \
elif objdump -i 2>&1 | grep 'elf32-i386' >/dev/null 2>&1; \
then echo ''; \
else echo "***" 1>&2; \
echo "*** Error: Couldn't find an i386-ucore-elf version of GCC/binutils." 1>&2; \
echo "*** Is the directory with i386-ucore-elf-gcc in your PATH?" 1>&2; \
echo "*** If your i386-ucore-elf toolchain is installed with a command" 1>&2; \
echo "*** prefix other than 'i386-ucore-elf-', set your GCCPREFIX" 1>&2; \
echo "*** Error: Couldn't find an i386-elf version of GCC/binutils." 1>&2; \
echo "*** Is the directory with i386-elf-gcc in your PATH?" 1>&2; \
echo "*** If your i386-elf toolchain is installed with a command" 1>&2; \
echo "*** prefix other than 'i386-elf-', set your GCCPREFIX" 1>&2; \
echo "*** environment variable to that prefix and run 'make' again." 1>&2; \
echo "*** To turn off this error, run 'gmake GCCPREFIX= ...'." 1>&2; \
echo "***" 1>&2; exit 1; fi)
Expand All @@ -25,8 +25,8 @@ endif
ifndef QEMU
QEMU := $(shell if which qemu-system-i386 > /dev/null; \
then echo 'qemu-system-i386'; exit; \
elif which i386-ucore-elf-qemu > /dev/null; \
then echo 'i386-ucore-elf-qemu'; exit; \
elif which i386-elf-qemu > /dev/null; \
then echo 'i386-elf-qemu'; exit; \
else \
echo "***" 1>&2; \
echo "*** Error: Couldn't find a working QEMU executable." 1>&2; \
Expand Down Expand Up @@ -188,7 +188,7 @@ $(call create_target,ucore.img)
SWAPIMG := $(call totarget,swap.img)

$(SWAPIMG):
$(V)dd if=/dev/zero of=$@ bs=1M count=128
$(V)dd if=/dev/zero of=$@ bs=1024k count=128

$(call create_target,swap.img)

Expand Down
Loading

0 comments on commit 271fcea

Please sign in to comment.