顯示具有 JUNOS 標籤的文章。 顯示所有文章
顯示具有 JUNOS 標籤的文章。 顯示所有文章

2007-02-14

How to multi-boot JUNOS on IBM T42[2]

INSTALLATION
INSTALL FreeBSD 4.X FIRST

Partition the disk as mentioned before and install minimum FreeBSD 4.X. Minimum installation
is enough because JunOS will format it later.

PKG_ADD JINSTALL

After boot,

1. cp /boot/boot{0,1,2} to /var/tmp first.

2. pkg_add jinstall-XXX-modified

3. cp /var/tmp/boot{0,1,2} to /boot

4. reboot

This is because jinstall-XXX replaces /boot/boot{0,1,2} with its own version and during next boot,
JunOS on T42 hangs at boot1. This could be hardware support problem on these boot code of JunOS. Luckily, using the original bootX solves the problem. You should be able to see the boot messages on the screen.

JunOS will install all its packages and reboot again automatically.
After boot, congradulatoin, you have a JunOS laptop.

Annoying messages will keep pumping out until you save your first configuration.


FINAL STEP

Each boot, JunOS restores /etc/ttys to default, i.e. we cannot login from terminal. To solve this problem, cut the following code to /etc/rc.custom, which JunOS will execute in /etc/rc.local.
--------- CUT HERE BELOW: /etc/rc.custom -------------------------------------

#!/bin/sh

echo 'ttyv0 "/usr/libexec/getty Pc" cons25 on secure' >> /etc/ttys

echo "Restart INIT....."

kill -HUP 1

--------- END OF CUT --- -----------------------------------------------------


Now everything is done. Enjoy it.


繼續閱讀.......

How to multi-boot JUNOS on IBM T42[1]

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.

繼續閱讀.......