Page 1 of 2
Developing on Mac
Posted: Sat Mar 05, 2005 3:30 pm
by klurg
Hello!
I have some problems with developing my OS on my Mac, I have a fat12-image which I mount and copy my kernel to, but now and then when I run bochs on that image, grub can't boot it because the file format is incorrect.
I'm running OS X 10.3.7.
Re:Developing on Mac
Posted: Sat Mar 05, 2005 5:41 pm
by Hank
How did you create your image? How about mounting and "filling" it?
I have my OS working well with bochs and a disk image on OS X 10.3.8
If needed, here's my makefile code to copy the newly built kernel into the disk image.
Code: Select all
hdiutil attach /usr/local/bin/dlxlinux/os.img
cp ./build/kernel.elf /Volumes/NO\ NAME/KERNEL.ELF
-rm -rd /Volumes/NO\ NAME/.Trashes/
hdiutil detach /dev/disk1
1) the hdiutil mounts the image specified (usr/local/.../os.img)
2) because the image is mounted as /Volumes/NO\ NAME, the second command copies the kernel to the spot i specified in GRUB
3) I had some problems with the Finder creating a trash folder, so this command deletes the trash, but doesn't cause Make to fail if it's not there (the preceding '-')
4) Unmount the image (you may need to change this, do an "ls /dev" before and after mounting your image and see what devide is added.)
Re:Developing on Mac
Posted: Sun Mar 06, 2005 8:55 am
by klurg
Thanks! It works now.
Developing on Mac
Posted: Tue Mar 08, 2005 8:06 pm
by calpis
Hi, could anyone tell me how to building a binutil and cross-compiler under a MAC, or is it possible?
Basically, I wanted to do some OS programming for my x86 PC under my mac. I have followed some tutorial on the web and managed to do the basic things on my pc such as linker script as (elf), assembly code etc. But when I tried to do the same on osx, it doesn't work.
I am actually quite new to this topic. And I read and find out something about cross-compiler and binutil which might be the problem if my guess is correct.
Any kind of advice/help would be great! Many thanks.
I uses an OSX 10.3.7.
Re:Developing on Mac
Posted: Tue Mar 08, 2005 10:38 pm
by AR
http://www.osdev.org/osfaq2/index.php/G ... s-Compiler
You can build a cross compiler for x86 on mac as the compiler target is independant of the host. The native mac GCC may be missing the x86 compatibility components which will make a cross compiler a neccessity.
Re:Developing on Mac
Posted: Wed Mar 09, 2005 7:48 pm
by calpis
Thanks for your reply,
I downloaded binutils and compile it and followed the gcc cross compiler. at configure, The host system type is ppc darwin7.8.0 and target system type as i586-pc-elf. And I see some YESs and NOs and Warnings...but its making.
So is this what you mean by "the compiler target is independant of the host?" If not what do you mean and what should I do to make cross compiler?
Sorry if I m being silly. I honestly don't have a clue. Thanks again!
ar...by the way i think i just saw "C compiler as cross-compiler....NO" on screen while making...help me pls~
Re:Developing on Mac
Posted: Wed Mar 09, 2005 10:55 pm
by AR
When building GCC, there is 3 parameters: Host, Build and Target. Build is the computer being used to compile GCC, Host is the computer that will run GCC, Target is the computer type that the cross compiler will produce executables for.
If you don't set Host or Build then they will be auto detected as PPC, only the target needs to be set explicitly. What ./configure says doesn't really matter unless it fails. If you are just straight copying the cross compiler guide it should work fine.
Re:Developing on Mac
Posted: Thu Mar 10, 2005 2:17 am
by Solar
The "cross compiler... NO" refers to the compiler you are using to compile the cross-compiler. (Now, who can make up the most confusing sentence with the most occurrences of "compiler" in it?
)
Re:Developing on Mac
Posted: Thu Mar 10, 2005 10:59 am
by calpis
Thanks for the replies
Aha! OK, I get it now for the cross compiler message, and the GCC parameters, its very useful to know. So all is left to do now is to compile the GCC-Core 3.4 in this way, and It should be fine.
Also, could anyone tell me what "cctools-495" is and how to use it if possible? I had a look and tried to run ./configure etc.
I downloaded from the address below and wonder if it is any use, in case i have problems with compiling the cross compiler.
http://www.opensource.apple.com/darwins ... 495.tar.gz
Thank you all
Re:Developing on Mac
Posted: Thu Mar 10, 2005 6:41 pm
by calpis
Um....if by any chance that the ld command was deleted, its there anyway to recover it in osx gcc3.3?
:-\
Re:Developing on Mac
Posted: Fri Mar 11, 2005 4:14 am
by Solar
Rebuild binutils?
Re:Developing on Mac
Posted: Fri Mar 11, 2005 4:09 pm
by calpis
I founded it now. Its not the binutils, its actually the Xcode again. But I m sure it will ignore the updated xcode or just overwrite it tho...
I tried to follow the GCC Cross Compiler tutorial on php wiki
when I try to install gcc after I installed binutils. I got the following errors. Any clues?
Thanks
rm -f test-demangle
rm -f Makefile
make SUBDIRS="" clean
make SUBDIRS="" mostlyclean
rm -rf *.o pic core errs \#* *.E a.out
rm -f needed.awk needed2.awk errors dummy needed-list config.h stamp-*
rm -f stamp-picdir
rm -f libiberty.aux libiberty.cp libiberty.cps libiberty.fn libiberty.ky
rm -f libiberty.log libiberty.tmp libiberty.tps libiberty.pg
rm -f libiberty.pgs libiberty.toc libiberty.tp libiberty.tpl libiberty.vr
rm -f libtexi.stamp
rm -f *.a required-list tmpmulti.out
rm -f libiberty.dvi libiberty.info* libiberty.html
rm -f *~ Makefile config.cache config.status xhost-mkfrag TAGS multilib.out
rm -f config.log
rmdir testsuite 2>/dev/null
make[1]: [distclean] Error 1 (ignored)
configure: creating cache ../config.cache
configure: error: cannot find install-sh or install.sh in ./../.. ././../..
make: *** [configure-build-libiberty] Error 1
Re:Developing on Mac
Posted: Fri Mar 11, 2005 5:54 pm
by B.E
klurg wrote:
Hello!
I have some problems with developing my OS on my Mac, I have a fat12-image which I mount and copy my kernel to, but now and then when I run bochs on that image, grub can't boot it because the file format is incorrect.
I'm running OS X 10.3.7.
Do you have a x86 computer? Can I get more information about the file format problem?
Mac don't work the same way that the x86 work. I have not developed on Mac, So I'm don't know a lot. But you?re trying to build an OS on something that doesn't support the things that GRUB does.
For example, thx86 uses destination, source (i.e. mov ax, 3; puts 3 into ax) but on the Mac processor it uses source, destination (i.e. mov 3, ax; puts 3 into ax), so you would have to find a version of GRUB that is specific for MAC.
Re:Developing on Mac
Posted: Fri Mar 11, 2005 8:18 pm
by AR
install.sh is the installation shell script, it should have either been included or generated by configure. Try rerunning configure with exactly the same options then "make install"
Re:Developing on Mac
Posted: Sat Mar 12, 2005 5:22 am
by Candy
B.E wrote:
klurg wrote:
Hello!
I have some problems with developing my OS on my Mac, I have a fat12-image which I mount and copy my kernel to, but now and then when I run bochs on that image, grub can't boot it because the file format is incorrect.
I'm running OS X 10.3.7.
Do you have a x86 computer? Can I get more information about the file format problem?
Mac don't work the same way that the x86 work. I have not developed on Mac, So I'm don't know a lot. But you?re trying to build an OS on something that doesn't support the things that GRUB does.
For example, thx86 uses destination, source (i.e. mov ax, 3; puts 3 into ax) but on the Mac processor it uses source, destination (i.e. mov 3, ax; puts 3 into ax), so you would have to find a version of GRUB that is specific for MAC.
The order of operands is only in terms of writing. It has NOTHING to do with the computer itself. Grub ran on bochs on a mac is IDENTICAL in function to Grub on bochs on an x86. So, the problem is not in any way mac related. Not in terms of the mac itself that is.
Also, did you notice the question was answered correctly before your reply?