找回密码
 注册
搜索
系统gho:最纯净好用系统下载站投放广告、加入VIP会员,请联系 微信:wuyouceo
查看: 2539|回复: 5

[求助] 如何制作一张Solaris的启动光盘

[复制链接]
发表于 2005-9-14 15:17:32 | 显示全部楼层 |阅读模式
Windows 讨论得多了,但是Linux 和 Unix 讨论得很少,讨论一下经验吧
 楼主| 发表于 2005-9-14 15:19:14 | 显示全部楼层

[求助] 如何制作一张Solaris的启动光盘

我用的办法:
1. Introduction to the Sun CDROM layout
There are 5 slices on the CDROM.
Slice 0 is a hsfs volume which carries the Solaris distribution. This is the exact same form as you would use on an JumpStart server
The size is about 500 MB which are used to 100%
The first 512k Sector carries the VTOC of the whole CDROM.
Slice 1 is a ufs volume which carries a minimal bootable system
The size is 50 MB of which 38 are used.
Slices 2 to 5 are ufs volumes which carry the bootblocks for all SPARC architectures.
s2 is sun4c, s5 is sun4u
The exact layout can be found in the VTOC of the CDROM:
# prtvtoc /dev/dsk/c0t6d0s2
Attention: This command can only be issued when vold is not running! Eject the CDROM, kill vold, reinsert the CDROM!

2. Booting off the CDROM and starting the installation
When issuing the boot cdrom command from the boot promt the system loads its specific bootblock and gets redirected to slice 1 to start loading the kernel. The system comes up into Single User Mode.
Since there is only a minimal /usr on slice 1, the OS mounts a full /usr from slice 0 over the previous minimal /usr.
This can be found in /cdrom/cdrom1/s0/Solaris_2.6/Tools/Boot/usr
The system comes up and starts the shell script /sbin/suninstal. Suninstall does:
Mount the path to the JumpStart directory (profind)
Validate the contents of the JumpStart directory (chkprobe)
Set the application type (jumpstart or interactive)
JumpStart (Custom or Factory) begin script
Save the JumpStart environment variables
Mount the path to the SolStart directory
Validate the contents of the SolStart directory (chkprobe)
SolStart (SunSoft and OEM) begin script
Save the SolStart environment variables
Restore the JumpStart environment variables
Interactive install (installtool/ttinstall)
or
JumpStart (Custom or Factory) profile install (pfinstall/pfupgrade)
Restore the SolStart environment variables
SolStart (SunSoft and OEM) finish script
Restore the JumpStart environment variables
JumpStart (Custom or Factory) finish script
Cleanup
As I understand, there is no difference in doing a JumpStart installation over the net or doing the installation from CD.

3. Altering the CDROM
So far you might ask yourself, what are the difficulties in burning a custom CD.
The problem lies in the VTOC! When booting off CDROM, the boot prom checks the VTOC. This is the ';Table of Contents'; which is located in the first cylinder (512 Bytes) of slice 0. The partition map of the CDROM is specified in the VTOC together with a checksum. Whenever changing the partition layout, the Sun system WILL NOT BOOT OFF THIS CDROM ANYMORE. So far I do not know of any tool to create a new VTOC. Hints for this are very welcome.
A second problem is the ufs format. Slice 1 to 5 MUST be in ufs format. The ufs format is bound to the disk geometry which is different on CD and your harddrive.

3.1 The VTOC
At first we look at the layout of the CDROM. Remember: To print the VTOC, vold MUST NOT be running and the CDROM MUST be unmounted!
# prtvtoc /dev/dsk/c0t6d0s2
* /dev/dsk/c0t6d0s2 partition map
*
* Dimensions:
* 512 bytes/sector
* 640 sectors/track
* 1 tracks/cylinder
* 640 sectors/cylinder
* 2048 cylinders
* 2048 accessible cylinders
*
* Flags:
* 1: unmountable
* 10: read-only
*
* Unallocated space:
* First Sector Last
* Sector Count Sector
* 1088000 3200 1091199
* 1100800 209920 1310719
*
* First Sector Last
* Partition Tag Flags Sector Count Sector Mount Directory 0 4 10 0 984960 984959
1 2 10 984960 103040 1087999
2 0 00 1088000 3200 1091199
3 0 00 1091200 3200 1094399
4 0 00 1094400 3200 1097599
5 0 00 1097600 3200 1100799
#
The size of the partitions can be calculated by multiplying the Count field by 512 eg:
Slice 0: 984960 sectors * 512 bytes / sector = 504299520 Bytes = 481 MB
WE ARE ABSOLUTELY BOUND TO THIS PARTITION MAP! The 110MB of unallocated space CANNOT be used.
Whatever we change, WE MUST STAY IN THE VTOC SPECIFIED RANGE

