Skip to content

Instantly share code, notes, and snippets.

@manio
Created April 11, 2017 08:40
Show Gist options
  • Save manio/5545cdbdfd4ef79647e3bc732ff0f11f to your computer and use it in GitHub Desktop.
Save manio/5545cdbdfd4ef79647e3bc732ff0f11f to your computer and use it in GitHub Desktop.
#!/bin/sh
# a sample /etc/init.d/rcS script
# more info: https://skyboo.net/2017/04/rpi-creating-a-ram-disk-running-linux-environment-from-nfs-booted-raspbian/
set -x
#prepare a new RAM filesystem copying needed libraries and binaries from the old fs
/old_root/fs_prepare.sh
#ssh server
/usr/sbin/dropbear -s
#convert the openssh key to the dropbear format
/old_root/usr/lib/dropbear/dropbearconvert openssh dropbear /old_root/root/.ssh/id_rsa /root/.ssh/dropbear_priv
#starting the NTP client, it is asking the NTP server every 10 minutes
/usr/sbin/ntpclient -s -h ntp.task.gda.pl
#creating symlink needed for modules loading (it will stay in memory after modprobe/insmod)
ln -s /old_root/lib/modules /lib/modules
#loading modules, 1wire setup
modprobe evdev
modprobe i2c-bcm2708
modprobe wire max_slave_count=30
modprobe ds2482
echo ds2482 0x18 > /sys/bus/i2c/devices/i2c-1/new_device
modprobe w1_ds2413
modprobe w1_therm strong_pullup=0
modprobe w1_ds2408
#sleep to detect all devices on 1wire buses
sleep 20
#now disable 1wire devices autodetection to prevent lagging between transactions
echo 0 > /sys/bus/w1/devices/w1_bus_master1/w1_master_search
echo 0 > /sys/bus/w1/devices/w1_bus_master2/w1_master_search
echo 0 > /sys/bus/w1/devices/w1_bus_master3/w1_master_search
echo 0 > /sys/bus/w1/devices/w1_bus_master4/w1_master_search
echo 0 > /sys/bus/w1/devices/w1_bus_master5/w1_master_search
echo 0 > /sys/bus/w1/devices/w1_bus_master6/w1_master_search
echo 0 > /sys/bus/w1/devices/w1_bus_master7/w1_master_search
echo 0 > /sys/bus/w1/devices/w1_bus_master8/w1_master_search
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment