Discussion:
Nachos on Linux
(too old to reply)
Yu Wai Wong
2006-09-16 05:32:33 UTC
Permalink
Since I'm starting to fiddle around with the nachos istallation on linux,
we may as well have a common thread for those linux users out there. I've
basically taken the source files and unpacked them. I then go to the
directory build.linux. In there I copied the Makefile I found in
build.solaris ( that for some reason didnt
show up symbolicly) to build.linux. I 'make depend' then 'make nachos'.
The following error is what shows up:

g++ -g -Wall -Wno-deprecated -I../network -I../filesys -I../userprog
-I../threads -I../machine -I../lib -DRDATA -DSIM_FIX -DFILESYS_STUB
-DRR_QUANTUM -Dx86 -DLINUX -march=athlon64 -O2 -m32 -DCHANGED -c
../network/post.cc
/lib/cpp -P -I../network -I../filesys -I../userprog -I../threads
-I../machine -I../lib -Dx86 -DLINUX -march=athlon64 -O2 -m32
../threads/switch.s > swtch.s
as -o switch.o swtch.s
swtch.s: Assembler messages:
swtch.s:6: Error: suffix or operands invalid for `push'
swtch.s:8: Error: suffix or operands invalid for `push'
swtch.s:9: Error: suffix or operands invalid for `call'
swtch.s:10: Error: suffix or operands invalid for `call'
swtch.s:11: Error: suffix or operands invalid for `call'
swtch.s:15: Error: suffix or operands invalid for `pop'

I run a Gentoo Linux amd64 with the flags inside Makefile.dep

HOSTCFLAGS = -Dx86 -DLINUX -march=athlon64 -O2 -m32

inside code/threads/switch.s the -Dx86 switch from Makefile.dep flows to
the #ifdef x86
where it then defines ThreadRoot and SWITCH itself. I know theres some way
to compile this as a 32-bit binary but i seem to be missing something
simple as the amd64 cpu does not understand push or call or pop
apparently.
Stefan Buettcher
2006-09-16 06:05:09 UTC
Permalink
Try running the assembler with flag --32:

switch.o: ../threads/switch.s
$(CPP) $(CPP_AS_FLAGS) -P $(INCPATH) $(HOSTCFLAGS) ../threads/switch.s
Post by Yu Wai Wong
swtch.s
$(AS) --32 -o switch.o swtch.s

You will also need to add -m32 to the LDFLAGS in your Makefile.

Stefan
Post by Yu Wai Wong
Since I'm starting to fiddle around with the nachos istallation on
linux, we may as well have a common thread for those linux users out
there. I've basically taken the source files and unpacked them. I then
go to the directory build.linux. In there I copied the Makefile I found
in build.solaris ( that for some reason didnt show up symbolicly) to
build.linux. I 'make depend' then 'make nachos'. The following error is
g++ -g -Wall -Wno-deprecated -I../network -I../filesys -I../userprog
-I../threads -I../machine -I../lib -DRDATA -DSIM_FIX -DFILESYS_STUB
-DRR_QUANTUM -Dx86 -DLINUX -march=athlon64 -O2 -m32 -DCHANGED -c
../network/post.cc
/lib/cpp -P -I../network -I../filesys -I../userprog -I../threads
-I../machine -I../lib -Dx86 -DLINUX -march=athlon64 -O2 -m32
../threads/switch.s > swtch.s
as -o switch.o swtch.s
swtch.s:6: Error: suffix or operands invalid for `push'
swtch.s:8: Error: suffix or operands invalid for `push'
swtch.s:9: Error: suffix or operands invalid for `call'
swtch.s:10: Error: suffix or operands invalid for `call'
swtch.s:11: Error: suffix or operands invalid for `call'
swtch.s:15: Error: suffix or operands invalid for `pop'
I run a Gentoo Linux amd64 with the flags inside Makefile.dep
HOSTCFLAGS = -Dx86 -DLINUX -march=athlon64 -O2 -m32
inside code/threads/switch.s the -Dx86 switch from Makefile.dep flows
to the #ifdef x86
where it then defines ThreadRoot and SWITCH itself. I know theres some
way to compile this as a 32-bit binary but i seem to be missing
something simple as the amd64 cpu does not understand push or call or
pop apparently.
Yu Wai Wong
2006-09-16 15:20:22 UTC
Permalink
Thx for the tip for the --32 flag on the assembler, it breezed through it
perfectly, I did however get a different error involving some undefined
references, so I took out the -m32 flag from LDFLAGS and it magically
compiled which is of course some cause of concern. Nevertheless i type in
./nachos and i get this:

Machine halting!

