Fatdog 8.2 initrd.xz for the following available here ->
initrd.xz
Fundamentally the same initrd as the default Fatdog supplied version, extended to cater for a 'baseshell' kernel boot parameter that when present boots into cli/tui with ssh, sshfs, mc, tmux, screen and fp IDE (not the full fp, just the front end that is intended to be used as a text editor only).
At 79MB its around 6MB larger than the standard initrd.
========================================
For reference, a script I use to pull out all libs used by a program - so you can drop them into initrd ...
Code: Select all
#!/bin/sh
function mkchroot
{
[ $# -lt 2 ] && return
dest=$1
shift
for i in "$@"
do
# Get an absolute path for the file
[ "${i:0:1}" == "/" ] || i=$(which $i)
# Skip files that already exist at target.
[ -f "$dest/$i" ] && continue
if [ -e "$i" ]
then
# Create destination path
d=`echo "$i" | grep -o '.*/'` &&
mkdir -p "$dest/$d" &&
# Copy file
cat "$i" > "$dest/$i" &&
chmod +x "$dest/$i"
else
echo "Not found: $i"
fi
# Recursively copy shared libraries' shared libraries.
mkchroot "$dest" $(ldd "$i" | egrep -o '/.* ')
done
}
mkchroot "$@"
exit 0
Notes
use the above shell script to copy all the executables listed on the command line,
and all the shared libraries they link to, into a new directory. Then you can chroot
into that directory to make sure they run.
The first argument is a new directory, and the rest of its arguments are
executables to copy. You can try it out like so:
mkchroot subdir /bin/sh /bin/ls
sudo chroot subdir /bin/sh
ls -l
exit
(A variant of the original copied from Rob Landley
https://landley.net/writing/).
For example creating a folder /FILES and running the above script with parameters of /FILES tmux localedef mc mcedit ssh scp sftp sshfs ... assuming they're already installed into your main Fatdog system will largely copy the required files/libs into /FILES. Some additional files do need to manually added to that set for instance ssh also requires
cp /etc/nsswitch.conf /FILES/lib64/.
cp /lib64/libnss* /FILES/lib64/.
(and a copy of your ~/.ssh folder (ssh keys). mc also is missing a range of files/folders for it to work as intended. For mc I manually added (copied) folders
/etc/mc
~/.config/mc
~/.local/share/mc
/usr/libexec/mc
/usr/share/mc
For tmux I copied across my ~/.tmux.conf to /etc/tmux.conf.
For utf-8 I copied /usr/share/locale/en and en_GB, I also copied the folder /usr/share/i18n and terminfo and udhcpc. And a empty folder /usr/lib64/locale
Having a initrd that is quite functional by default (base fatdog), where you can wireless/hard-wired net connect and have ssh, tmux, mc etc. all to hand within that initrd is IMO considerably superior to the current base fatdog initrd. And whilst that does expand the initrd (without fd64.sfs up from around 72MB to 90MB, much of that additional content is relatively compressible. For instance gzip that initrd and it weighs in at around 80MB (just 8MB heavier). And that's before dropbear, that is included in the default initrd, is dropped (no longer required if replaced by the more comprehensive Openssh as above).
To accomodate entering the initrd shell I modified /sbin/system-init to add a baseshell boot parameter, so the modified section looks like ...
Code: Select all
# process keyfile - after load modules, before basesfs
process_keys
# baseshell
grep -q baseshell /proc/cmdline && echo 'Starting baseshell. Type "exit" to continue or reboot -f to reboot' && setsid cttyhack /bin/sh
# configure mdadm and lvm if requested, before basesfs and savefile
process_dofsck
To start tmux within initrd I created a script /root/runtmux.sh with content
Code: Select all
#!/bin/sh
PATH=/sbin:/bin:/usr/bin:/usr/local/bin export PATH
HOME=/root export HOME
# attempts to get tmux going (utf-8)
export TEXTDOMAINDIR=/usr/share/locale
export TEXTDOMAIN=easyinitrd
export OUTPUT_CHARSET=UTF-8
export LC_COLLATE=C
export LC_CTYPE=en_US.UTF-8
cd /root
mkdir -p /usr/lib64/locale # tmux (utf-8) failed without this folder
[ ! "$INIT_LANG" ] && INIT_LANG=C #precaution.
wkgLANG="${INIT_LANG}"
#this should match console font loaded in quicksetup...
case "${wkgLANG}" in
C|en*)
wkgLANG="C"
;;
ar*|he*|iw*) #arabic, hebrew
loadfont < /lib/consolefonts/LatArCyrHeb-16.psfu
;;
*) #all european languages...
#el|ru|uk|be|sr|tg|os|ba|ce|cv)
loadfont < /lib/consolefonts/LatGrkCyr-8x16.psfu
;;
esac
export wkgLANG
#gzip -d /lib/boot/keymaps/uk.gz
#loadkmap </lib/boot/keymaps/uk
#170206 reintroducing aufs in the kernel:
if grep -qw aufs /proc/filesystems; then
LAYERFS='aufs'
RO='=ro'
else
LAYERFS='overlay'
RO=''
fi
localedef -f UTF-8 -i en_US en_US.UTF-8
export LANG=en_US.UTF-8
export LANGORG=en_US.UTF-8
# tmux requires pseudo terminal
mount -t devpts non /dev/pts -o ptmxmode=0666,newinstance
# Setup/run tmux
#R=`ps -ef | grep tmux | wc -l`
#if [ $R -gt 1 ]; then
# exit
#fi
# start a tmux session, detach
# then send commands to that before reattaching to it
# Note that C-m is carriage return (enter)
# create a tmux session called work, and deattach so we can send keys to it
# Create the first window and load our menu into that ...
tmux new -s work -d
tmux rename-window -t work Menu
tmux send-keys -t work '/bin/sh -c /root/menu.sh' C-m
# Add another tmux window
tmux new-window -t work
tmux rename-window -t work top
tmux send-keys -t work "/bin/sh -c /bin/top" C-m
# Add another tmux window
tmux new-window -t work
tmux rename-window -t work mc
tmux send-keys -t work "/bin/sh -c /usr/bin/mc" C-m
# Add another tmux window
tmux new-window -t work
tmux rename-window -t work notes
tmux send-keys -t work "/bin/sh -c /usr/bin/mcedit /root/notes.txt" C-m
# and finally select which window to show first and attach to the tmux work session
tmux select-window -t work:4
tmux attach -t work
and created a /root/notes.txt file for that to read/load. Along with a /root/menu.sh file that acts as a menu (options printed out and read/case select/action script).
For a nicer (for my laptop screen) console font I modified /sbin/system-init to use a 32 bit font ter-i32b.psf.gz that I obtained from somewhere)
Code: Select all
de*|be*|br*|dk*|es*|fi*|fr*|it*|no*|se*|pt*|uk*)
modprobe nls_cp850
echo 850 > /etc/codepage
# Rufwoof - for uk we can use same as us
# setfont -C /dev/console $BOOT_FONTS/LatGrkCyr-8x16.psfu.gz
# echo LatGrkCyr-8x16 > /etc/fontmap
setfont -C /dev/console $BOOT_FONTS/ter-i32b.psf.gz
echo ter-i32b > /etc/fontmap
;;
... copying that font file into /lib/boot/consolefonts
With how I did it recorded (so I can repeat the process for later releases of Fatdog), attached is the initrd.xz for all of that. Using grub4dos to boot I'd suggest starting with a menu.lst entry of
Code: Select all
title NOMODESET VGA=ASK Fatdog baseshell
root (hd0,0)
kernel /vmlinuz baseshell pkeys=uk savefile=none nomodeset vga=ask
initrd /initrd.gz
and typically press Enter when prompted for a video mode and select 0. Within that on the Menu window there are basic options to manually connect to eth0 or wlan0.
... and then perhaps progress onto something like
Code: Select all
title Fatdog baseshell with wlan0
root (hd0,0)
kernel /vmlinuz baseshell net=wpa2:ssssssss:pppppppp:wlan0:dhcp pkeys=uk savefile=none
initrd /initrd.gz
... where ssssssss and pppppppp are your wireless ssid and password respectively. That then has you auto net connected to wlan0 on bootup and uses a better screen resolution.
After that, its down to you. Note that there's no fd64.sfs in any of this, so if you want to exit the above and continue conventional Fatdog booting, make sure you copy a fd64.sfs from somewhere to / before you exit the initrd shell. Or specify the basesfs and save file locations on the kernel boot line as you would normally.
Fundamentally the linked initrd.xz is the same as the standard fatdog initrd (but compressed to use .xz). But when the baseshell kernel boot parameter is included as above it drops to initrd cli and is set to run /root/run-tmux which loads up tmux that automatically starts on the /notes.txt page (that shows some help). Type a backtick character and the press 1 ... will take you to the menu window. Use the kill menu option to exit tmux and resume the standard bootup (or use the r (reboot) menu option to shutdown or p (power off) ...etc. Assuming its net connected OK then there are other options, reddit or a BBS for instance. Or press F11 to open a new window (cli) and ssh or sshfs mount ...etc. mc is also automatically loaded in another window, as is top (process viewer).
EDIT: extended to also include screen and fp ide (ide only - as a text editor/calculator). fp doesn't run well within tmux, however a workaround is to run 'screen' (another multiplexer) within tmux and then run fp within screen.
EDIT Jul 16 2019 : newer version uploaded that also includes ccrypt and pcrypt (pcrypt uses one time pad encryption, so a encrypted file takes up twice the amount of disk space, but where the .fck and .key files have to be together in order to reconstruct the clear text (non-encrypted) copy).
EDIT Jul 17 2019 : newer version that uses terminus 28 bold font. ter-i32b was a bit too large for my laptops 1366x768 i.e. 768 / 32 = perfect fit for 24 character lines height that most x-terms default to. However when using tmux to ssh into hashbang where tmux is also running on that, then that's two character lines of tmux panels (one at the top, one at the bottom for my setup). telnet into a BBS from that and as DOS type windows work best with 80x25 then for some activities such as Multi-BBS relay chat the chat window was too small (22 lines). Swapping to the i28b font = 768 / 28 = 27 (rounded down) character lines, which when there are two lines for tmux panels still leaves 25 lines within which BBS chat (and/or other DOS type 80x25 content) comfortably fits, whilst the general use font size (other things) is still large/comfortable enough to avoid having to go -_- at the screen.
For fun/pastime I added dosbox into initrd, installed win3.1 and telix into a folder on hdd and played retro-style for a while. This image was taken in actual fatdog as initrd doesn't include a screen snap.
Left window is Telix connecting to a BBS, right window is Win3.1 running paint, using two separate DOSBox sessions. Focus and Alt-Enter to full screen maximise .. nice. That's a quite heavily reduced Win 3.1, which as a sfs is around 7MB, but does open up a alternative to running a gui within initrd (mouse etc worked fine for me) i.e. boot to initrd cli, extract the win31 sfs and then within dosbox mount that mount point as the c:
unsquashfs -f -d /mnt/sda1/win31 win31.sfs
dosbox
and in dosbox ...
mount c /mnt/sda1/win31
c:
windows
Edit 18 July 2019 : newer version that now includes dosbox and a mario (gui) game (in /games/mario). Read the mario.txt file for the keys to use. No sound as initrd hasn't any sound configured/installed. That has pushed initrd.gz up to 84MB in size.
boot with the bootshell kernel boot parameter and at the initrd command line read the /readme.txt file.