3.2. Possible Changes
I have two suggestions how to customize the CD. First, a simple and dirty one, mentioned in the ';Summary: How to build a Solaris bootable CDROM'; then a more elaborate one.
3.2.1 A simple, but dirty possibility
Note: Most of this text is copied from the mentioned document. I only changed the procedure accomodated for the 2.6 changes and provided some deeper explanations to the needed steps.
Create a new fs on a partition with ample space. You should reserve at least 1GB for the following steps!

Use dd to grab the first cylinder off the solaris boot cdrom. This
contains a valid disk label and VTOC for the cdrom. Once this is created
our limitation is that we must work within the definitions of this VTOC.
dd if=/dev/dsk/c0t6d0s0 of=cdrom.vtoc bs=512 count=1

Now use dd to grab the UFS slices from 1 to 5
for slice in 1 2 3 4 5
do
dd if=/dev/dsk/c0t6d0s${slice} of=cdrom.s${slice}
done

Mount slice 0 of the CDROM and copy everything to the staging area.
Use GNUtar to copy the files, since there are some special-files
(named Pipes, special files etc.) which won';t get right with cp or the original tar!
Trimm out the parts you don';t need.
NOTE: You NEED EVERYTHING IN /cdrom/cdrom1/s0/Solaris_2.6/Tools/Boot/usr
DO NOT change this path!

Add in all the things you need for your CD. The space is pretty small. If you delete everything but the /usr part, you will gain about 300 MB. -> This is the maximum size that you can use for your files.
For me this meant a shell script that automated the build process, and images of all the data
I wanted to move out. Make sure you do not go beyond the size of the slice
0 on the CDROM you started with. (Check with the info prtvtoc shows.)

Using mkisofs or the tools that came with your CDROM burning package
(HyCD worked well, as well as Gear) turn your staging area into a hsfs
filesystem image, making sure that symbolic links are unmodified. HyCD
required changing a default option that would have modified all the links.