Ticks: total 10, idle 0, system 10, user 0
Disk I/O: reads 0, writes 0
Console I/O: reads 0, writes 0
Paging: faults 0
Network I/O: packets received 0, sent 0
Post by Stefan Buettcher
switch.o: ../threads/switch.s
$(CPP) $(CPP_AS_FLAGS) -P $(INCPATH) $(HOSTCFLAGS) ../threads/switch.s
Post by Yu Wai Wong
swtch.s
$(AS) --32 -o switch.o swtch.s
You will also need to add -m32 to the LDFLAGS in your Makefile.
Stefan
Post by Yu Wai Wong
Since I'm starting to fiddle around with the nachos istallation on linux,
we may as well have a common thread for those linux users out there. I've
basically taken the source files and unpacked them. I then go to the
directory build.linux. In there I copied the Makefile I found in
build.solaris ( that for some reason didnt show up symbolicly) to
build.linux. I 'make depend' then 'make nachos'. The following error is
g++ -g -Wall -Wno-deprecated -I../network -I../filesys -I../userprog
-I../threads -I../machine -I../lib -DRDATA -DSIM_FIX -DFILESYS_STUB
-DRR_QUANTUM -Dx86 -DLINUX -march=athlon64 -O2 -m32 -DCHANGED -c
../network/post.cc
/lib/cpp -P -I../network -I../filesys -I../userprog -I../threads
-I../machine -I../lib -Dx86 -DLINUX -march=athlon64 -O2 -m32
../threads/switch.s > swtch.s
as -o switch.o swtch.s
swtch.s:6: Error: suffix or operands invalid for `push'
swtch.s:8: Error: suffix or operands invalid for `push'
swtch.s:9: Error: suffix or operands invalid for `call'
swtch.s:10: Error: suffix or operands invalid for `call'
swtch.s:11: Error: suffix or operands invalid for `call'
swtch.s:15: Error: suffix or operands invalid for `pop'
I run a Gentoo Linux amd64 with the flags inside Makefile.dep
HOSTCFLAGS = -Dx86 -DLINUX -march=athlon64 -O2 -m32
inside code/threads/switch.s the -Dx86 switch from Makefile.dep flows to
the #ifdef x86
where it then defines ThreadRoot and SWITCH itself. I know theres some way
to compile this as a 32-bit binary but i seem to be missing something
simple as the amd64 cpu does not understand push or call or pop apparently.
Yu Wai Wong
2006-09-16 15:41:14 UTC
Permalink
Ok I had made an earlier mistake by removing the -m32 flag from HOSTCFLAGS
which was careless. I placed it back in, placed --32 in the assembly
command for the switch.o and placed -m32 in LDFLAGS and when i run
./nachos -K -C it works as intended.

Later tonight I'll write an indepth step by step to unpack,compile, and
run after im satisfied with the operation of nachos.
Post by Yu Wai Wong
Thx for the tip for the --32 flag on the assembler, it breezed through it
perfectly, I did however get a different error involving some undefined
references, so I took out the -m32 flag from LDFLAGS and it magically
compiled which is of course some cause of concern. Nevertheless i type in
Machine halting!
Ticks: total 10, idle 0, system 10, user 0
Disk I/O: reads 0, writes 0
Console I/O: reads 0, writes 0
Paging: faults 0
Network I/O: packets received 0, sent 0
Post by Stefan Buettcher
switch.o: ../threads/switch.s
$(CPP) $(CPP_AS_FLAGS) -P $(INCPATH) $(HOSTCFLAGS) ../threads/switch.s
Post by Yu Wai Wong
swtch.s
$(AS) --32 -o switch.o swtch.s
You will also need to add -m32 to the LDFLAGS in your Makefile.
Stefan
Post by Yu Wai Wong
Since I'm starting to fiddle around with the nachos istallation on linux,
we may as well have a common thread for those linux users out there. I've
basically taken the source files and unpacked them. I then go to the
directory build.linux. In there I copied the Makefile I found in
build.solaris ( that for some reason didnt show up symbolicly) to
build.linux. I 'make depend' then 'make nachos'. The following error is
g++ -g -Wall -Wno-deprecated -I../network -I../filesys -I../userprog
-I../threads -I../machine -I../lib -DRDATA -DSIM_FIX -DFILESYS_STUB
-DRR_QUANTUM -Dx86 -DLINUX -march=athlon64 -O2 -m32 -DCHANGED -c
../network/post.cc
/lib/cpp -P -I../network -I../filesys -I../userprog -I../threads
-I../machine -I../lib -Dx86 -DLINUX -march=athlon64 -O2 -m32
../threads/switch.s > swtch.s
as -o switch.o swtch.s
swtch.s:6: Error: suffix or operands invalid for `push'
swtch.s:8: Error: suffix or operands invalid for `push'
swtch.s:9: Error: suffix or operands invalid for `call'
swtch.s:10: Error: suffix or operands invalid for `call'
swtch.s:11: Error: suffix or operands invalid for `call'
swtch.s:15: Error: suffix or operands invalid for `pop'
I run a Gentoo Linux amd64 with the flags inside Makefile.dep
HOSTCFLAGS = -Dx86 -DLINUX -march=athlon64 -O2 -m32
inside code/threads/switch.s the -Dx86 switch from Makefile.dep flows to
the #ifdef x86
where it then defines ThreadRoot and SWITCH itself. I know theres some way
to compile this as a 32-bit binary but i seem to be missing something
simple as the amd64 cpu does not understand push or call or pop apparently.
Yu Wai Wong
2006-09-20 21:34:23 UTC
Permalink
Although a little late, as promised, I will now write the simple steps
involved in installing nachos on linux for 64-bit users, specifically
Gentoo.

