DISCLAIMER
This is a memo of my experiment. I don't have any source nor packages here. And nothing is warranted. Do it at your own risk !!
GOAL
To multi-boot JUNOS on IBM T42 notebook.
SOME FACTS
o JUNOS supports em driver
o T42 has an em nic but no com port
o By default, you can only login from com port after JUNOS boots up.
ISSUES
MULTI-BOOT
JUNOS installation will check current partition of the hard disk. It will partition and format entire disk if this is a new installation. This gives me a hint that we can skip the format process and preseve
some space for other OSs.
After digging some codes, the key function is the preserve_partdrive() in /sbin/init. JUNOS has pre-defined partition structure, from partition a to partition f, mounted as /, swap, the disk, /config and /var. preserve_partdrive() checks these four partitions' size. If the partition table complies to some pre-defined criteria, init will keep the partition table in tact.
I set the size of these four partitions as 133120 sectors, 2*mem size, 20480 sectors and 1G, respectively. 133120 sectors and 20480 sectors are defined in /sbin/init as min_rootsize and min_configsize. The rest of the disk space can be used for other OSs.
Also notice that JUNOS always uses the first slice. You should better install JUNOS first.
VIDEO CONSOLE
By default, boot messages will output to com console, which T42 doesn't have.
VIRTUAL TERMINAL
By default, JUNOS has serial and pseudo terminals but virtual terminals. To be able to use virtual terminal is the key point of JUNOS laptop. I'll provide the solution later.
CREATE A SPECIAL VERSION OF JINSTALL
Typical install process is as below:
pkg_add jinstall-XXX.tgz -> reboot -> bootstrap install -> pkg_add packages -> reboot -> boot with JUNOS
Files modified:
jinstall-XXX-domestic-signed.tgz ->
jinstall-XXX-domestic.tgz ->
bootstrap-install-XXX.tar:/boot/loader.conf
jbundle-XXX-domestic.tgz:+INSTALL
BOOTSTRAP INSTALL
In the bootstrap install, the interim kernel, /boot/install, mounts root on a memory disk of a cd9660 iso image, mdimg.gz. In the mdimg.gz is the minimum required collection for JUNOS installation.
Some modifications are needed at this stage,
1. set console to 'vidconsole' in /boot/loader.conf to see the booting process on the screen.
CHANGES BEFORE SECOND REBOOT
After JUNOS installs all its packages, it will reboot the system. The default /etc/ttys doesn't enable virtual terminals. To solve this problem, add the following code to the end of the last if-block in +INSTALL of jbundle-XXX.tgz.
--------- CUT HERE BELOW ------------------------------------------------
echo 'ttyv0 "/usr/libexec/getty Pc" cons25 on secure' >> /etc/ttys
--------- END OF CUT ----------------------------------------------------
PACKAGE VERIFICATION
JUNOS use verify_hash() in each +INSTALL to check the integrity of package, including md5, sha1 and in-house certification. Since we have modified the content of jinstall-XXX, each hash digest should be updated accordingly. However, I don't know how to generate the .sig file, so I choose to skip it, i.e. comment out all sig-related check in each +INSTALL.
RE-PACKAGE
After applying all modification, you should re-package it. Notice that each +CONTENTS should be updated accordingly, especially the @srcdir variable.
繼續閱讀.......