(Possibility one): Patch the slice 1 image (CDROM s1) to start your custom application
rather than the suninstall. This can be done by finding the break point
you wish to use in the file cdrom:/sbin/sysconfig, selecting a unique set
of chars in this file ( I used the string #***** S30sysid.net ) and then
searching via a hex-editor or emacs in bin mode for that string. Then find
a comment line, change the first # and chars after to point to your
script, then add a # line after. For examle I patched my image so the line
#***** S30sysid.net
became
exec build #ysid.net
Then Input a script in my staging area into the /usr/bin dir. (the staging
area will be made into slice 0 which is hsfs)

Using dd, throw away the first block of this image.
dd if=image of=image.data bs=512 skip=1

Get the exact block count of this image.
dd if=image.data of=/dev/null bs=512
(Possibility two): Instead of using a hex-editor on one image, there is a more elaborate way:
Download the content of the CD to a new partition:
dd if=/dev/dsk/c0t6d0s1 of=/dev/rdsk/c0t1d0s1 bs=512
fsck /dev/rdsk/c0t1d0s1
mount /dev/dsk/c0t1d0s1 /s1
vi /s1/sbin/sysconfig
sync; sync; sync; umount /s1
dd if=/dev/rdsk/c0t1d0s1 of=cdrom.s1 bs=512 count=5240
5240 is the number of blocks which dd reported before
Subtract the block count of image.data from the original block count of slice 0 from the Solaris CDROM.
(This is the number which prtvtoc prints out)
If dd from Step 9 reported 803040+0 records you should calculate:
984960 - 803040 = 181920

Subtract 1 from this number. (The 1 accounts for the 1 block where VTOC resides)
181920 - 1 = 181919

Feed this number into dd reading from /dev/zero to build a pad file.
dd if=/dev/zero of=image.pad bs=512 count=181919

Cat all of the image files together with the VTOC and the UFS slices.
cat cdrom.vtoc > cd_image
cat image.data >> cd_image
cat image.pad >> cd_image
cat cdrom.s1 >> cd_image
..
cat cdrom.s5 >> cd_image

Burn this image to the CDROM drive using cdrecord, HyCD, Gear. etc
eg. cdrecord speed=4 dev=0,3,0 cd_image
Additional note: The pad file is needed in order to keep the starting block number of the slices aligned to the number stated in VTOC

3.2.2 A second, more elaborate procedure
Since the available size is limited to about 300 Megs, I have thought about other possibilities. Further I would like to install the OS off the virgin files provided on the CD. I do not want to use an image. Since I want no human interaction, the Sun HW should have two CDROM players. This costs additional 200$ but we have max convenience. Note: It could also be done with somebody changing CD';s inbetween the installation process.
The main problem is changing the /sbin/suninstall file on the CDROM to accomodate my changes. This file lies on slice 1 of the CD. The changes are that severe that they cannot be made using a binary editor and changing a few lines in this file. I am still working on getting the whole procedure to run as I want to. Therefore the noted changes are ideas and NOT tested out yet!!!
change suninstall to load a config file off diskette, use this as config for pfinstall to install the machine.
reboot the machine
start application installation off second CDROM
reboot and finish up
The problem lies in changing the suninstall file. Here is what I did (Analog to the document from Victoria Lau):
Create a partition of about 100MB.

Create a second partition of about 700 MB, newfs this partition and mount it.

follow steps 1 - 3 of 3.2.1
We well need all the slices, so we might as well do the for statements from 0 to 5
The image of the CDROM slices should now reside on the new partition.

dd if=cdrom.s1 of=/dev/rdsk/c0t1d0s5 bs=8k
c0t1d0s5 is the raw device of the 100Mb Partition we created before.
Remember the number of blocks which dd reports

fsck /dev/rdsk/c0t1d0s5

mount /dev/dsk/c0t1d0s5 /mnt/instcdrom

cd /mnt/instcdrom; df -k shows how much space we have left.

change the files to use our custom installation procedure

sync;sync;sync; umount /mnt/instcdrom

mv cdrom.s1 cdrom.s1.orig

dd if=/dev/rdsk/c0t1d0s5 of=cdrom.s1 count=5240
5240 is the number of blocks which dd reported in step 4

cat all the images in one file which you are able to burn. If you did not change anything in slice 0, the VTOC and PAD File are not needed.
cat cdrom.s0 > cd_image
cat cdrom.s1 >> cd_image
..
cat cdrom.s5 >> cd_image

Burn this image to the CDROM drive using cdrecord, HyCD, Gear. etc
eg. cdrecord speed=4 dev=0,3,0 cd_image

4. Testing your CD
Catherine Baley Catherine.Baley@matranortel.com mentioned a neat possibility to test the CD before burning!
Copy the 6 partitions to a disk. (all the partitions can be ufs, even s0)
Then boot on this disk:
ok boot disk1:d (d sun4m)

5. Scripts and other goodies
Eric Negaard has put together some shell scripts, which help with the burning process.
Here you will find :
burnit which basically does the whole thing for you.
extractcd to extract data from an original Solaris CDRom.
sunfdisk.patch a Patch to the Linux fdisk program distributed with the util-linux package (version 2.9r) for creating a "sunfdisk" program that will compile and run on Solaris machines.
The primary use has been to create/modify partition tables from bootable CD-ROMs. (the fdisk/sunfdisk program happily operates on regular files as well as devices).

6. Comments from Readers
Jan Stevens has some other ideas to reach the same goal.
Daniel Solero mentions a tool CDTK which can recreate the slice map, vtoc, etc.
Christoph Stevens submitted a totally different procedure ito burn bootable CD';s This document describes how to create a bootable cd from an existing (running) machine.
Mari Donkers describes a procedure to extend the partition table of a Solaris 2.6 hw 5/98 CD-ROM here

Jürg Schilly, the developer of cdrecord notes:
Paragraph 3 is wrong:

mkisofs does support Sparc bootable CD';s for about a year.
UFS is not bound to the disk geometry. It only uses it as a hint. The FBK driver allows you to create any ufs image you like.
"Out of boredom" Ignatios Souvatzis analyzed the format of bootable CDs a while ago
Results can be found in the "mksunbootcd" program in NetBSD. See /usr/src/distrib/utils/mksunbootcd (accessible via http://cvsweb.netbsd.org/
但是不是每次读好用,实在不知道为什么
回复

使用道具 举报

发表于 2005-9-14 22:49:43 | 显示全部楼层

[求助] 如何制作一张Solaris的启动光盘

看不懂,,,俺的E文好菜
回复

使用道具 举报

发表于 2005-9-15 00:59:50 | 显示全部楼层

[求助] 如何制作一张Solaris的启动光盘

@@
回复

使用道具 举报

发表于 2005-9-17 15:06:34 | 显示全部楼层

[求助] 如何制作一张Solaris的启动光盘

我想把小型的linux和winpe方在一个光盘里。怎么实现啊??
回复

使用道具 举报

发表于 2005-10-5 16:08:22 | 显示全部楼层

[求助] 如何制作一张Solaris的启动光盘

Solaris市场占有率不足1%,重装系统的可能性也不足1%
有什么好讨论的?
相对于Solaris,我更喜欢HP的Unix,Sun的操作系统做得不好。
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

小黑屋|手机版|Archiver|捐助支持|无忧启动 ( 闽ICP备05002490号-1|闽公网安备35020302032614号 )

GMT+8, 2026-4-23 04:30

Powered by Discuz! X5.0

© 2001-2026 Discuz! Team.

快速回复 返回顶部 返回列表