playing with Darwin

A distanza di anni dalla prima volta in cui mi dilettai con l’emulazione di computer Macintosh con architettura PowerPC, recentemente il mio interesse è nuovamente ricaduto su Darwin, il sistema operativo open source di Apple che costituisce la base di Mac OS X, questa volta in versione X86. Premetto di essere piuttosto arrugginito per quanto riguarda il “mondo” UNIX!

Hexley, la mascotte di Darwin.
Hexley, la mascotte di DarwinOS. Copyright 2000 by Jon Hooper All Rights Reserved.

A dire il vero, già provai a installare Darwin su un PC, ma dopo aver disastrosamente cancellato la partizione sbagliata (mannaggia ai modi in cui i differenti fdisk chiamano dischi e partizioni!) dovetti desistere. Per stare tranquillo, ho deciso quindi di installare Darwin su una macchina virtuale, preferibilmente su Virtual Box (open source).

Per quanto riguarda la versione di Darwin, ho utilizzato l’ultima versione rilasciata ufficialmente da Apple  in forma di immagine ISO (la non proprio recente 8.0.1, corrispondente a MacOSX 10.4 “Tiger”), ancora reperibile sul sito di Apple. In seguito, tempo permettendo, mi piacerebbe provare anche le release di PureDarwin.

Sebbene abbia seguito la guida “My Mission to make a Darwin virtual machine in Virtual Box” alla lettera, più volte e con varie configurazioni, non sono riuscito a installare Darwin su una macchina virtuale in Virtual Box, per cui ho eseguito i passi riportati nella guida su una macchina virtuale VMware Player e in seguito ho creato una nuova macchina in Virtual Box, utilizzando il file immagine hard disk creato con VMware Player.

Per preservare il funzionamento della rete, alla scheda di rete in Virtual Box ho assegnato lo stesso MAC address della scheda configurata in VMware Player (suppongo che avrei potuto modificare la configurazione delle schede di rete in Darwin mediante ifconfig, ma per mancanza di tempo non ho approfondito la questione).

Portata a termine l’installazione, realizzo che, a differenza della versione per PowerPC che avevo precedentemente utilizzato (7.0.1), la 8.0.1 non contiene il sistema a finestre X. Per l’installazione di XFree86 e di altri utili software open source, decido di utilizzare MacPorts, in modo da automatizzare e velocizzare il processo di scaricamento, risoluzione delle dipendenze, compilazione e installazione delle applicazioni.

