From mboxrd@z Thu Jan 1 00:00:00 1970 Message-ID: <4443ED69.5040904@gmail.com> Date: Mon, 17 Apr 2006 21:32:57 +0200 From: =?ISO-8859-1?Q?Llu=EDs_Batlle_i_Rossell?= User-Agent: Mozilla Thunderbird 1.0.7 (X11/20060314) MIME-Version: 1.0 To: 9fans Mailing list <9fans@cse.psu.edu> Content-Type: multipart/signed; protocol="application/x-pkcs7-signature"; micalg=sha1; boundary="------------ms000302020204080107010008" Subject: [9fans] Vmware playground but in qemu. Topicbox-Message-UUID: 3859f1de-ead1-11e9-9d60-3106f5b1d025 This is a cryptographically signed message in MIME format. --------------ms000302020204080107010008 Content-Type: multipart/mixed; boundary="------------050708020208080900080904" This is a multi-part message in MIME format. --------------050708020208080900080904 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Hi, I'm using qemu for the vmware playground described in the wiki (http://cm.bell-labs.com/wiki/plan9/vmware_playground_for_plan9/index.html). Although I found some flaws in the wiki page (aux/timesync _-n_ , for instance, or ip/dhcpd ip/tftpd in the same line), I think I got the 9pccpuf kernel running fine - I explain here some of the problems I had. I had to change the ether2000.c file for the pxeload loader in order to get a working pxe boot (qemu has a pnp or pci ne2000). I attach the new ether2000.c file for /sys/src/boot/pc/ether2000.c. I simply took the 9 kernel's ether2000.c, corrected the locations of the include files, removed the 'static' of ne2000reset(), and removed the function ether2000link() (if I recall everything). I really got surprised when the new 9pxeload worked. In order to get the "9pccpu" kernel in a second host working, I had to use a qemu floppy image together with the zero-filled small hd. I manually created an msdos filesystem there, with a file "plan9.nvr" (thanks 20h@#9fans) with silly data on it (using mkfs.msdos in Linux). If I didn't have that floppy, and only had a hard disk WITHOUT a plan9 partition/nvram part, the 9pccpu kernel hanged after asking for the root. After getting the first boot done, I partitioned the hard disk, prepared the nvram part, and took off the "floppy" on the next boot. Although the author says the HD vmware file could be 1KiB long, I needed at least 512KiB long, because that's the size of a cylinder according to disk/fdisk (and less than that is not allowed as I experienced). Among my many unsuccesful tries to get everything done as described in the wiki, it was dark for me the "Set up the nvram", because I thought I should write the lines suggested into the nvram partition. And I also expected that to work, so the rebooting's "error in nvram key" made me mad. There are other details that I didn't understood at first from the wiki page, but it would be too a matter of opinion. As an example: what's "First boot"? Should I reboot? As 'bootes'? So, here you have comments from a 'newbie'. I hope they help in some sense. Thanks! --------------050708020208080900080904 Content-Type: text/plain; name="ether2000.c" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="ether2000.c" #include "u.h" #include "lib.h" #include "mem.h" #include "dat.h" #include "fns.h" #include "io.h" #include "error.h" #include "etherif.h" #include "ether8390.h" /* * Driver written for the 'Notebook Computer Ethernet LAN Adapter', * a plug-in to the bus-slot on the rear of the Gateway NOMAD 425DXL * laptop. The manual says NE2000 compatible. * The interface appears to be pretty well described in the National * Semiconductor Local Area Network Databook (1992) as one of the * AT evaluation cards. * * The NE2000 is really just a DP8390[12] plus a data port * and a reset port. */ enum { Data = 0x10, /* offset from I/O base of data port */ Reset = 0x1F, /* offset from I/O base of reset port */ }; typedef struct Ctlr Ctlr; typedef struct Ctlr { Pcidev* pcidev; Ctlr* next; int active; } Ctlr; static Ctlr* ctlrhead; static Ctlr* ctlrtail; static struct { char* name; int id; } ne2000pci[] = { { "Realtek 8029", (0x8029<<16)|0x10EC, }, { "Winbond 89C940", (0x0940<<16)|0x1050, }, { nil }, }; static Ctlr* ne2000match(Ether* edev, int id) { int port; Pcidev *p; Ctlr *ctlr; /* * Any adapter matches if no edev->port is supplied, * otherwise the ports must match. */ for(ctlr = ctlrhead; ctlr != nil; ctlr = ctlr->next){ if(ctlr->active) continue; p = ctlr->pcidev; if(((p->did<<16)|p->vid) != id) continue; port = p->mem[0].bar & ~0x01; if(edev->port != 0 && edev->port != port) continue; /* * It suffices to fill these in, * the rest is gleaned from the card. */ edev->port = port; edev->irq = p->intl; ctlr->active = 1; return ctlr; } return nil; } static void ne2000pnp(Ether* edev) { int i, id; Pcidev *p; Ctlr *ctlr; /* * Make a list of all ethernet controllers * if not already done. */ if(ctlrhead == nil){ p = nil; while(p = pcimatch(p, 0, 0)){ if(p->ccrb != 0x02 || p->ccru != 0) continue; ctlr = malloc(sizeof(Ctlr)); ctlr->pcidev = p; if(ctlrhead != nil) ctlrtail->next = ctlr; else ctlrhead = ctlr; ctlrtail = ctlr; } } /* * Is it a card with an unrecognised vid+did? * Normally a search is made through all the found controllers * for one which matches any of the known vid+did pairs. * If a vid+did pair is specified a search is made for that * specific controller only. */ id = 0; for(i = 0; i < edev->nopt; i++){ if(cistrncmp(edev->opt[i], "id=", 3) == 0) id = strtol(&edev->opt[i][3], nil, 0); } if(id != 0) ne2000match(edev, id); else for(i = 0; ne2000pci[i].name; i++){ if(ne2000match(edev, ne2000pci[i].id) != nil) break; } } int ne2000reset(Ether* edev) { static int first; ushort buf[16]; ulong port; Dp8390 *dp8390; int i; uchar ea[Eaddrlen]; if(edev->port == 0) ne2000pnp(edev); /* * Set up the software configuration. * Use defaults for irq, mem and size * if not specified. * Must have a port, no more default. */ if(edev->port == 0) return -1; if(edev->irq == 0) edev->irq = 2; if(edev->mem == 0) edev->mem = 0x4000; if(edev->size == 0) edev->size = 16*1024; port = edev->port; if(ioalloc(edev->port, 0x20, 0, "ne2000") < 0) return -1; edev->ctlr = malloc(sizeof(Dp8390)); dp8390 = edev->ctlr; dp8390->width = 2; dp8390->ram = 0; dp8390->port = port; dp8390->data = port+Data; dp8390->tstart = HOWMANY(edev->mem, Dp8390BufSz); dp8390->pstart = dp8390->tstart + HOWMANY(sizeof(Etherpkt), Dp8390BufSz); dp8390->pstop = dp8390->tstart + HOWMANY(edev->size, Dp8390BufSz); dp8390->dummyrr = 1; for(i = 0; i < edev->nopt; i++){ if(strcmp(edev->opt[i], "nodummyrr")) continue; dp8390->dummyrr = 0; break; } /* * Reset the board. This is done by doing a read * followed by a write to the Reset address. */ buf[0] = inb(port+Reset); delay(2); outb(port+Reset, buf[0]); delay(2); /* * Init the (possible) chip, then use the (possible) * chip to read the (possible) PROM for ethernet address * and a marker byte. * Could just look at the DP8390 command register after * initialisation has been tried, but that wouldn't be * enough, there are other ethernet boards which could * match. */ dp8390reset(edev); memset(buf, 0, sizeof(buf)); dp8390read(dp8390, buf, 0, sizeof(buf)); if((buf[0x0E] & 0xFF) != 0x57 || (buf[0x0F] & 0xFF) != 0x57){ iofree(edev->port); free(edev->ctlr); return -1; } /* * Stupid machine. Shorts were asked for, * shorts were delivered, although the PROM is a byte array. * Set the ethernet address. */ memset(ea, 0, Eaddrlen); if(memcmp(ea, edev->ea, Eaddrlen) == 0){ for(i = 0; i < sizeof(edev->ea); i++) edev->ea[i] = buf[i]; } dp8390setea(edev); return 0; } --------------050708020208080900080904-- --------------ms000302020204080107010008 Content-Type: application/x-pkcs7-signature; name="smime.p7s" Content-Transfer-Encoding: base64 Content-Disposition: attachment; filename="smime.p7s" Content-Description: S/MIME Cryptographic Signature MIAGCSqGSIb3DQEHAqCAMIACAQExCzAJBgUrDgMCGgUAMIAGCSqGSIb3DQEHAQAAoIIJTTCC AwEwggJqoAMCAQICEC7GHhAgrXIK4gbYgnLRBvIwDQYJKoZIhvcNAQEEBQAwYjELMAkGA1UE BhMCWkExJTAjBgNVBAoTHFRoYXd0ZSBDb25zdWx0aW5nIChQdHkpIEx0ZC4xLDAqBgNVBAMT I1RoYXd0ZSBQZXJzb25hbCBGcmVlbWFpbCBJc3N1aW5nIENBMB4XDTA2MDMxMzIyNTMwMVoX DTA3MDMxMzIyNTMwMVowRDEfMB0GA1UEAxMWVGhhd3RlIEZyZWVtYWlsIE1lbWJlcjEhMB8G CSqGSIb3DQEJARYSdmlyaWtldG9AZ21haWwuY29tMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8A MIIBCgKCAQEAvULiATyjPs5ZNXAo1qG4p3B136VTuzi82L14U0YTuyUO1lrJNJypHfM1+5d5 0vYJKzzSt/sCLD76X3vO3DxC5cqC2nrchEN+GCKndpE2PM7Sp9eWrHs9IVWCfYxP5M3kLoeb 5XXeRCciHCeY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