This commit is contained in:
Albert S. 2013-03-23 22:22:34 +01:00
джерело 7fb0095fbc
коміт f5a9026bd0
18 змінених файлів з 4948 додано та 0 видалено

82
CHANGELOG Normal file

@ -0,0 +1,82 @@
1.0 2013-03-23
==============
-Using buildroot now to create the rootfs.
-updated userspace tools(e. g. busybox).
-glibc replaced with uclibc and everything recompiled against uclibc
-/rescueOS/usb-mass-storage-enable.sh: Work if sd card is inserted or not(known mmcblkX number issue on N900)
-shipping wifi firmware
-corrected dhcp business with /etc/resolv.conf
-decreased size of the initrd
====
0.5.4 2013-01-05
Nothing special but useful changes:
-midnight commander removed as it was eating too much space and I doubt people were actually using it.
-Now after bootup, the system asks the user whether he wants to enable anonymous ftp up and downloads everywhere.
Then whether telnetd should be started and finally asks whether usb networking should be enabled.
=================================
0.5.3
Short note: it disappeared from the server (some problems with my hoster).
Development is pretty much stalled. I am focusing on other things.
Contributions otoh are still welcome.
-Including Pali's script which should fix some messed up maemo /dev/ device nodes (iirc, this can happen with uboot fun)
0.5 2012-03-03, version 0.5.2
Boring and nothing exciting:
* tar is now gnu tar, not busybox's version for convenience
* /tmp/ for some reason never existed, now it does :S
* Mountpoints /mnt/free1, /mnt/free2, /mnt/free3 (how noteworthy!)
* PS1 was set to show the current directory you are in.
0.5 2012-01-22, version 0.5.1
* Battery capacity watchdog tells user at 45 % capacity to charge the
battery. Type "stfu" if the messages annoy you.
0.5 2011-11-02, version 0.5
* Updated busybox to 1.19.3
* User can append autostart=/path... option in the kernel
* command line to run a script right after bootup.
* tcpsvd included for ftpd. For example, "tcpsvd -v 0.0.0.0 21
ftpd -w" enables anonymous down- and uploads everywhere.
* By Request: Midnight Commander 4.8 included. As functions
keys are not available/mapped, use ESC+number. Still borked.
* cleaner shutdown.
0.4 2011-09-02:
* e2fsprogs
* dosfstools
* Now also available as an initrd image.
0.3 2011-08-26:
* Battery charging support. (via ShadowJK's h
http://enivax.net/jk/n900/">meegocharge script</a>)
0.2 2011-08-21:
* Decreased rootfs size by a factor of 10
* First poor-man script to create an archive of the maemo rootfs.¹)
* Takes the WiFi-Firmwares on first boot from maemo root if wished by
the user.¹
* Bug which caused the wlan interface number to increase on every reboot
fixed.
* bash and job control
* Typo in /rescueOS/umount-maemo-root.sh fixed
0.1 2011-07-31:
* First release
* WiFi Support
* ubifs mounting support (maemo root for example)
* USB networking
* USB mass-storage mode
* EMMC mounting
¹ tarball release only, which isn't available anymore.

1096
buildrootconfig Normal file

Різницю між файлами не показано, бо вона завелика Завантажити різницю

1009
busyboxconfig Normal file

Різницю між файлами не показано, бо вона завелика Завантажити різницю

128
documentation.txt Normal file