Scaricata l’ultima versione disponibile (1.9.1) in forma di codice sorgente mediante il tool curl (curl -O http://distfiles.macports.org/MacPorts/MacPorts-1.9.1.tar.gz), incluso in Darwin, mi accingo alla compilazione, che riesco a portare a termine solo invocando lo script di configurazione con l’opzione --without-objc-foundation:


./configure --without-objc-foundation
make
sudo make install

Per rendere effettiva l’installazione di MacPorts, ho creato un file .profile in cui, oltre ad alcune preferenze personali, ho impostato i path e la variabile DISPLAY, come illustrato nella guida di MacPorts.

Installato con successo MacPorts e, mediante MacPorts stesso, alcune piccole applicazioni giusto per verificarne il funzionamento, è giunta l’ora di dare a Darwin un’interfaccia grafica (nella fattispecie la versione 4.7.0 dell’implementazione XFree86 del sistema a finestre X11R6):


sudo port install XFree86

Al termine dell’installazione, prima di poter utilizzare X è necessario scaricare i file di keymapping e copiarli in /System/Library/Keyboards, come riportato sul sito di supporto di MacPorts. Nel mio caso, ho scaricato “USA” e “Italiano”, anche se devo ancora documentarmi su come utilizzare il mapping per tastiera italiana.

È giunta finalmente l’ora, dopo tanta fatica, di godersi il risulatato: basta creare un semplice script .xinitrc:


xterm -geometry 80x24+10+10 &
twm

e lanciare startx.

Darwin 8.0.1 con il window manager TWM
Darwin 8.0.1 con il window manager TWM

Una risposta a “playing with Darwin”

  1. Purtroppo la guida originale “My Mission to make a Darwin virtual machine in Virtual Box” di jjsullivan a cui faccio riferimento per l’installazione di Darwin in VirtualBox sembra non essere più disponibile all’indirizzo: http://www.facepunch.com/showthread.php?t=726350 pertanto riporto la copia che mi ero previdentemente tenuto da parte 😉

    Hey guys! I finished the proof of concept guide! (FINALLY!)

    Table of contents:

    1. Guide(Below)

    2. Q and A/Extra tips(Below guide)

    Requirements:

    1. You know how to change the settings on virtual machines in virtual box.

    2. You can download stuff.

    3. Have an apple ID.

    4. You know how to apply launch parameters.

    Ok now for the guide

    Step1: Dowload the darwin 8.01 install image from the apple open source developer website:

    http://opensource.apple.com

    Step2:

    While thats downloading, make the virtual machine with these settings exactly.

    Name: Darwin 8.0.1

    Guest type: FreeBSD

    RAM: around 1000mbs

    Disk size: around 10 Gbs (dynamic images work too)

    Enable VT-x/AMD-V With nested paging

    Enable PAE/NX

    Disable ACPI (Don’t worry, it’ll still turn on)

    Step3:

    Now mount the darwin install image and run the Virtual machine.

    Step4:

    NOW AS SOON AS THE CD IMAGE RUNS PRESS A KEY IMEDIATLY

    Step5:

    You will be prompted to put in some boot parameters, type this into the prompt:

    -s platform=X86PC

    the machine may halt the first time and try to fetch debug info, if this happens, reboot the machine and try again.

    Step6:

    Now time to install the thing, once you get to a command line propt called localhost # or something similar type this in to it:

    sh /etc/rc

    this will launch the darwin installer

    Step7:

    Now you will see one install disk option, of course, select it by typing one into the prompt and hit enter

    Step8:

    Now we need to reset the mbr of the vbox disk, when you get to the next prompt, type two on your keyboard and press enter and you will enter fdisk.

    Step9:

    Now we will actually reset the mbr now, on entering fdisk it will ask you to reset your mbr table, of course select your only option by pressing y and enter.

    Step10:

    Now to reset the mbr, enter this into the fdisk propmt:

    reinit

    then hit enter, then write the new mbr by typing this:

    write

    then enter again, after that, quit fdisk by typing:

    quit

    then enter.

    Step11:

    Dont install yet, restart the virtual machine, then use the same boot parameter steps as in steps 4 and 5.

    Step12:

    Now repeat step 6

    Step13:

    Now select the virtual box disk as in step 7

    Step14:

    Now go ahead and select the auto format option for install by typing one into the promt and enter

    Step15:

    It will ask you what type of filesystem you want to use, use hfs by typing this into the promt:

    hfs

    and press enter

    Step16:

    Now type in your desiered volume label and enter, I personally reccomend disk0. It will warn you that you will wipe the disk by doing the install, unless some how you can compress files into a virtual disk I think you have no problem saying yes to the prompt, go ahead and type yes into the prompt and hit enter.

    Step17:

    It will extract all the nessacary files, it will take about fiften minutes tops. So grab a beer and relax for a while 🙂

    Step18:

    It will ask you for a root password, go ahead and type one in. it will not show you encyrpted characters though, but it will still be saving the password, once your done hit enter and confirm it and hit enter again.
    Then it will ask you for a system name, type in your desiered name and enter.

    Step19:

    Now to create your own account, press the number corresponding with the option to create a new account and enter when you get to the prompt with three options.

    Step20:

    Now you will be introduced with some propmts for your account info, for prompts with default values, just press enter a those, those that arent are pretty self explanatory so go ahead and fill out those and press enter at them. But for the shell option, select the bash shell by typing in bash and enter.

    Step21:

    Confirm your account, once you’ve done that and get back to the three options promt turn off the virtual machine without saving.

    Step22:

    Unmount the cd image and restart the virtual machine.

    Step23:

    Your almost there! Once again press a key and type in these launch parameters into the prompt:

    platform=X86PC -F

    Step24:

    You will be introduced with an apple bootscreen! horray! but wait, whats that ugly command line still doing here?

    Step25:

    Login

    Step26:

    You’re done! Welcome to darwin!

    Extra stuff and questions:

    Extra step: Save a save-stae when you log out to not have to type in the boot parameters every time you start the vm.

    Q:WTF Is Darwin?

    A: Darwin Is the main UNIX/BSD kernal OS that runs Mac OS X.x. Since it is based off of openBSD darwin is opensource and free of charge.

    Q:Wait, open-source? Isn’t it a commercial OS?

    A: Yes, but this is the open-source version using the bare-bone UNIX kernal.

    Q:Does it look like Mac OS X.x?

    A:No this is only a proof of concept, The GUI will be coming soon.

    Q:Do I need to be a developer to install it?

    A: If you have an Apple ID and you’ve installed Linux/UNIX/Windows before you should be fine.

    Q:Is this Illegal?

    A:HECK NO! Even though the ELUA on the commercial version of OS X says that it can be installed on apple hardware this does not apply for darwin. Hence that it is open source, it is platform independent(Up to version 8 though). In fact, if more people knew about this this would be the Ideal for installing Mac OS X.x.

    Q: Does this really go up to ALL versions of Mac OS X?

    A: Yes

    Q: CAN I INSTALL LEOPARD!?

    A: If you have a good enough computer and all of the right drivers, yes. But with most PC’s maybe including yours, no.

    Q: Can I install leopard on my 1gb RAM dell?

    A: Yes

    Q: WOOOOHOOO! CAN I DO’S THATS NOWS!

    A: If you can build the latest version of darwin

    Q: HOWS DO IES DO THATS!?

    A: learn from google

    Credits:

    This guide was made from experementing with launch parameters, so basically, It’s been only me who’s given any input. So all credits go to ME!!!!!!!!!!!

    jjsullivan
    14th April 2009, 10:08PM

Lascia un commento

Il tuo indirizzo email non sarà pubblicato. I campi obbligatori sono contrassegnati *

Questo sito usa Akismet per ridurre lo spam. Scopri come i tuoi dati vengono elaborati.