Do It Yourself Distro Constructor Notes
So, you want to create your own distribution that's really close to the default, but you're afraid to ask? Here's some notes Willie Walker took while working on the accessible install. You're mileage may vary, but these might help. I also tried to provide the exact commands I used -- make sure you read the whole command since it might have my username embedded in it.
NOTE: these notes are written assuming you have access to Sun's internal servers. The main reason is for setting up your IPS. At one time, I believe I was able to pull a lot of the stuff from an SXDE DVD, but I didn't try that this time around.
NOTE: If you use JDS CBE and have its executables in your PATH, get them out of there. They wreak havoc on the process below.
Setup a Local IPS
The Image Packaging System (IPS) is the datastore for your distribution. It is what holds all the packages that will be part of your distribution. There are some nice IPS servers available on Sun internal machines.
If you are a work-from-home person like I am, however, your internet connection might be a bit slow. So, what I do is setup an IPS on a local machine and populate it from one of the Sun internal servers. I started with Halton Huo's instructions boiled them down to these steps:
- Build/install the needed packages
sudo ln -s /usr/sfw/include/openssl /usr/include
sudo ln -s /usr/sfw/lib/libssl.so /usr/lib
sudo ln -s /usr/sfw/lib/libcrypto.so /usr/lib
cd
hg clone ssh://anon@hg.opensolaris.org/hg/pkg/gate
cd ~/gate/src
/usr/bin/make
sudo /usr/bin/make install
sudo /usr/bin/make packages
cd ../packages/i386
sudo pkgadd -d . all
- Run your local IPS - check it by going to localhost:1000 on your machine.
sudo /usr/lib/pkg.depotd -d /export/home/\$HOME/my~_repo -p 10000 &
Import the distro to your IPS - requires access to Sun internal servers. You can edit the Makefile if you want, but don't ask me for specifics since I don't have a clue. The macros of interest are WOS_PKGS, NONWOS_PKGS, TEST_PKGS, and REPO. OK, maybe I lied a little bit about not having a clue. You're going to need to modify your WOS_PKGS line to point to a repository where all the .7z files have been uncompressed:
WOS_PKGS=/net/indiana-build.central/export/nightly\builds/\$(BUILDID)/build\\$(BUILDID)/Solaris_11/Product
Now, just issue the command to suck everything off of SWAN. This step takes a very long time. In your browser, keep an eye on localhost:10000 -- it starts get new packages after a while.
cd ~/gate/src/util/distro-import
/usr/bin/make
Create Your Own SUNWslim-utils Package
SUNWslim-utils contains a bunch of stuff that appears on the line CD when you boot it. The 'jack' user, for example, is part of SUNWslim-utils. So, if you want to change something like the 'jack' user or other things that are part of the live CD, it's likely that you'll need to create your own SUNWslim-utils package.
- Get the sources:
cd
hg clone ssh://anon@hg.opensolaris.org/hg/caiman/slim~_source
- Read usr/src/README and follow the instructions:
cd ~/slim~_source/usr/src
more README
- Per the README (hopefully updated by now with my edits :-)) Make sure you install the latest SUNWonbld package and the SUNWzoneint, SUNWwbint, and SUNWldskint packages compatible with your version of Solaris. You can download the SUNWonbld package in a tar/bzip fromat from http://dlc.sun.com/osol/on/downloads/current/SUNWonbld.i386.tar.bz2/. The remaining packages are archived in a datastream format and can be downloaded from the OpenSolaris Download Center. You can pkgadd the datastream packages directly from the site using the following command (you must have root privileges in order to add packages to a system):
pkgadd -d http://dlc.sun.com/osol/install/downloads/current/SUNWwbint.x86.pkg
- Modify things to your heart's content.
- Build it:
cd ~/slim~_source/usr/src
env -i ./nightly developer.sh
This takes about 10 minutes or so on my machine. The build log goes under the ../../log using my developer.sh file, and the SUNWslim-utils package ends up under ../../packages/i386/nightly-nd.
Use solaris.py to Update Your IPS
Cool - so you've created/modified some packages and want to get them onto the ISO. The way you do this is push them up to your IPS and then recreate the ISO.
Pushing things up to your IPS involves using the solaris.py tool from the 'gate' area where you set up your IPS repository (see "Setup a Local IPS" above). The solaris.py tool requires you to set up a directory with some stuff in it and then a meta file pointing to stuff in that directory.
Let's assume I want to update SUNWslim-utils. I first create the directory with stuff in it. In this case, it's just a file containing the name of the package I want to push up to the IPS:
cd ~/gate/src/util/distro-import/
mkdir slim-utils
cat > slim-utils/SUNWslim-utils << EOF
package SUNWslim-utils
import SUNWslim-utils
end package
I then create a meta file pointing to the slim-utils stuff:
cd ~/gate/src/util/distro-import/
cat > slim-utils.list << EOF
include slim-utils/SUNWslim-utils
EOF
Now, I run solaris.py and cross my fingers:
./solaris.py -b 6.6 -d -s http://localhost:10000 -w ~/slim~_source/packages/i386/nightly-nd slim-utils.list
Pay attention to the above. The "-b 6.6" specifies the revision. You just bump it up higher and higher to make sure that version is found. I start with 6.6 because it's two thirds the way to evil. The "/slim_source/packages/i386/nightly-nd" is the directory containing the packages.
Note you can use solaris.py to push any package you want. For example, I used it to push up eSpeak and gnome-speech packages.
As an anal retentive step, I check to make sure the IPS gives me the stuff I just gave it. That is, I want the SUNWslim-utils it gives me to be the one I put up there, not some older one. So, I run these commands (I needed to create a 'jack' user on my machine for this to work):
pkg image-create -F -a test=http://localhost:10000 /tmp/test-image
pkg -R /tmp/test-image install SUNWslim-utils
pkg -R /tmp/test-image list -av SUNWslim-utils
Pay attention to the revision number and such of the thing listed as "installed".
Modify build_dist.lib to Hack the Live CD's /
So, you want to hack more, such as monkey around with stuff under / or /etc on the live CD? SUNWslim-utils is not the place to do that. Instead, you can mess around in the livemedia_processing method in distro_constructor/src/build.lib. For example, I added these lines to livemedia_processing to create /root/.orbitrc:
cat << \ORBITRC~_EOF > $PROTO/root/.orbitrc
ORBIIOPIPv4=1
ORBIIOPUNIX=0
ORBITRC~_EOF
Anywhere you want to muck with /, just use $PROTO/.
Build the Distribution ISO
Hey! You're almost ready. First, you need to get the distro constructor sources:
cd
hg clone ssh://anon@hg.opensolaris.org/hg/caiman/distro~_constructor
Then, customize the distro constructor to your environment:
cd ~/distro~_constructor/src
cat >> mydist.conf << EOF
TEST~_DATA=/export/home/wwalker/distro~_constructor/test~_data
DIST~_PKG~_LIST=$TEST~_DATA/pkgs.txt
DIST~_ADDITIONAL~_MOD=
DIST~_ISO~_SORT=$TEST~_DATA/iso.sort
DIST~_PKG~_SERVER=http://localhost:10000
DIST~_PROTO=/export/home/wwalker/tmp
QUIT~_ON~_PKG~_FAILURES=yes
DIST~_ID=willie
DIST~_ISO=/export/home/wwalker/distro~_constructor/mydist.iso
DIST~_USB=/export/home/wwalker/distro~_constructor/mydist.usb
COMPRESSION~_TYPE=gzip
EOF
If you want a smaller ISO, make COMPRESSION_TYPE=lzma. It will take a lot longer to do than gzip compression, though.
Then, you need to edit /distro_constructor/test_data/pkgs.txt to remove the 'entire' line.
Now...you're ready. Here's the command to create the ISO. You'll run this each time you want to test out changes you've made:
cd ~/distro~_constructor/src
sudo ./build~_dist.bash mydist.conf
This will take a long time (about an hour on my Metropolis Box). The ISO will be placed in the location you specified in DIST_ISO in your mydist.conf file.
Test with VirtualBox
Boot from /export/home/wwalker/distro_constructor/mydist.iso.