1. download http://www.student.cs.uwaterloo.ca/~cs350/common/nachos.tar.gz
and unpack where you wish it to be.

2. enter the nachos directory and then into code directory

3. cp build.solaris/Makefile.dep build.linux/Makefile.dep (this may not be
necessary if you already see it there) and do the same for Makefile in
build.solaris as well.

4. go to directory build.linux and edit Makefile.dep change :

HOSTCFLAGS = -Dx86 -DLINUX

to:

HOSTCFLAGS = -Dx86 -DLINUX -march=athlon64 -O2 -m32

if you use a different march flag inside your /etc/make.conf then use that
march value.

5. go edit Makefile and change:
LDFLAGS =

to:

LDFLAGS = -m32

and:

$(AS) -o switch.o swtch.s

to:

$(AS) --32 -o switch.o swtch.s

Then after that all you have to do is type :

make nachos

inside the build.linux directory. Hopefully that should help any 64-bit
users out there.

Im still in the mist of trying to setup the cross compiler, my machine seems
to have an issue with both version provided, if anyone has solved this
feel free to add how you set up the cross compiler to correctly work.

As far as i know coff2noff is working fine from just typing make inside
the coff2noff directory.
Post by Yu Wai Wong
Ok I had made an earlier mistake by removing the -m32 flag from HOSTCFLAGS
which was careless. I placed it back in, placed --32 in the assembly command
for the switch.o and placed -m32 in LDFLAGS and when i run
./nachos -K -C it works as intended.
Later tonight I'll write an indepth step by step to unpack,compile, and run
after im satisfied with the operation of nachos.
Post by Yu Wai Wong
Thx for the tip for the --32 flag on the assembler, it breezed through it
perfectly, I did however get a different error involving some undefined
references, so I took out the -m32 flag from LDFLAGS and it magically
compiled which is of course some cause of concern. Nevertheless i type in
Machine halting!
Ticks: total 10, idle 0, system 10, user 0
Disk I/O: reads 0, writes 0
Console I/O: reads 0, writes 0
Paging: faults 0
Network I/O: packets received 0, sent 0
Post by Stefan Buettcher
switch.o: ../threads/switch.s
$(CPP) $(CPP_AS_FLAGS) -P $(INCPATH) $(HOSTCFLAGS) ../threads/switch.s
Post by Yu Wai Wong
swtch.s
$(AS) --32 -o switch.o swtch.s
You will also need to add -m32 to the LDFLAGS in your Makefile.
Stefan
Post by Yu Wai Wong
Since I'm starting to fiddle around with the nachos istallation on linux,
we may as well have a common thread for those linux users out there. I've
basically taken the source files and unpacked them. I then go to the
directory build.linux. In there I copied the Makefile I found in
build.solaris ( that for some reason didnt show up symbolicly) to
build.linux. I 'make depend' then 'make nachos'. The following error is
g++ -g -Wall -Wno-deprecated -I../network -I../filesys -I../userprog
-I../threads -I../machine -I../lib -DRDATA -DSIM_FIX -DFILESYS_STUB
-DRR_QUANTUM -Dx86 -DLINUX -march=athlon64 -O2 -m32 -DCHANGED -c
../network/post.cc
/lib/cpp -P -I../network -I../filesys -I../userprog -I../threads
-I../machine -I../lib -Dx86 -DLINUX -march=athlon64 -O2 -m32
../threads/switch.s > swtch.s
as -o switch.o swtch.s
swtch.s:6: Error: suffix or operands invalid for `push'
swtch.s:8: Error: suffix or operands invalid for `push'
swtch.s:9: Error: suffix or operands invalid for `call'
swtch.s:10: Error: suffix or operands invalid for `call'
swtch.s:11: Error: suffix or operands invalid for `call'
swtch.s:15: Error: suffix or operands invalid for `pop'
I run a Gentoo Linux amd64 with the flags inside Makefile.dep
HOSTCFLAGS = -Dx86 -DLINUX -march=athlon64 -O2 -m32
inside code/threads/switch.s the -Dx86 switch from Makefile.dep flows to
the #ifdef x86
where it then defines ThreadRoot and SWITCH itself. I know theres some
way to compile this as a 32-bit binary but i seem to be missing something
simple as the amd64 cpu does not understand push or call or pop apparently.
John Peberdy
2006-09-21 05:19:36 UTC
Permalink
Hi Yu Wai Wong, I'm on Gentoo also.
Post by Yu Wai Wong
Im still in the mist of trying to setup the cross compiler, my machine seems
to have an issue with both version provided, if anyone has solved this
feel free to add how you set up the cross compiler to correctly work.
To get the crosscompiling going I did the following:

