星期三, 12月 10, 2003
星期二, 11月 18, 2003
Install en pdf
3.7 Pre-Install Hardware and Operation System Setup
在安裝之前,需要檢查Firmware是否已經設定好了。
3.7.1 Invoking OpenFirmware
一般工作上通常是不需要設定PowerPC的BIOS(也就是OpenFirmware)。PreP和CHRP通常都會包含在OpenFirmware中。但是要讀取這些設定的方法,隨製造商的不同而有不同的方法。
在PowerPC Macintoshes,進入OpenFirmware的方法是在開機時按下Command-Option-O-F。在開機“嗶-”一聲後,OpenFirmware會檢查User是否按下了這些按鍵。決定是否帶出OpenFirmware的Command Prompt。
OpenFirmware的prompt是:
ok
0 >
在舊款的PowerPC,OpenFirmware的default console是serial port,在這種機器上啟動OpenFirmware,只會看到一片黑的螢幕。要用另一台電腦執行Terminal的程式連接到serial port上才行。
OldWorld Beige G3,OF verssion 2.0fl和2.4的OpenFirmware有問題,必須要patch後才能從hard driver開機。
3.7.2 Hardware Issue to Watch Out For
有些User將90MHz的CPU超頻到100MHz來執行,通常這都沒有問題,但是曾有一個案例:User在這種情況下使用了1年都沒有問題,但是在執行gcc compiling時卻當機了。這是因為gcc比其他程式更需要大量記憶體,並且反覆的讀寫,執行,所以對這些硬體設定較為敏感。
Chapter 4
Optaining System Operation Media
4.1 Official Debian GNU/Linux CD-ROM Sets
目前最容易的安裝方式是經由Debian的安裝光碟,可以到Debian的mirror server下載。之後再確定可以由CDROM開機後,所有安裝所需的作業就算完成了。
如果有光碟機但是不支援光碟開機,就要利用floppy,hard driver或net-boot來開機並執行system installer。所有需要用來製造開機作業的工具也都附在CDROM中。Debian network archieve和CD的內容和路徑安排是完全相同的。當開機作業完成後,就可以由光碟機讀取的所有需要的檔案。
如果沒有光碟機,只好將所有軟體download到hard driver裡或floppy中。
4.2 Download Files from Debian Mirrors
Download檔案時,要使用binary mode,不能使用text或automatic mode。最好是建立一個和Mirror Site一樣的目錄結構。這樣要找檔案時比較方便。You shuld start your local directory structure at the level under disks-powerpc,for example:
Current/subarchitechure/image-1.44/flavor/rescue.bin
並不需要download那一層目錄下的所有檔案,之後的說明會列出所需要的部分。只要保持和mirror site相同的目錄結構就可以了。
在下載時,要注意關閉自動解壓縮功能,大部分的機器都會設定這個功能。這會浪費硬碟的空間,也會使安裝的動作無法進行。
4.2.1 Installation Options
安裝時需要下列3類的檔案`:
1. boot的程式(像rescur.bin, linux.bin 和root.bin)
2. boot後,安裝程式設定週邊所需要的程式(像rescue.bin,drivers.tgz)
3. Base system installation files(basedebs.tar)
如果有安裝linux kernel支援的ethernet card。那就只需要開機的檔案就夠了。安裝程式有網路安裝的功能。
如果網路卡是linux kernel不支援的,就需要開機檔案和設定週邊的程式。
如過沒有網路功能,或是只有ppp。那就需要下載上列3類的所有檔案。
如果不確定硬體是什麼樣子,可以從簡單的部分開始,如果在設定網路時失敗,再download其他的部分重新開機。
Base system installation file(basedebs.tar)的大小大約是27M,所以安裝時最好是有CD-ROM或是網路功能,否則就需要download這個檔案(位置在:…/base-images-current/basedebs.tar)。這個檔案包含了linux系統在安裝時所需要的一些基本功能。在有網路功能時,安裝程式會在需要時自行由網路下載。
如果在另一台linux系統上自行build這個檔案,需要安裝debootstrap (apt-get install debootstrap)。命令是:
debootstrap binary-basedebs SUIT=woody VERSION=3.0 \
MIRROR=http://ftp.debian.org/debian ARCHES=”powerpc”
4.2.2 Choose The Right Installation Set
安裝檔(與kernel image)支援很多的晶片/硬體架構,PowerPC的硬體架構有:
'powermac' 大多數Power Macintosh使用這一項,他是2.2版的kernel
'new-powermac' 用在非常新版的Power Macinsh上,使用2.4版的kernel
'apus' Amiga Power-UP系統(APUS)所使用的,kernel是2,2版
'chrp' 是給embedded CHRP computer使用,2.2版kernel
'prep' 是motorola和IBM RS/6000 PReP computer,2.2版的kernel
這些kernel的configuration file附在所屬的目錄下,叫做config.gz
4.2.3 Where to Find Installation Files
各種powerpc的網路安裝位置:
rescue image (rescue.bin) and root image or tarball(root.bin):
.../current/apus/images-1.44/rescue.bin
.../current/apus/images-1.44/root.bin
.../current/chrp/images-1.44/rescue.bin
.../current/chrp/images-1.44/root.bin
.../current/new-powermac/images-2.88/rescue.bin
.../current/new-powermac/images-2.88/root.bin
.../current/powermac/images-2.88/rescue.bin
.../current/powermac/images-2.88/root.bin
.../current/prep/images-2.88/rescue.bin
.../current/prep/images-2.88/root.bin
Linux Kernel Files (linux.bin)
.../current/apus/linux.bin
.../current/chrp/linux.bin
.../current/new-powermac/linux.bin
.../current/powermac/linux.bin
.../current/prep/linux.bin
Driver Files
包含所有在initial-boot階段不需要使用的kernel-module(也就是driver)。download時首先要知道硬體架構(powermac,APUS,,etc),再到對應的目錄去找需要的driver檔。
這些driver 檔在partition好hard driver,安裝好kernel後的安裝過程才會需要。如果有特殊的需要在initial-boot時想要access某些hardware,只有選擇一個已經將所需driver compile進去的kernel image,並且設定好boot parameters(ref: Boot Parameters)。
要注意,所選的driver和所用的kernel image必須要是相同的架構。
driver floppy images
需要經由floppy disk 安裝時,download這些檔案。
.../current/apus/images-1.44/driver-1.bin
.../current/chrp/images-1.44/driver-1.bin
.../current/chrp/images-1.44/driver-2.bin
.../current/new-powermac/images-1.44/diver-1.bin
.../current/new-powermac/images-1.44/driver-2.bin
.../current/new-powermac/images-1.44/driver-3.bin
.../current/new-powermac/images-1.44/driver-4.bin
.../current/new-powermac/images-1.44/driver-5.bin
.../current/powermac/images-1.44/driver-1.bin
.../current/powermac/images-1.44/driver-2.bin
.../current/prep/images-1.44/driver-1.bin
driver floppies archieve
不受floppy disk (size)的限制時,直接download這個檔案
.../current/apus/drivers.tgz
.../current/chrp/drivers.tgz
.../current/new-powermac/drivers.tgz
.../current/powermac/drivers.tgz
.../current/prep/dirvers.tgz
boot-floppy-hfs images和rescue.bin都含有壓縮過的kernel image。boot-floppy-hfs僅是用來開機使用,當kernel已經安裝在hard driver上,rescue.bin可以作為濘一個取得kernel的來源。rescue.bin不能用來開機,另一個kernel image(未壓縮的)linux.bin是才是用來作hardware或CDROM開機使用。當用floppy開機時,使用boot-floppy-hfs,不用linux.bin。
當採用download到hard driver的方式來作
星期一, 11月 17, 2003
YABOOT-FAQ
even been started yet. I'd welcome any and all comments on this document. E-mail them to me at ericpeden@homemail.com.
Thanks for your patronage. ;)
--ebp, 4/22/2000
modified to clarify yaboot's non-support of oldworld hardware
-- Ethan, 6/6/2000
modified the ybin section to document the new ybin 0.17 ofboot which is autoconfiguring. Also corrected the
explanation of the read-only keyword in /etc/yaboot.conf. Updated again to better reflect new features in current
versions of ybin and document ofpath.
-- Ethan, 2000/11/18
In this version, new or modified sections of text are marked by a dark red color.
* What is 'yaboot?'
* Why do I need 'yaboot?'
* What's a bootstrap partition?
* What's Open Firmware?
* Setting Up ybin
* If you're installing to an IDE hard drive
* If you're installing to an external SCSI drive
* If you're installing to a Zip disk
* Setting Up Configuration Files
* Changing the boot-device in Open Firmware
* Okay. I've downloaded it. What do I do now?
* How do I determine the boot path to an external SCSI drive?
* [Credits, far from done, these are basically notes to myself]
What is 'yaboot?'
From BenH's site (http://ppclinux.apple.com/~benh/), "yaboot is an OpenFirmware based bootloader for newworld
machines."
In layman's terms, it's an alternate method of booting into Linux.
NOTE: yaboot will NOT work on oldworld hardware
Why do I need 'yaboot?'
You don't have any other option for booting into Linux if you're using one of the NewWorld Macs (i.e., any colored
Mac) with MacOS 9.0.4 or higher. BootX, another bootloader from BenH, used to boot those machines, but changes made
to the MacOS in 9.0.4 (and possibly the earlier 9.0.x series) broke it completely. It worked in MacOS 9.0 and
earlier, but performance was sporadic and unpredictable. If you're using a NewWorld machine, we highly recommend
you use yaboot. Owners of earlier machines can probably get along just fine with BootX; if you experience odd
problems starting Linux, though, you should consider switching to yaboot (only if you have a newworld machine, if
you have an oldworld machine consider switching to quik).
What's a bootstrap partition?
(Please note: I've taken a few liberties with this explanation, and skipped over a few subtleties. This isn't
exactly what happens, but it should be close enough to satisfy most people. If you'd like more detailed technical
information, you're encouraged to search the various LinuxPPC lists for more information.)
When your Mac first starts up, Open Firmware begins checking your partitions, beginning with the one pointed to by
the environment variable "boot-device," for a blessed folder (in the case of the MacOS, this folder is titled
"System Folder," but the name is irrelevant). It looks inside each blessed folder it finds for a file of type
'tbxi.' Upon finding this file, it checks to ensure that the file is a CHRP script, which is a set of instructions
further directing Open Firmware on how to continue the start process. When you boot into the MacOS, the CHRP script
loaded by OF is the MacOS ROM file, and this file in turn places a copy of the Mac OS ROM into memory. From there,
the startup process you're used to seeing is under way.
In the case of yaboot, instead of loading the MacOS ROM, the CHRP script loads up yaboot and hands off the startup
process to it. Yaboot in turn asks which kernel image you wish to load, and boots into Linux from there.
From this, a reasonable person would assume that, to boot Linux, you'd simply point OF to a yaboot-loading CHRP
script, and this is exactly what we do. We "bless" the folder/partition containing the script, and instruct OF to
boot from that. However, we run into a problem the next time we boot into the MacOS: in all its greedy glory,
unblesses any folder/partition it finds which doesn't contain a valid MacOS, preventing you from booting from it
again. This is obviously undesirable. Several people have created methods for faking out the MacOS and tricking it
into loading yaboot using a "dummy" System Folder. The SuSE distribution does this using dummy Finder and System
files that are sufficiently hacked to trick the MacOS into thinking they're valid (although this doesn't always
work; by some reports it fails as much as 90% of the time). Another method involves ybin, created by Ethan Benson,
which we will get to later. We can avoid the entire "unblessing" process, however, by making the yaboot partition
on a drive a bootstrap partition of type "Apple_Bootstrap." The MacOS won't even try to mount a partition of this
type, and since it never mounts, it never unblesses it.
When you create a bootstrap partition, which you will likely do eventually, please note that it should never be
mounted directly, in either OS. If you're making a bootstrap partition, you're most likely using ybin anyway, and
it will take care of the work for you. We cover setting up ybin[not completed] and creating a partition[not
completed] in further detail elsewhere, so see those sections if you want more information.
What's Open Firmware?
http://developer.apple.com/technotes/tn/tn1044.html
http://developer.apple.com/technotes/tn/tn1061.html
http://developer.apple.com/technotes/tn/tn1062.html
http://developer.apple.com/technotes/tn/tn1167.html
Setting Up ybin
The first bit of advice I can offer for ybin is: don't uncompress it in the MacOS! Move the .gz archive into Linux
first, or download it from there in the first place. The archive contains some symlinks that aren't worth the
effort to recreate. You should also note that these instructions assume you have some method of booting into Linux,
be it from your distribution CD or from some other method you already have working. Installing yaboot shouldn't
break that method, but be forewarned that you may have to spend quite a bit of time fiddling to get things back the
way they were if something goes wrong here.
You'll first need to determine where you want to store your kernel images, as you'll need to pass this information
onto ybin and yaboot before you actually use them. yaboot, particularly in conjuction with ybin, offers you amazing
flexibity in where you store your kernel images. They can be kept on anypartition: ext2, HFS, or even HFS+. A
common misconception is that to use any kernel images downloaded in the MacOS, you have to first move them to an
HFS "exchange" partition. With yaboot, this is completely untrue. You can keep them, quite literally, anywhere.
The first bit of "down-and-dirty" work you'll have to do is actually partitioning your drive, if you haven't done
so already. Check out "How do I partition my drive?" for detailed information.
Once that's done, you'll need to determine the Open Firmware path to your boot device. You'll need to have a
bootstrap partition to do this (see "What's a bootstrap partition?" for pointers; I'll be adding actual
instructions soon). This bootstrap partition can be on any drive, but the steps for finding the OF path will vary
depending on what type of drive it is. If you'll be re-partitioning your internal hard drive anyway, the absolute
easiest thing to do is to make the first partition on that drive the bootstrap. See the section on drive
partitioning for details.
If you're installing to an IDE hard drive
If the bootstrap is on your Mac's internal hard drive, the device path is "hd:". Make a note of this and continue
to "Setting Up Configuration Files".
If you have another drive connected to your Mac's second IDE bus, then use "ultra1:" as your device path. If you're
using a slave drive on one of the IDE busses, then you'll have to display the path of hd and change the last bit
from "disk@0" to "disk@1." I'll have more detailed instructions on this later on.
If you're installing to an external SCSI drive
The simplest way to find the OpenFirmware device path to a given disk is to use the ofpath utility (included in
current ybin distributions) example: ofpath /dev/sda or to find the path to a partition: ofpath /dev/sda2
If you're installing to a Zip disk
The path is "zip:". Make note of it. You may proceed.
Setting Up Configuration Files
Download the ybin archive ("Where do I get ybin?"). In Linux, copy the .gz file to any directory. cd to that
directory, and type "tar -zxvpf ybin-0.30.tar.gz" This will uncompress and untar the archive. Now, cd to ybin-0.30,
and type "make install" This will install ybin and yaboot into their proper locations. You should receive a message
saying:
installation successful.
The ofboot script included with ybin 0.17 and later is automatically configured by ybin based on options in
/etc/yaboot.conf. It is capable of presenting a dual or tri-boot menu. To enable dual booting of GNU/Linux and
MacOS add "macos=hd:10" to /etc/yaboot.conf where "hd:10" is the OF path to a MacOS boot partition. If you want to
boot MacOSX you can also add a "macosx=hd:11" line. You can also use the unix device node for these options and
ybin will automatically find the OpenFirmware device path, example: "/dev/hda10". The default OS that is booted is
controlled by the "defaultos=" option, the default is GNU/Linux.
IMPORTANT: You should never edit this new ofboot script.
Now you're ready to edit yaboot.conf. Open /etc/yaboot.conf in your editor. Information on all the possible fields
in this file is available in the man page for yaboot.conf. The first part of the default yaboot.conf file looks
like this:
boot=unconfigured
device=hd:
delay=10
timeout=20
install=/usr/local/lib/yaboot/yaboot
magicboot=/usr/local/lib/yaboot/ofboot
## Comment out if you have a newworld compatible nvsetenv (ybin can ## likely detect the incompatible version) when
commented out ybin ## will update the boot-device variable in OpenFirmware to the ## bootstrap partition. nonvram
Begin by changing the boot line to the Linux-style path to your bootstrap partition, such as "/dev/hda2" or
"/dev/sda9". Set device to the OF device-path to the drive where your kernel images are stored, followed by a
trailing ":". Don't add the partition number. install refers to the bootloader ybin will install, and magicboot
refers to the CHRP script; you can leave these at their defaults (inquiring users will want to look at the man
pages for more information). delay is the time in seconds ofboot will wait for you to choose an OS when the dual
boot menu is enabled. timeout is the time, in tenths of a second, before yaboot boots the default kernel image
(you'll set the default shortly). Comment out or delete the nonvram line if you have a up to date system, this will
allow ybin to automatically update the OpenFirmware boot-device variable to boot the bootstrap partition ensuring
you don't have to enter OpenFirmware and boot the system manually. Below the "header" information, you see an entry
that looks like this:
image=/vmlinux
label=Linux
root=/dev/hda3
read-only
partition=3
image is the location of the kernel image; if you're keeping them in /boot and making symlinks, this will be
"/boot/vmlinux". root is the Linux-style path to your root partition. read-only causes the root filesystem to be
mounted read-only to allow for fsck to run, and partition refers to the partition number the image is on; you can
usually set this to the digit in your root path. label is a name that you can assign to this particular kernel
configuration; make sure each config has a unique name!
Once you've set those options, go back up to the top of the file and add a line:
default = label
Change label to the label you assigned to your kernel configuration, change timeout to whatever length of time you
prefer (remember, it's measured in tenths of a second). Save and close yaboot.conf, and you're just about ready to
go. First, though, you have to create an HFS filesystem on the bootstrap partition. Ethan has included a utility to
do this for you. Please note that this will format the bootstrap partition, so if you have any useful information
on it, be sure to move it elsewhere before you have mkofboot prepare that partition. Run "mkofboot -v," and you
should be asked if you want to create an HFS filesystem on whatever device you indicated was your bootstrap
partition. Respond "y," and mkofboot should output something like the following:
mkofboot: Finding OpenFirmware device path to `/dev/hda2'...
mkofboot: Creating HFS filesystem on /dev/hda2...
mkofboot: Checking /dev/hda2 for valid HFS filesystem...
mkofboot: Copying /usr/local/lib/yaboot/yaboot to /dev/hda2...
mkofboot: Copying /etc/yaboot.conf to /dev/hda2...
mkofboot: Installing first stage bootstrap: ofboot...
mkofboot: Setting attributes on yaboot...
mkofboot: Setting attributes on yaboot.conf...
mkofboot: Setting attributes on ofboot...
mkofboot: Blessing /dev/hda2...
mkofboot: Cleaning up...
mkofboot: Updating OpenFirmware boot-device variable in nvram...
Of course, your partition numbers will be different, but you get the idea. If mkofboot executes with no errors,
you're almost ready to go! If you're on a G4, iMacDV, or Pismo laptop, you can restart while holding down the
option key, and you should be presented with two buttons: one for the MacOS, and one for Linux. Click the Linux
button, then the arrow, and you should boot into yaboot and from there into Linux. Ybin will update the boot-device
OpenFirmware variable automatically so you should boot right into yaboot without any extra effort.
Changing the boot-device in Open Firmware
(Remember, you can skip this section if you've re-partitioned your internal drive and made the first partition the
bootstrap. If this describes the steps you've taken, restart as usual, and your boot script should kick in; if it
does, you can skip this step.) You can also skip this step if you removed the nonvram line from /etc/yaboot.conf
and ybin did not complain about being unable to update OpenFirmware.
Important! Open Firmware can be pretty intimidating. If you follow these instructions carefully, you shouldn't have
any problems. However, if at any time you find yourself totally unable to boot into the MacOS, simply restart while
holding down command-option-O-F, and at the "0 >" prompt type "boot hd:X,\\:tbxi". X should be the partition number
of your MacOS partition (if you haven't re-partitioned your internal drive, you can leave the X off entirely). This
should take you back into the MacOS, where you can re-select your startup drive in the Startup Disk control panel,
and then have another go at it. It might also be a good idea to have a startup CD for your Mac handy, although you
probably won't need it if you use the "boot hd:X,\\:tbxi" command. You can also use the OF command "set-defaults"
to restore anything you may have changed back to their defaults. Use this if things really seem screwed up.
Reboot into Open Firmware (restart while holding down command-option-O-F). At the "0 >" prompt type:
setenv boot-device path-to-bootstrap-device:X,\\:tbxi
Replace path-to-bootstrap-device with, well, the OF path to your bootstrap device (determined earlier) and replace
X with the bootstrap partition number. Press return, and then type "boot". If your ofboot.b file was configured to
launch yaboot by default, you should be in yaboot. If you set the MacOS as the default, you should be in the MacOS.
Restart again and hold down the spacebar; you should switch into whichever OS you haven't already been in.
Congratulations. ;)
If, on the other hand, things don't seem to work quite right, try typing this at the OF prompt:
boot
path-to-bootstrap-device:X,\\yaboot
If yaboot.conf isn't configured properly, this should generate an OF error message that may be useful in tracking
down the error. If you're e-mailing me or one of the lists for assistance with your setup, please include this
error if at all possible; it makes it much easier for us to narrow down were the problem most likely is.
Why doesn't yaboot seem to use the changes I made to yaboot.conf?
You'll need to re-run ybin whenever you make changes to your configuration files. ybin will copy them to your
bootstrap partition and make other necessary modifications for them to be used by yaboot.
Okay. I've downloaded it. What do I do now?
*** I've removed this section. The ybin section has virtually all the information that used to be contained here.
If anyway wants instructions on yaboot alone back, please let me know.
ericpeden@homemail.com ***
How do I partition my drive?
This is probably the most vital part of setting up Linux on your system. However, since you're messing around with
some very powerful software, it can also be the most dangerous if you're careful. Before you begin partitioning,
make sure you have a backup of anything you can't stand to lose. If you don't, and something goes awry, you'll be
very, very angry at yourself; don't say I didn't warn you. ;)
[still not completed, but being worked on] For a basic tutorial on partitioning the hard disk using mac-fdisk (aka
pdisk) see mac-fdisk-basics
How do I determine the boot path to an external SCSI drive?
This section is obsolete, use the included ofpath utility find the OpenFirmware device path instead, its easier and
more reliable.
This is similar to setting up yaboot to use a non-adapted drive, except it takes a few more steps to determine the
boot device. (special thanks go to Joe M. for his excellent post dealing with this issue, on which these
instructions are heavily based )
1. Identify SCSI card name
First, open up the Apple System Profiler (probably on your Apple Menu, unless you moved it) and switch to the
"Devices and Volumes" tab. Find your SCSI card in the list, and click the exposure triangle to display detailed
information for it. You're interested in the "Card name" field. Make note of the name displayed there (I suggest
writing it down; you won't be able to access it in a text file or anything in Open Firmware, which you're about to
get into). It should be something cryptic looking like "ADPT,2930CU." (Note: That's the name of my card; yours may
vary.) You can skip this step if you've got a pretty good idea of what device name you'll be looking for in the
next step, but don't come cryin' to me when you waste several restarts switching back and forth to look the name
up.
2. Determine Open Firmware device path
Restart your Mac, and hold down command-option-O-F. You should switch into the white, tiny-text-filled Open
Firmware screen (why it isn't a lower resolution, I'll probably never know). Type in "dev / ls", sans the quotes
but with the spaces on both sides of the '/,' and it should pop out an oppressive looking screen of information.
This is an ASCII "graphical" representation of all the hardware on your system. We're only interested in the
device that matches the card name you wrote above. Mine looks something like:
/pci@f2000000 ... /pci-bridge@d ... /ADPT,2930CU@2 /disk
/tape
where the elipses denote a bunch of other junk in between. Notice that, with the exception of an "@2" tacked on at
the end, we see the card name we wrote down earlier. This is the device we're looking for. Write down the path,
ignoring the levels after the card name (in this case we'd write down "/pci@f2000000/pci-bridge@d/ADPT,2930CU@2/";
of course, your system will probably be a little different). You'll now add a bit more information to your boot
path, and then create an alias for this device so you don't have to do so much typing later on (this is a common
and valuable technique in the Linux world, btw ;-).
3. Determine SCSI ID and HFS partition
There's just one last piece of information you need to determine the fully-qualified device path to your Linux
boot device (actually, two small pieces, but we'll pretend they go as a unit): the SCSI ID, and the partition ID
of the MacOS (HFS) partition that yaboot and the kernel images are stored on. The first one is usually pretty easy
to get (just check the back of your drive; there's usually a dial or switchable-number back there; that's your
SCSI ID), but the second requires a little more work. If you don't remember the partition number from when you
first partioned your drive (you have already partitioned it, haven't you?) then you'll have to boot back into the
MacOS - using either "boot" or "reset-all" - and launch pdisk and examine the partition map for your drive. If you
need help obtaining or using pdisk, please see "How do I use pdisk? [not completed]" for a mini-primer on the
venerable disk partitioning utility. You'll add the SCSI ID to the very end of the device-path you wrote down in
step 2, in this format:
[device-path]/@id
So if, to continue the example above, my HFS partition is on SCSI device 6, so the complete device-path would be:
/pci@f2000000/pci-bridge@d/ADPT,2930CU@2/@6
4. Adding a devalias
Now, when you're setting up yaboot.conf and ofboot.b, you have to type this path a lot, and who in their right
mind would want to type this monster out over and over? Fortunately, Open Firmware lets you create your own
aliases; unfortunately, it acts a little flaky with them sometimes. If these work for you the first time, then
great! If they don't, restart and try 'em again.
Still in Open Firmware, type:
setenv use-nvramrc? true
followed by a return, and then:
nvalias sd
[device-path]
This assigns a new alias, sd, to the device path you determined above. Now, when setting up yaboot and ybin, when
I refer to your device path, I'm talking about "sd".
[Credits, far from done, these are basically notes to myself]
Ethan Benson (erbenson@alaska.net)
Joe Mastroianni (joe@adaptive silicon.com)
Nelson Abramson (pogtal@erols.com)
Clay (clay@bellaire.org)
Florin Oprina (oprina@student.uit.no)
Chas Williams (chas@cmf.nrl.navy.mil)
Andy (lordpixel@mac.com)
Mike McCallum (mccallum@uop.edu)
Federico Heinz (Federico_Heinz@yahoo.com)
Gaby Levinson (glevinso@cs.jhu.edu)
and the many other people, who for one reason or another, have not been mentioned. You know who you are. ;)
I'd like to close by thanking God for putting me here and bringing to where I am today. Without Him, we are
nothing.
YABOOT
Yaboot
First of all, ofboot.b _is_ necessary for booting and it has
to have the proper type/creator code. It is a (text) file
containing an open firmware script. It is this file that tells
OpenFirmware to load yaboot for the boot process to continue.
I'm unfortunately still not able to create a bootable CD and I
don't know why.
Here is what I am using (and I would appreciate any help other
people can give) to create the cd:
mkisofs -hfs -map src/hfs.map -part -hfs-bless ./ppc/ -r -o cd.iso ./ppc/
The hfs.map is taken from the debian-cd project. The ppc
directory is the contents of the cd and here is what it looks
like:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
dumont:/tmp> ls -lAF ppc/
total 5100
-rw-rw-r-- 1 rbrito rbrito 3573285 Apr 20 21:11 linux.bin
-rw-r--r-- 1 rbrito rbrito 219 Apr 20 21:14 ofboot.b
-rw-rw-r-- 1 rbrito rbrito 1474560 Apr 20 21:11 root.bin
-rw-rw-r-- 1 rbrito rbrito 150020 Apr 20 21:13 yaboot
-rw-rw-r-- 1 rbrito rbrito 235 Apr 20 21:15 yaboot.conf
dumont:/tmp>
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
All binary files were taken from the current boot-floppies, to
make my proof-of-concept CD. The only files that I changed
were ofboot.b and yaboot.conf:
ofboot.b:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
MacRISC
Rescue CD, based on Debian's debian-cd
" screen" output
load-base release-load-area
boot cd:,\yaboot
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
yaboot.conf:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
## This yaboot.conf is for CD booting only, do not use as reference.
# It is important not to have a comma after cd:
device=cd:
default=install
timeout=100
image=/linux.bin
label=linux
initrd=/root.bin
initrd-size=8192
read-only
Making Mac Bootable CD
this is pretty easy with current mkisofs (the one that ships in debian
woody is fine).
here is what you do:
1: create your CD hierarchy, at say ~/cd-master
2: create a boot directory; mkdir ~/cd-master/boot
3: create a boot/ofboot.b;
cat /usr/share/doc/yaboot/examples/simpleboot.chrp | \
sed -e 's/hd:2/cd:/' > ~/cd-master/boot/ofboot.b
(note if you don't use debian this path will be
/path/to/yabootsource/doc/examples/simpleboot.chrp)
4: copy yaboot binary; cp /usr/lib/yaboot/yaboot ~/cd-master/boot
5: create a `maps' file for mkisofs;
cat < ~/maps
# EXTN XLate CREATOR TYPE Comment
.b Raw 'UNIX' 'tbxi' "bootstrap"
yaboot Raw 'UNIX' 'boot' "bootstrap"
linux Raw 'UNIX' 'boot' "kernel"
vmlinux Raw 'UNIX' 'boot' "kernel"
.conf Raw 'UNIX' 'conf' "bootstrap"
root.bin Raw 'UNIX' 'root' "root_image"
* Raw 'UNIX 'UNIX' "unix"
EOF
6: create ISO; mkisofs -hfs -part -map ~/maps -no-desktop \
-hfs-volid "Yaboot_Boot_CD" -hfs-bless ~/cd-master/boot \
-r -o yaboot-cd.iso ~/cd-master
7: burn .iso to CD; cdrecord -blahblah -data yaboot-cd.iso
note that step 3 is quite important, as is step 5. the sed command
just replaces the hard coded `hd:2' device with `cd:' which is
required for CD booting. the maps file ensures the correct HFS
type/creators are set on the right files. the ofboot.b is required
since some models (notably blue g3) refuse to boot binaries by
default, thus the ofboot.b first stage is necessary.
the resulting ISO will be bootable on all NewWorld powermacs by simply
holding down the C key during boot, you can mount it in *nix as
regular ISO9660.
note that you *must* use a subdirectory in your CD tree, not the root of
the CD tree, mkisofs will ignore your -hfs-bless option if you attempt
to use the root of the cd mastering tree. check the output of mkisofs
for a `Blessing cd-master/boot' message, this is the only indication
of whether it worked, if it can't find the dir or some other error
occurs it just silently ignores that option and your CD won't be
bootable (i consider this a bug).
ah right, i knew i was forgetting something, yes you need to put the
yaboot.conf in the boot directory. it should look something like
this:
device=cd:
image=/boot/vmlinux
with all the rest of the normal stuff, do not specify partition=
you can put kernels wherever you want on the CD, just use a full path.
星期四, 6月 12, 2003
Instakll Linux on iMac
另一個方法是使用OpenFireware的interface:
開機時按下Cmd-Opt-O-F。
出現OpenFirware訊息。
輸入:boot cd:\\yaboot
按下Tab鍵顯示所有安裝方式。
選擇Video Card,iMac用install-atyfb (or install-aty128fb ?)。按Enter。
出現linux安裝畫面,用方向鍵選install method : CDROM driver。
出現Mandrake的DrakX安裝畫面
如果沒有出現,大概是選錯Vedio card。
重新開機,換選另一種Vedio card。
選安裝時和系統的語系。
用Advanced button增加你所要增加安裝的語系。
確認接收License
選Recommand的安裝方式
選擇用按鍵替代3 button mouse的另外兩個按鍵的功能。
選擇要安裝的partition - Erase entire disk
這會將整個harddisk的partition都會被reset。
按下確認
選要安裝的Application
開始安裝
Installer會將CD彈出,提醒你放另一片CD。
決定root的密碼
新增User。完成後按Done。
Mandrake可以使用Single User Login Mode,選No
因為一般會有機會用其他(root)login。
Configuring Network
星期五, 4月 18, 2003
Java的Serial Port Programming
Serial Port的支援並不在JDK的標準中,Sun作了一個implementation(COMMAPI),放在exetention裡,所以在使用Serial Port時,要
import javax.comm.*
首先藉由CommPortIdentifier的一個static method : getPortIdentifier( )取得SerialPort的使用權
CommPortIdentifier.getPortIdentifier( “COM1” );
其中的參數是Serial Port的代表字串,和OS相關,windows系統就是COM1,COM2,Linux系統就是(?)。
接著作open的動作
CommPortIdentifier.getPortIdentifier(“COM1”).open(“AppName”,timeou);
需要傳入自己的application name,作為註冊用,還需要指定不成功時,等候timout的時間,這個function會傳會SerialPort object。之後所有的動作都是以這個object作reference。
SerialPort ComP = CommPortIdentifier.getPortIdentifier(“COM1”).open(“AppName,2000);
設定通訊參數
利用SerialPort的function:setSerialPortParams(1200,
SerialPort.DATABITS_8,
SerialPort.STOPBITS_1,
SerialPort.PARITY_NONE);
ComP.setSetialPortParams(---略---);
Serial Port的IO動作是用Stream的方式。
用SerialPort的getInputStream,getOutputStream取得Receive和Send的Stream Object
InputStream In = ComP.getInputStream( );
OutputStream Out = ComP.getOutputStream ( );
Send:
和Stream的寫入動作一樣
Out.write(outdata,0,7);
Receive:
和Stream的讀取動作一樣
In.Read( );
在程式結束的時候,所有open的port都會被關閉。
和Serial相關的Stream動作:
檢查是否有收到資料
int In.available( )
讀入一個byte
(byte) In.read( )
因為read( )的return type是0~255的int,所以要轉型。
傳送
Out.write(outdata,start,len)
其中byte outdata[ ];
星期二, 4月 08, 2003
手動安裝VB的OCX
用REGSVR32來作….
以MSCOMM32.OCX為例
先copy MSCOMM32.OCX到C:\WINDOWS\SYSTEM\
安裝
C:\WINDOWS\SYSTEM\REGSVR32.EXE C:\WINDOWS\SYSTEM\MSCOMM32.OCX
移除
C:\WINDOWS\SYSTEM\REGSVR32.EXE /u C:\WINDOWS\SYSTEM\MSCOMM32.OCX
Debug Java Source with JSWAT
啟動
jswat的啟動蠻麻煩的,要指定jdk的library path和jswat的path
java -Djava.ext.dirs=
可以寫成batch檔
設定
先要設定ClassPath和SourcePath
Option - Set Classpath
Option - Set Sourcepath
分別把要debug的class的class所在目錄和source code所在目錄加入設定
執行
VM - Start VM的對話窗中加入要debug的class name和argument,確認。
設定Breakpoint
在source code window中的Line Number地方按下,就可以設定斷點。
其他
星期二, 2月 25, 2003
GSM Modem操作
門號:
SIM Card要有接聽Modem傳輸資料的功能,必須要“非同號”數據通訊的功能,這個功能是在申請門號時勾選的,要另外付費。申請了之後SIM Card上就有兩個號碼,一個是Voice Call,一個是Data Call。
Device : Wavecom WMOD2
操作:
使用前要Enter PIN No,目前拿到的是0000
AT+CPIN=0000
OK
LED閃動表示正常
檢查NETWORK SERVICE是否正常
AT+CREG?
+CREG: 0,1
OK
撥號:
申請非同號通訊的SIM卡有兩個號碼,一個是for Voice,一個for Data,要撥for Data那一個
ATD0937404097
等待約15sec,接聽端會出現
RING
接聽電話:
ATA
再等15sec,撥號和接收端都會出現
CONNECT 9600
這樣就完成了接通的動作,可以開始互相傳送資料了
自動接聽:
ATS0=2 響兩聲後接聽。
掛斷:
+++
進入Command Mode,輸入
ATH
就可以掛斷電話
另一端會出現一堆亂碼和
NO CARRIER
一樣要
ATH
掛斷電話
撥號時要注意兩件事
1. 要撥for Data的號碼
2. ATDXXXXXXXXXX後面不可以加‘;’號
03/01/10測試用市話撥GSM Modem無法通訊。
簡訊:
送簡訊
AT+CMGF=1 --先設定以文字模式傳送
AT+CMGS=093xxxxxxx
>--這裡打簡訊,用Ctrl-Z結尾,之間不可以用Enter斷行。(要Enter)
讀簡訊
收到簡訊時,會有command
+CMTI: “SM”,3 收到簡訊,存在SIM Card,的memory 3位置
讀
AT+CMGR=3 讀位置是3的簡訊
讀所有訊息
AT+CMGL=”ALL”
刪訊息
AT+CMGD=1 刪第一筆(record index=1)
傳送中文簡訊
在傳送SMS時,有PDU ( protocol description unit ) Mode和Text Mode可以選,實際上SMS Message都是用PDU Mode來傳送的,Text Mode只是Modem支援的輔助功能,將PDU Mode的內容翻譯成Text,並且將Text轉成PDU協定傳送出去。
PDU協定中,所有character都是用Unicode來傳送的,所以要傳送中文時,要先將中文轉成Unicode。目前Win98的中文是用Big5,需要Big5à Unicode的軟體。
SMS的PDU格式
SMS最多可以有160個character,character的size ( bit no) 可以是:
7bit :一般的ascii code
8bit :通常作為傳送data用(鈴聲,影像,,etc)
16bit :unicode。