diff options
author | Rod Whitby <rod@whitby.id.au> | 2005-06-10 13:39:40 +0000 |
---|---|---|
committer | Rod Whitby <rod@whitby.id.au> | 2005-06-10 13:39:40 +0000 |
commit | 92f7968e66515def2a26e7c6b28ea5e8bd1c6a1f (patch) | |
tree | 1d3d33a2f01c088f53e499d3ecfbe2b12e539976 /packages | |
parent | b51451ff3b0ed7f1815fcbae13ed78fdd2f8f98b (diff) |
Unslung 4.21-alpha: updated README and NOTES, and fixed /mnt in maintenance mode.
BKrev: 42a9981cbTovfsk_G7RMWJvRnaEJoA
Diffstat (limited to 'packages')
-rw-r--r-- | packages/ftpd-topfield/ftpd-topfield_0.5.1.bb | 0 | ||||
-rw-r--r-- | packages/nslu2-binary-only/unslung-rootfs/NOTES | 429 | ||||
-rw-r--r-- | packages/nslu2-binary-only/unslung-rootfs/README | 266 | ||||
-rw-r--r-- | packages/nslu2-binary-only/unslung-rootfs/linuxrc | 135 |
4 files changed, 830 insertions, 0 deletions
diff --git a/packages/ftpd-topfield/ftpd-topfield_0.5.1.bb b/packages/ftpd-topfield/ftpd-topfield_0.5.1.bb new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/packages/ftpd-topfield/ftpd-topfield_0.5.1.bb diff --git a/packages/nslu2-binary-only/unslung-rootfs/NOTES b/packages/nslu2-binary-only/unslung-rootfs/NOTES index e69de29bb2..9f110f8fe2 100644 --- a/packages/nslu2-binary-only/unslung-rootfs/NOTES +++ b/packages/nslu2-binary-only/unslung-rootfs/NOTES @@ -0,0 +1,429 @@ +UNSLUNG-4.x Family Release Notes + +Unslung is a replacement firmware image for the Linksys NSLU2 which is designed +to allow you to make changes to the root filesystem (including the installation +of downloadable packages) while still providing all the standard product +functionality. + +If, at any time, you have any questions concerning the installation or +operation of Unslung firmware, your first port of call should be the +NSLU2-Linux wiki at: + + http://www.nslu2-linux.org + +Specifically, check the HowTos and the Frequently Asked Questions before +posting to the mailing list or asking a question in the IRC channel +[#nslu2-general @ irc.freenode.net]. + +OK! Now that that's out of the way... + +This file is provided to give general information and usage notes for the +UNSLUNG-4.x firmware. If you are looking for installation instructions, please +stop now and go to the README file. Follow the README instructions WORD for +WORD to keep from turning your NSLU2 into a brick. The information contained +in this file will make more sense if you have already "unslung" your NSLU2. + +-------------------------------------------------------------------------------- + +These "Notes" are divided into four sections: + + 1 - GENERAL INFORMATION + 2 - IPKG PACKAGES + 3 - DIVERSION SCRIPTS + 4 - CHANGELOG + + +GENERAL INFORMATION + +As stated above, Unslung firmware is a replacement firmware image for the +Linksys NSLU2. The Unslung firmware is intended to be used for loading new +packages (giving enhanced or additional functionality) with minimal changes +to the standard user interface and firmware. The differences in the UNSLUNG 4.x +firmware from the standard Linksys 2.3R25 firmware can be found at: + + http://www.nslu2-linux.org/wiki/Unslung/UnslungFeatures + +For more information about the Unslung firmware, including details on how to +build it from source code yourself, look at: + + http://www.nslu2-linux.org/wiki/Unslung + +There are several assumptions made in this Notes. One, you've successfully +unslung your NSLU2, and can verify the basic Linksys functionality (samba +users, groups, and shares setup with the Linksys interface). Two, that you can +get telnet or ssh shell access to your NSLU2 from any computer on the same +network as the NSLU2. Three, that you have read and understand the NSLU2-linux +community rules at: + + http://www.nslu2-linux.org/wiki/Main/HomePage + +If you understand the third assumption, then you also understand that there is +an emphasis on using and developing the NSLU2-Linux wiki. Clarifications and +further documentation is always welcomed on the wiki. + +If you are experienced with the Linux operating system, then you can make +changes directly to the root filesystem - changes which are persistent across +reboot. If you want to get involved, then check the NSLU2-linux wiki at: + + http://www.nslu2-linux.org/wiki/Main/HowToGetInvolved + + +IPKG PACKAGES + +Packages require you to be running Unslung firmware (as you may have already +guessed!) In general, ipkg packages are commonly available software packages +that have been ported to the NSLU2 - giving enhanced or additional +functionality. If you run into problems or have specific question with a +certain package, you should look on the Internet for the general documentation +about the package first. If your problem is specific to the NSLU2 port, then +check for further documentation for the corresponding package on the +NSLU2-Linux wiki at: + + http://www.nslu2-linux.org/wiki/Unslung/Packages + +When you "unsling" an external disk (check the README for instructions), +downloaded packages will be installed onto that external disk. The number of +packages that you can install is only limited by the size of the "data" +partition on the external disk. Note that you *must* *not* install any +packages before you have booted with an external "Unslung" disk. To do so will +almost certainly cause your internal jffs2 flash memory become full, and cause +you to have to reflash your NSLU2. + +Package Installation Details + + 1) Check for network connectivity to the package repository from the NSLU2 + first: "ping ipkg.nslu2-linux.org" + + - If this does not work, then please check the NSLU2 DNS settings in + the web interface (under "Administration", "LAN"). + + 3) Update the list of available packages from new feeds: "ipkg update" + + 4) Check the list of available packages for ones that you want on your + NSLU2: "ipkg list" + + 5) Install the packages: "ipkg install <package-name>" + +Most packages put their startup scripts into /opt/etc/init.d - which the +Unslung firmware automatically runs at boot. Some other packages are run from +the cron or xinetd daemons. + +You can also check the ipkg command arguments simply by typing "ipkg" at the +prompt. + + +DIVERSION SCRIPTS + +Diversion scripts are used to start packages, set variables or function +definitions at the time of the NSLU2 boot. The diversion mechanism allows you +to add to, or even replace the Linksys script functionality. They "divert" the +normal boot scripts to perform the needed action(s) and then can either "return +1" to continue normal factory script progress or "return 0" to abort the +diverted factory script. The diversion of startup scripts is done at the +lowest granularity, so you can just divert the rc.xinetd script and leave all +others unchanged. You are advised to use diversion scripts rather than editing +system files directly (as this will allow you to upgrade the Unslung firmware +in the future without having to make all of your changes again). + + - Note: If you do need to edit the system files directly, you can use the + "resling" script to save and load your modified system files. See + the NSLU2-Linux wiki at: + + http://www.nslu2-linux.org/wiki/Unslung/ReSling + +Diversion scripts go in the /unslung directory (you may have to create that +directory first). Note that after you have unslung to an external disk, then +the diversion scripts will be stored on that external disk (along with the rest +of the root filesystem). This means that recovering from an incorrect +diversion script is as simple as powering off, unplugging the disk, powering +on, hot-plugging the disk (note that the diversion scripts will only run if the +disk is attached at boot), and fix or remove the diversion script. + +You may divert as many or as few scripts as you like. Simply add the name of +the standard rc script into the appropriate /unslung directory and it will be +run. + +For example, I have a script /unslung/rc.local: + +#! /bin/sh +/opt/bin/do_foo +return 1 + +That will run at the beginning of the normal /etc/rc.d/rc.local, and then +the rest of the factory rc.local will be executed. If I do NOT want to run +the factory rc.local, my script would be: + +#!/bin/sh +/opt/bin/do_foo +return 0 + +That is, if the diversion script returns with something other than 0, it will +run the rest of the factory script. + +Note that any variable definitions or function declarations are allowed to +happen before the diversion script is called. This allows you to use the +variables and functions defined by the factory script. + +Also not that telnet is not enabled by default - there is an openssh package +and a dropbear package that either can replace telnet access with secure shell +access. + + - Dropbear package details on NSLU2-Linux wiki at: + + http://www.nslu2-linux.org/wiki/HowTo/UseDropBearForRemoteAccess + +The rationale behind not enabling telnet by default is ensure that an Unslung +NSLU2 has the same network footprint as a stock NSLU2 with Linksys firmware. +That said, if you want to enable telnet on boot, then install the xinetd +package (which enables telnet by default). + + +CHANGELOG + +1.11: + +First public release + +1.12: + +Added a symlink to slingbox for gzip. Added flashfs (as simple utility for +preserving user files across hard disk formats during beta testing). + +1.13: + +Added LD_LIBRARY_PATH to /etc/profile (only works for telnet and ssh access, +not for serial or diversion scripts). + +1.14: + +Added Unslung Doc link to the User Guide page. + +2.3: + +Moved development to OpenEmbedded. + +2.4: + +Updated to the latest ipk binary instead of the simple script. + +2.5: + +Added the real wget (instead of using the busybox version). This is so we can +support .netrc files for commercial packages. + +2.6: + +Fixed the unsling script so it removes conflicting files on an upgrade. + +2.7: + +Began development of the -able variant. + +2.8: + +Added the patch for genesys enclosures. + +2.9: + +Reorganized the various variants into a more consistent scheme. + +2.10: + +Added the ext3flash-on-disk1 functionality. + +2.11: + +Added the README to /opt/doc. + +2.12: + +First public release of 2.x firmware. + +3.1: + +Added jffs2 functionality. + +3.2: + +Incorporated switchbox functionality. + +3.3: + +Added ramdisks for /dev and /var to reduce internal flash writes. + +3.4: + +Replaced flashfs script with new resling script. + +3.5: + +Added code to reinitialize /etc/mtab on boot. + +3.6: + +Mounted /dev and /var jffs2 directories as /dev.state and /var.state so that +they can be used for persistent changes which are used to populate the ramdisks +on the next boot. + +3.7: + +Added "Pluggable Personalities" - now runs diversion scripts from both the +internal jffs2 area and also from an external drive attached at boot time. + +3.8: + +Enabled mounting of external drives earlier in the boot process, so that the +rc, rc.sysinit, and rc.1 scripts can be diverted by external diversion scripts +on an attached drive. + +3.9: + +Moved a number of -able kernel features (such as USB devfs support) into +-standard. + +3.10: + +Added support for unslung-start and unslung-stop diversion scripts, and package +shutdown scripts (K??foo). + +3.11: + +Added NFS kernel support (both client and server, and both V2 and V3 +protocols). + +3.12: + +Added basic maintenance mode support. If /.ramdisk exists in the jffs2 +filesystem, then the jffs2 filesystem is copied into a ramdisk on boot, and run +from there. This allows for updating firmware using the web interface. + +3.13: + +Added recovery mode support. If a viable root filesystem cannot be found, then +switchbox drops into a basic recovery shell, with a telnet daemon running as +192.168.1.77 with no password. This behavior can also be forced with a +/.recovery file in the jffs2 filesystem. + +3.14: + +Added web control of maintenance mode. You have to enable maintenance mode and +reboot before the firmware upgrade page allows you to enter a filename for the +new firmware. + +3.15: + +Added confirmation dialog boxes to the maintenance mode web control. + +3.16: + +First public release of 3.x firmware. + +3.17: + +Fixed syslog issue. Added FP patches. + +3.18: + +Fixed a number of minor issues regarding file permissions. +Added support for unslinging to the data partition. + +4.1: + +Split from 3.x stream to allow parallel development. + +4.2: + +New switchbox implementation with NFS and external USB disk root filesystem support. + +4.3: + +Enabled devfs. + +4.4: + +Changed slingbox program locations to match those of OpenSlug so that +we can use the same switchbox for both. + +4.5: + +Enabled RAID support modules and USB camera support modules. + +4.6: + +Merged unslung-standard and unslung-able, and created the oe feed for +downloadable kernel modules. Updated the unsling script to support +external rootfs. + +4.7: + +Enabled lots of traffic shaping modules. Enabled support for external +disks on sda1, sda2, sdb1 and sdb2. + +4.8: + +Made Unslung *not* create ramdisk for /var and /dev when you've +unslung to an external disk. Fixed nsswitch.conf. Updated the feed +locations. Added /dev/st devices for tape drive support. + +4.9: + +Updated the unslung script to give feedback on the rootfs transfer, +and to preserve an existing upkg database on the target disk. Added +more device nodes to support the new downloadable kernel modules. + +4.10: + +Made Unslung wait until quota checking is complete before running +package startup scripts. Simplified unsling to support disk1 and +disk2 (data partitions) only. + +4.11: + +Removed /tmp ramdisk if unslung to an external disk. Now clears /tmp +and /mnt/backup on each boot. + +4.12: + +Updated to the latest ipkg version. + +4.13: + +Added /dev/sdd and /dev/sde device nodes. +Added support for alternate rootfs under expert user control. + +4.14: + +Added audio support to the kernel. Increased the USB disk startup +wait to 10 seconds, and added the ability to divert rc.bootbin to the +startup scripts. + +4.15: + +Added /dev/dsp and updated the README and NOTES files. + +4.16: + +Added the /sbin/slingover script for migrating packages from the 3.x locations. + +4.17: + +Developer-only release booting straight from jffs2 instead of using switchbox. + +4.18: + +A number of /linuxrc fixes. Removed support for alternate rootfs under expert +user control (expert users can now just edit the /linuxrc in jffs2 directly). + +4.19: + +Removed all trace of switchbox from the firmware. This saves 128Kb of flash, +and about 1MB of RAM. + +4.20: + +First public release of 4.x firmware. + +4.21: + +Upgraded to Linksys firmware V2.3R29, but kept telnetd. +Fixed maintenance mode. diff --git a/packages/nslu2-binary-only/unslung-rootfs/README b/packages/nslu2-binary-only/unslung-rootfs/README index e69de29bb2..c10db14606 100644 --- a/packages/nslu2-binary-only/unslung-rootfs/README +++ b/packages/nslu2-binary-only/unslung-rootfs/README @@ -0,0 +1,266 @@ +UNLUNG-4.x Family Release README INSTALLATION + +You must follow the steps in this README *exactly*. Do not skip any steps, and +do not skip ahead thinking you know what you are doing and don't need to follow +instructions step by step. + +If at any time you have any questions concerning the installation or operation +of Unslung firmware, your first port of call should be the NSLU2-Linux wiki at: + + http://www.nslu2-linux.org + +If you are looking for further Unslung notes - including ipkg usage, diversion +script details, or ChangeLog information, please consult the associated NOTES +file. + +------------------------------------------------------------------------------- + +There are three parts to completing the installation of the Unslung firmware: + + 1 - PRE-INSTALLATION CONSIDERATIONS + 2 - FIRMWARE INSTALLATION DETAILS + 3 - UNSLINGING DETAILS + + +PRE-INSTALLATION CONSIDERATIONS + +1) You *must* test telnet Redboot access first before you flash the Unslung + firmware. Failure to do so will mean you get no sympathy at all if you + can't access Redboot when you need to recover from a bad flash. See + + http://www.nslu2-linux.org/wiki/HowTo/TelnetIntoRedBoot + + - Redboot is the bootloader that runs when the device is first started, + loading things into memory and starting Linux. By testing your + ability to telnet into Redboot, you are ensuring that if you injure + your NSLU2 with a bad flash you should be able to follow the "How + To Recover From A Bad Flash" instructions at + + http://www.nslu2-linux.org/wiki/HowTo/RecoverFromABadFlash + +2) If you want to install any packages, then you must have an external disk. + It is possible to make changes to the root filesystem in the internal + flash storage, but the space is very limited. In fact, just running + "ipkg update" on an NSLU2 which does not have an external disk attached + will most likely render the NSLU2 unusable due to filling up the flash (if + this happens then you will need to follow the recovery instructions in + the previous step). So unless you are an expert, then use an external + disk. + +3) The external disk that you use as the target for package installation must + be (or have previously been) formatted by the NSLU2. It is possible to + upgrade from UNSLUNG 1.x, 2.x and 3.x without reformatting your disk. + The unsling script will not touch anything in /unslung or /opt on your + disk, so make sure all your file modifications are in those directories, + as you were warned in the README file in UNSLUNG 1.x, 2.x and 3.x :-) + +4) If you want to use a flash disk as the target for package installation, + ensure that it is at least 256MB, plugged into port 1, and formatted + via the Linksys web interface. + +5) Please verify that any disks you are going to connect to the NSLU2 are + recognized and working properly *before* updating your firmware (including + any shares and data you had previously stored.) If not, DO NOT CONTINUE. + You may want to check out "How To Troubleshoot A Drive Missing Condition" + at: + + http://www.nslu2-linux.org/wiki/HowTo/TroubleshootADriveMissingCondition + + - The only exception to this, of course, are those enclosures that the + stock firmware does not support, but the Unslung firmware does + support. + +6) If you are upgrading your firmware, you should make a configuration backup + via the Linksys web interface. The configuration backup can be found + under "Administration", "Advanced", and then "Backup." The top section of + that webpage is titled "Config Backup" and "Download" should be used to + save your NSLU2 Users, Groups and Shares setup to a disk file. + + +FIRMWARE INSTALLATION DETAILS + +1) Shutdown the NSLU2, and remove any disks that you may have plugged into the + NSLU2. Power back up the NSLU2. + + - Firmware upgrades must always be performed with *no* hard disks or flash + disks attached. This CANNOT be emphasized enough. Are you sure you + unplugged the disks before powering up? If so, you may continue. + +2) Access the Web interface. Note that you should use the username "admin" and + password "admin" for the web interface at this point (as no disks are + attached, the default username and password is the only way to access the + Management web pages). + + 2-a) If you are installing Unslung 4.x onto an NSLU2 unit with Linksys + standard firmware *or* UNSLUNG 1.x or 2.x, flash unslung-4.x.bin as + you normally would flash new firmware (using the web interface + "Upgrade Firmware" page). + + 2-b) If you are installing Unslung 4.x onto an NSLU2 unit with version 3.x + or verions 4.x already installed, you must put the NSLU2 into + maintenance mode before you can use the web interface to flash a new + version. Just click the "Enter Maintenance Mode" link on the web + interface "Upgrade Firmware" page, wait for the NSLU2 to reboot, and + then flash the new firmware in the normal manner. + + - During firmware flashing, the top LED - Ready/Status - flashes red and + green (approximately 5 minutes, but can be much longer), and you + should receive a Javascript message that indicates that the flash + of the firmware was successful. + + - During flashing, some browsers may hog 100% CPU, and you are advised not + to have other activities going on at the client while flashing. + + - The NSLU2 will reboot after the flashing is complete. + +3) Shutdown the NSLU2 (again), attach disk(s), and power it back up. + +4) Verify your NSLU2 is working normally again at this point in the web + interface. In particular, you should ensure that all your disks are still + recognized as they were before you updated the firmware (including any + shares and data you had previously stored.) If not, DO NOT CONTINUE. + You may want to check out "How To Troubleshoot A Drive Missing Condition" + at: + + http://www.nslu2-linux.org/wiki/HowTo/TroubleshootADriveMissingCondition + + - If you are not "unslinging", you can stop at this point. *HOWEVER!*, + the only reason for not unslinging would be in the case of a re-flash + of the SAME firmware. Even if this is a point firmware upgrade, you + will need to unsling. + + ***** If you do not choose to do the unslinging procedure described below, + DO NOT install packages unless you are SURE you know what you are + doing! "Bricking" your NSLU2 by not unslinging and then running ipkg + is not just a possibility, it is a certainty. + +5) Shutdown the NSLU2 and unplug *ALL* attached disks. + + - You must NOT have any disk plugged into the NSLU2 when you reboot to + perform the next part of installation - the "Unslinging". + + +'UNSLINGING' DETAILS + +"Unslinging" is the process of copying the root filesystem of your NSLU2 onto +an external disk, and configuring that external disk for installation of +packages. Basically it's a script (stored in /sbin/unsling) which copies all +the files from the internal jffs2 filesystem onto the external disk and tells +the internal firmware to load the root filesystem from the external disk when +booting in the future. + +To run the unsling-script you have to be logged in as root (with a telnet +session). + +NOTE: There are two root-passwords. One is saved in a internal file called +/usr/local/passwd (we know this one - it's "uNSLUng" and used when you boot +without a attached harddisk) the other is stored in a external file called +/share/hdd/conf/passwd (we don't know this one - it's used when you boot with a +external harddisk attached). Later in the process you can change both of +them. That means: Everytime you boot WITHOUT a attached harddisk you gain +root-access with the "uNSLUng" password. If you boot WITH an attached harddisk, +you won't have access until you change the file /share/hdd/conf/passwd. + +1) Power up the NSLU2 without any disks connected. + + - This only has to be done when you update the firmware. + + ***** To reiterate, you should not have a disk plugged in at this stage. + If you powered up your NSLU2 with a disk attached, shutdown the + NSLU2, unplug the disks, and power up again. + +2) Enable telnet by going to "http://192.168.1.77/Management/telnet.cgi", and + press the enable button. + + - If you had previously changed the IP address of your NSLU2 from + 192.168.1.77 to something else, then you should use that new IP + address to enable telnet. Again note that you should use the username + "admin" and password "admin" for the web interface at this point (as + no disks are attached, the default username and password is the only + way to access the Management web pages). + + - Make sure you have **** NO DISKS ATTACHED AT THIS TIME **** + + - If you plug a disk in before you complete the telnet connection, then + the NSLU2 will pick up the Linksys password from the disk, and you + will not be able to telnet into it. So don't have any disks attached + at this point. + + - Make sure you have **** NO DISKS ATTACHED AT THIS TIME **** + +3) OK, now that you don't have any disks attached, you can proceed and telnet + into the NSLU2 using the username root and password uNSLUng. + +4) Identify which drive you wish you "unsling", and plug it in. Wait a minute + or two while the disk is mounted. Check the web interface to make sure + that the disk has been recognised by the Linksys software. + + - If the disk has not been previously formatted on the NSLU2, then now is + the time to do that. Make sure that the drive is recognized in the + web interface. + +5) In the telnet session, run "/sbin/unsling disk1" or "/sbin/unsling disk2" + (depending upon whether you want to unsling to a disk connected to the + Disk1 port or the Disk2 port). + + - Once you "unsling" to an external disk on a particular port (Disk 1 or + Disk 2), it is important that you keep that disk continually plugged + into that same port whenever the NSLU2 is turned on. + + ***** Unsling will not change the password on your disk, so if you had + previously changed the password on a disk, then your password will + not be changed. Also note that simply editing the /etc/passwd file + is not enough to permanently change a password. See: + + http://www.nslu2-linux.org/wiki/HowTo/ChangePasswordsFromTheCommandLine + + NOTE: There are two root-passwords. One is saved in a internal + file called /usr/local/passwd (we know this one - it's "uNSLUng" + and used when you boot without a attached harddisk) the other is + stored in a external file called /share/hdd/conf/passwd (we don't + know this one - it's used when you boot with a external harddisk + attached). That means: Everytime you boot WITHOUT a attached harddisk + you gain root-access with the "uNSLUng" password. If you boot + WITH an attached harddisk, you won't have access until you change + the file /share/hdd/conf/passwd. So you should change this file + as soon as you unsling to an external disk, before you exit the + telnet session that you are using to unsling to the disk. + +6) If you wish to migrate your packages from the old Unslung 3.x location in + the /share/hdd/conf (disk1) or /share/flash/conf (disk2) partitions to the + new Unslung 4.x location on the data partition, then run: + "/sbin/slingover disk1" (if your packages were previously on disk1 and you + ran "/sbin/unsling disk1" in step 5) or "/sbin/slingover disk2" (if your + packages were previously on disk2 and you ran "/sbin/unsling disk2" in + step 5). + + - If your packages were not stored in /share/hdd/conf or /share/flash/conf + (e.g. you had previously moved your packages from the conf partition + to the data partition), then all bets are off and you will need to + read the /sbin/slingover script and perform the appropriate steps + manually. + +7) Reboot. + + ***** DO NOT RUN ipkg BEFORE YOU REBOOT AND CONFIRM EXTERNAL ROOTFS ***** + + - If you were to run ipkg when the root filesystem is loaded from the + internal jffs2 filesystem, then you would fill the flash and cause + your NSLU2 to no longer boot and require reflashing to recover. + +8) Wait for the NSLU2 to boot, telnet in, and confirm that the root filesystem + is being loaded from the external disk. + +***** Congratulations, you're now Unslung! ***** + +Make sure you add an entry to the "The UNSLUNG 4.x" table in the Yahoo group. +Just use the next free integer for your Unslung number. + +If you make no further changes, your NSLU2 will continue to operate normally. +But to customize things, you'll be downloading packages and adding stuff to the +/unslung directory using diversion scripts. + +Read the NOTES file to expand the capabilities of your uNSLUng NSLU2! + +Enjoy! + diff --git a/packages/nslu2-binary-only/unslung-rootfs/linuxrc b/packages/nslu2-binary-only/unslung-rootfs/linuxrc index e69de29bb2..b512a286a6 100644 --- a/packages/nslu2-binary-only/unslung-rootfs/linuxrc +++ b/packages/nslu2-binary-only/unslung-rootfs/linuxrc @@ -0,0 +1,135 @@ +#!/bin/sh + +# **** DO NOT EVEN THINK OF EDITING OR REMOVING THIS FILE **** +# **** UNLESS YOU REALLY KNOW *EXACTLY* WHAT YOU ARE DOING. **** + + +# Determine the desired rootfs based on user flag files. + +if [ -f /.ramdisk ] ; then + /bin/echo "Preferred root device is /dev/ram0 (maintenence)" + mounted=/mnt + prefroot=maintenence +elif [ -f /.sda1root ] ; then + /bin/echo "Preferred root device is /dev/sda1 (disk 1)" + mounted=/mnt + prefroot=sda1 +elif [ -f /.sda2root ] ; then + /bin/echo "Preferred root device is /dev/sda2 (disk 1)" + mounted=/mnt + prefroot=sda2 +elif [ -f /.sdb1root ] ; then + /bin/echo "Preferred root device is /dev/sdb1 (disk 2)" + mounted=/mnt + prefroot=sdb1 +elif [ -f /.sdb2root ] ; then + /bin/echo "Preferred root device is /dev/sdb2 (disk 2)" + mounted=/mnt + prefroot=sdb2 +elif [ -f /.nfsroot ] ; then + /bin/echo "Preferred root device is NFS" + mounted=/mnt + prefroot=nfsroot +else + /bin/echo "Preferred root device is jffs2" + mounted= + prefroot=jffs2 +fi + + +# Perform prepatory tasks, and determine whether the desired rootfs is viable. + +/bin/mount -t proc proc /proc + +if [ $prefroot = "sda1" -o $prefroot = "sda2" -o $prefroot = "sdb1" -o $prefroot = "sdb2" ] ; then + /bin/echo "Sleeping 10sec while waiting for disk..." + sleep 10 + /bin/mount -rt ext3 /dev/$prefroot /mnt + if [ -L /mnt/sbin/init -o -x /mnt/sbin/init -o \ + -L /mnt/bin/init -o -x /mnt/bin/init ] ; then + /bin/echo "Root filesystem will be mounted from /dev/$prefroot ..." + else + /bin/umount /mnt + /bin/echo "Can't find valid rootfs on /dev/$prefroot, using jffs2 ..." + mounted= + prefroot=jffs2 + fi +fi + +if [ $prefroot = "maintenence" ] ; then + /bin/dd if=/dev/zero of=/dev/ram0 bs=1k count=12k 2>/dev/null + /usr/bin/mke2fs -m 0 /dev/ram0 12288 + /bin/mount -t ext2 /dev/ram0 /mnt + ( /usr/bin/find . -print0 -mount | /usr/bin/cpio -p -0 -d -m -u /mnt ) + /bin/rm -f /mnt/linuxrc + /bin/mkdir /mnt/mnt/backup /mnt/mnt/repair /mnt/mnt/tmpmnt +fi + +if [ $prefroot = "nfsroot" ] ; then + + sysconflen=`/bin/dd if=/dev/mtd1 bs=4 count=1 2>/dev/null | /usr/bin/hexdump -n 6 -e '"%02d"'` + ipaddr=`/bin/dd if=/dev/mtd1 bs=1 count=$sysconflen skip=4 2>/dev/null | grep ip_addr | sed -e s/ip_addr=//` + netmask=`/bin/dd if=/dev/mtd1 bs=1 count=$sysconflen skip=4 2>/dev/null | grep netmask | sed -e s/netmask=//` + gateway=`/bin/dd if=/dev/mtd1 bs=1 count=$sysconflen skip=4 2>/dev/null | grep gateway | sed -e s/gateway=//` + + /sbin/insmod ixp400 + /sbin/insmod ixp425_eth + /sbin/ifconfig ixp0 up $ipaddr netmask $netmask + /sbin/route add default gw $gateway + + /sbin/ifconfig lo up 127.0.0.1 + + # The nfsrootloc and nfsrootopts vars can be overridden here. + . /.nfsroot + + /bin/mount $nfsrootopts $nfsrootloc /mnt + + if [ -L /mnt/sbin/init -o -x /mnt/sbin/init -o \ + -L /mnt/bin/init -o -x /mnt/bin/init ] ; then + /bin/echo "Root filesystem will be mounted from an NFS root ..." + mounted=/mnt + else + /bin/umount /mnt + /bin/echo "Can't find valid NFS rootfs, using jffs2 ..." + mounted= + prefroot=jffs2 + fi +fi + +if [ $prefroot = "jffs2" ] ; then + /bin/echo "Root filesystem will be mounted from /dev/mtdblock4 ..." + mounted= +fi + + +/bin/umount /proc + +# Pivot to the desired rootfs and run the initial executable. + +if [ -n "$mounted" ] ; then + + cd $mounted + + if [ -x ./sbin/init -o -L ./sbin/init ] ; then + runboot=/sbin/init + elif [ -x ./bin/init -o -L ./bin/init ] ; then + runboot=/bin/init + else + runboot=/bin/sh + fi + + /sbin/pivot_root . initrd + + exec /usr/sbin/chroot . $runboot < /dev/console 1> /dev/console 2> /dev/console + +else + + exec /bin/init + +fi + +/bin/echo "Can't chroot to $prefroot, using jffs2 ..." +exec /bin/init + +# Last-resort fall-back - this should never be reached. +/bin/sh |