$ wget http://www.student.cs.uwaterloo.ca/~cs350/common/linux-gcc.tar.gz

Note that:

$strings decstation-ultrix-gcc | grep nachos
/usr/local/nachos/lib/gcc-lib/
/usr/local/nachos/lib/
/usr/local/nachos/

so you have to extract that to / because of the hardcoded paths. It
previosly didnt work for me when I didn't put it in /usr/local even though
I updated Makefile.dep.

Then in nachos/test just make.

Hope that helps.

John
Post by Yu Wai Wong
As far as i know coff2noff is working fine from just typing make inside
the coff2noff directory.
Post by Yu Wai Wong
Ok I had made an earlier mistake by removing the -m32 flag from HOSTCFLAGS
which was careless. I placed it back in, placed --32 in the assembly
command for the switch.o and placed -m32 in LDFLAGS and when i run
./nachos -K -C it works as intended.
Later tonight I'll write an indepth step by step to unpack,compile, and run
after im satisfied with the operation of nachos.
Post by Yu Wai Wong
Thx for the tip for the --32 flag on the assembler, it breezed through it
perfectly, I did however get a different error involving some undefined
references, so I took out the -m32 flag from LDFLAGS and it magically
compiled which is of course some cause of concern. Nevertheless i type in
Machine halting!
Ticks: total 10, idle 0, system 10, user 0
Disk I/O: reads 0, writes 0
Console I/O: reads 0, writes 0
Paging: faults 0
Network I/O: packets received 0, sent 0
Post by Stefan Buettcher
switch.o: ../threads/switch.s
$(CPP) $(CPP_AS_FLAGS) -P $(INCPATH) $(HOSTCFLAGS) ../threads/switch.s
Post by Yu Wai Wong
swtch.s
$(AS) --32 -o switch.o swtch.s
You will also need to add -m32 to the LDFLAGS in your Makefile.
Stefan
Post by Yu Wai Wong
Since I'm starting to fiddle around with the nachos istallation on
linux, we may as well have a common thread for those linux users out
there. I've basically taken the source files and unpacked them. I then
go to the directory build.linux. In there I copied the Makefile I found
in build.solaris ( that for some reason didnt show up symbolicly) to
build.linux. I 'make depend' then 'make nachos'. The following error is
g++ -g -Wall -Wno-deprecated -I../network -I../filesys -I../userprog
-I../threads -I../machine -I../lib -DRDATA -DSIM_FIX -DFILESYS_STUB
-DRR_QUANTUM -Dx86 -DLINUX -march=athlon64 -O2 -m32 -DCHANGED -c
../network/post.cc
/lib/cpp -P -I../network -I../filesys -I../userprog -I../threads
-I../machine -I../lib -Dx86 -DLINUX -march=athlon64 -O2 -m32
../threads/switch.s > swtch.s
as -o switch.o swtch.s
swtch.s:6: Error: suffix or operands invalid for `push'
swtch.s:8: Error: suffix or operands invalid for `push'
swtch.s:9: Error: suffix or operands invalid for `call'
swtch.s:10: Error: suffix or operands invalid for `call'
swtch.s:11: Error: suffix or operands invalid for `call'
swtch.s:15: Error: suffix or operands invalid for `pop'
I run a Gentoo Linux amd64 with the flags inside Makefile.dep
HOSTCFLAGS = -Dx86 -DLINUX -march=athlon64 -O2 -m32
inside code/threads/switch.s the -Dx86 switch from Makefile.dep flows
to the #ifdef x86
where it then defines ThreadRoot and SWITCH itself. I know theres some
way to compile this as a 32-bit binary but i seem to be missing
something simple as the amd64 cpu does not understand push or call or
pop apparently.
Continue reading on narkive:
Loading...