@ -0,0 +1,128 @@
Documentation of RescueOS
=========================
RescueOS is a rescue solution for the Nokia N900, distributed
as an initrd image. It has several features, most
notable:
mounting maemo /
EMMC access(can mount maemo home and MyDocs partition)
WiFi support
USB mass-storage mode
USB networking
Battery charging
Users must be familiar with the Linux console.
This project is _NOT_ the meego rescue initrd.
Update: I don't provide a tarball anymore.
How does it work?
~~~~~~~~~~~~~~~~~
The flasher utility loads rescueOS. This makes it unnecessary
to modify the bootloader or maemo's /sbin/preinit.
By using the "-l" option, we do not flash the kernel or initrd image.
It only loads the kernel into RAM. No modification on
the NAND or bootloader happens.
Usecases
~~~~~~~~
In fact, most users do not need it. Either way, possible usecases:
-Changing typos in bootscripts which prevent an operation system
(e.g. maemo) to boot.
-Backuping files prior to a reflash.
-Charging the battery (when maemo is dead).
-Modification of the EMMC partitions and partition table.
-Backup & Restoring maemo rootfs.
-fsck file system checks
-and more...
Booting the initrd
~~~~~~~~~~~~~~~
You can not store persistent data, e.g. WiFi firmwares from maemo
as everything happens in RAM.
flasher-3.5 -k 2.6.37 -n initrd.img -l -b"rootdelay root=/dev/ram0
wait for "suitable device not found..." and connect the N900 to your
Linux box through USB.
~~~~~~~~~~~~~~~
How to use it
~~~~~~~~~~~~~~~
It boots and you get a bash shell.
The folder /rescueOS/ contains some scripts for various tasks. Not all of them
are completed yet. They help you with the usual stuff, e.g. mass-storage
mode, maemo root mounting, usbnetworking, WiFi setup etc.
Mounting maemo root
-------------------
/rescueOS/mount-maemo-root.sh
This scripts mounts the maemo root to /mnt/maemo.
/rescueOS/umount-maemo-root.sh
USB Networking
-------------
/rescueOS/usbnetworking-enable.sh
Sets up USB networking in the following way:
ifconfig usb0 192.168.2.15 up
ifconfig usb0 netmask 255.255.255.0
route add 192.168.2.14 usb0
To disable it: /rescueOS/usbnetworking-disable.sh
USB Mass-Storage mode
--------------------
/rescueOS/mass-storage-enable.sh
Makes /dev/mmcblk1p1 and /dev/mmcblk1p2 available for the mass-storage
mode. These are the EMMC home partition and MyDocs in maemo.
/rescueOS/mass-storage-disable.sh: Deactivates mass-storage mode.
WiFi support
------------
It has wpa_supplicant, but without EAP support. This should be ok for
most home networks which use a PSK.
Give the following a try:
wpa_passphrase [essid] [password] > /wlan.conf
sh /rescueOS/setup-wpa-wifi.sh
For DHCP, use udhcpc -i wlan0.
You need the firmware files of course: /rescueOS/firmware-from-maemo.sh
Battery charging
----------------
By using ShadowJK's charge21 script. Use it only with the wallcharger,
as it pulls 950 mA, and USB is not designed for that
(some ports can do it though, don't try if in doubt.)
/rescueOS/charge21.bash
Shutdown
--------
poweroff
Root password
-------------
rootme
Contributions and suggestions are welcome. Write to me (NIN101 on freenode).

9
etc/fstab Normal file

@ -0,0 +1,9 @@
# /etc/fstab: static file system information.
#
# <file system> <mount pt> <type> <options> <dump> <pass>
/dev/root / ext2 rw,noauto 0 1
proc /proc proc defaults 0 0
devpts /dev/pts devpts defaults,gid=5,mode=620 0 0
tmpfs /dev/shm tmpfs mode=0777 0 0
tmpfs /tmp tmpfs defaults 0 0
sysfs /sys sysfs defaults 0 0

1
etc/hostname Normal file

@ -0,0 +1 @@
rescueos

74
etc/init.d/rcS Executable file

@ -0,0 +1,74 @@
#!/bin/sh
EMULATOR=0
mount -t sysfs none /sys
mount -n -t proc none /proc
echo 200 > /sys/class/backlight/acx565akm/brightness
mount -t tmpfs -o size=64k,mode=0755 tmpfs /dev
mkdir /dev/pts
mount -t devpts devpts /dev/pts
mount -t tmpfs -o rw,noexec,nosuid,mode=0755 tmpfs /run
mount -t tmpfs -o rw,mode=0755 tmpfs /root/
mount -t tmpfs -o rw,nosuid,nodev tmpfs /tmp/
echo /sbin/mdev.sh > /proc/sys/kernel/hotplug
mdev -s
find /sys/devices/* -name modalias | while read module ; do
modprobe `cat $module` 2> /dev/null
done
hwclock -s
hostname -F /etc/hostname
modprobe leds-lp5523
/sbin/battery-watchdog &
#/rescueOS/charge21.bash > /run/batterylog &
clear
echo "Disclaimer: This system comes without any warranty. Use it at your own risk."
sleep 3
clear
echo "Welcome to N900 Rescue Initrd 1.0"
echo
/sbin/loadkmap < /rescueOS/nokia-n900.kmap
for i in 2 3 7 8 ; do
echo 25 > /sys/class/leds/lp5523\:channel$i/brightness
done
autostart_script=`grep -q autostart /proc/cmdline && cat /proc/cmdline | sed -e 's/.*autostart=\(.*\)/\1/'`
if [ -n "$autostart_script" ] ; then
echo "Running $autostart_script"
$autostart_script
fi
touch /run/resolv.conf
echo "The root password is: rootme"
echo "Start an FTP server with anonymous up and downloads everywhere? y/n"
read result;
if [ "$result" = "y" ] ; then
tcpsvd -v 0.0.0.0 21 ftpd -w &
fi
echo "Start telnetd? y/n"
read result;
if [ "$result" = "y" ] ; then
telnetd
fi
echo "Start usb-networking? y/n"
read result;
if [ "$result" = "y" ] ; then
/rescueOS/usbnetworking-enable.sh
fi
if [ "$EMULATOR" = "1" ] ; then
udhcpc eth0
fi
#We are done.

4
etc/inittab Normal file

@ -0,0 +1,4 @@
::sysinit:/etc/init.d/rcS
tty1::respawn:-/bin/bash
ttyS0::respawn:-/bin/bash
::shutdown:/bin/sh /rescueOS/shutdown-cleanup

1
etc/passwd Normal file

@ -0,0 +1 @@
root:$1$sz.20p5a$c40FElyGq0cIfHXeQQChQ/:0:0:root:/root:/bin/bash

1
etc/passwd- Normal file

@ -0,0 +1 @@
root:$1$6WxBQ9E9$xc/J67N0/3N1HAsGkVur..:0:0:root:/root:/bin/bash

1
etc/profile Normal file

@ -0,0 +1 @@
PS1="\w\$ "

1
howtocreate Normal file

@ -0,0 +1 @@
/sbin/mkfs.cramfs -b 4096 -n n900rescueinitrd rinitrd/ initrd.img

1
howtoflash Normal file

@ -0,0 +1 @@
flasher-3.5 -k zImage -n initrd.img -l -b"rootdelay root=/dev/ram0"

2459
kernel_config Normal file

Різницю між файлами не показано, бо вона завелика Завантажити різницю

28
sbin/battery-watchdog Executable file

@ -0,0 +1,28 @@
#!/bin/sh
#Modified, we warn only now....
#fill_charger()
#{
#usb=`cat /sys/bus/platform/devices/twl4030_usb/vbus`
#wall=`cat /sys/bus/platform/devices/musb_hdrc/charger`
#if [ "$usb" = "on" ] || [ "$wall" = 1 ] ; then
#charger=1
#else
#charger=0
#fi
#}
while [ true ] ; do
cap=`cat /sys/class/power_supply/bq27200-0/capacity`
#fill_charger
#if [ $cap -le 55 -a $charger -eq 0 ] ; then
if [ $cap -le 45 ] ; then
#echo "Attention: Plugin the charger soon to not run out of power. Current: $cap%. To disable this message, type \"stfu\""
echo "Attention: Charge the battery (by running the charger script) to not run out of power. Current: $cap%. To disable this message, type \"stfu\""
fi
sleep 20
done

3
sbin/mdev.sh Executable file

@ -0,0 +1,3 @@
#!/bin/sh
[ -e /lib/firmware/$FIRMWARE ] || echo -1 > /sys/$DEVPATH/loading
/sbin/mdev

2
sbin/stfu Executable file

@ -0,0 +1,2 @@
#!/bin/sh
killall battery-watchdog

48
usr/share/udhcpc/default.script Executable file

@ -0,0 +1,48 @@
#!/bin/sh
# udhcpc script edited by Tim Riker <Tim@Rikers.org>
RESOLV_CONF="/etc/resolv.conf"
[ -n "$1" ] || { echo "Error: should be called from udhcpc"; exit 1; }
NETMASK=""
[ -n "$subnet" ] && NETMASK="netmask $subnet"
BROADCAST="broadcast +"
[ -n "$broadcast" ] && BROADCAST="broadcast $broadcast"
case "$1" in
deconfig)
echo "Setting IP address 0.0.0.0 on $interface"
ifconfig $interface 0.0.0.0
;;
renew|bound)
echo "Setting IP address $ip on $interface"
ifconfig $interface $ip $NETMASK $BROADCAST
if [ -n "$router" ] ; then
echo "Deleting routers"
while route del default gw 0.0.0.0 dev $interface ; do
:
done
metric=0
for i in $router ; do
echo "Adding router $i"
route add default gw $i dev $interface metric $((metric++))
done
fi
echo "Recreating $RESOLV_CONF"
echo -n > $RESOLV_CONF-$$
[ -n "$domain" ] && echo "search $domain" >> $RESOLV_CONF-$$
for i in $dns ; do
echo " Adding DNS server $i"
echo "nameserver $i" >> $RESOLV_CONF-$$
done
mv $RESOLV_CONF-$$ $RESOLV_CONF
;;
esac
exit 0