aboutsummaryrefslogtreecommitdiffstats
path: root/deploy/adapters/cobbler/snippets/post_s390_reboot
blob: fa33f06caa17e98ae07459f59825e673e4cf40b4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
## RHEL zVM installs do not properly reboot into the installed system.  This
## issue has been resolved in RHEL-5 Update3.  To get a consistent reboot
## behavior for s390* installs on all distros, this snippet can be used.  The
## snippet will attempt to discover the IPL volume zipl is being installed
## to and will attempt a reipl.  Be sure to set this snippet as the *last*
## snippet your kickstart template.

#if $arch.startswith("s390"):
%post --nochroot

# Does the kickstart file request a reboot?
grep -q "^reboot" /tmp/ks.cfg /ks.cfg 2>/dev/null
if [ \$? -ne 0 ]; then
    exit 0
fi

# find out the location of /boot and use it to re-ipl
boot_dev=""
for mountpt in /mnt/sysimage/boot /mnt/sysimage;
do
  set -- \$(grep " \$mountpt " /proc/mounts)
  if [ -b "\$1" ]; then
    boot_dev=\$1
    break
  fi
done

# lookup dasd disk
if [[ \$boot_dev == *dasd* ]]; then
   # remove the '/dev/' (aka basename)
   boot_dev=\${boot_dev\#\#/[^/]*/}
   # strip partition number from dasd device
   boot_dev=\${boot_dev%%[0-9]}
   type="ccw"
   id=`basename \$(readlink /sys/block/\$boot_dev/device)`

   # HACK - In RHEL4 and RHEL3 ... we do it the hard way
   grep -q "^[34]\$" /.buildstamp 2>/dev/null
   if [ \$? -eq 0 ]; then
      cat <<EOF> /mnt/sysimage/tmp/zeboot.sh
\#!/bin/bash
/sbin/modprobe -r vmcp
rm -f "/dev/vmcp"
sleep 2
[ -b "/dev/vmcp" ] || /bin/mknod /dev/vmcp c 10 61
/sbin/modprobe -a vmcp
sync
# Force a boot (e.g. IPL 0100)
/sbin/vmcp ipl \${id\#\#*.}
EOF
      /bin/chmod +x /mnt/sysimage/tmp/zeboot.sh
      /bin/chroot /mnt/sysimage /tmp/zeboot.sh
   # In RHEL5 ... lets cleanly shutdown (Update 3 and newer)
   else
      echo \$type > /sys/firmware/reipl/reipl_type
      echo \$id > /sys/firmware/reipl/\$type/device

      # Force a reboot
      pid=\$(cat /var/run/init.pid)
      [ -z "\$pid" ] && pid=\$(pidof init)
      kill -12 \$pid
      pid=\$(cat /var/run/loader.run)
      [ -z "\$pid" ] && pid=\$(pidof loader)
      kill \$pid
   fi
fi
#end if
uct w1_family_ops (see w1_family.h) and registers with the w1 subsystem. Current family drivers: w1_therm - (ds18?20 thermal sensor family driver) provides temperature reading function which is bound to ->rbin() method of the above w1_family_ops structure. w1_smem - driver for simple 64bit memory cell provides ID reading method. You can call above methods by reading appropriate sysfs files. What does a w1 master driver need to implement? ------------------------------------------------------------------ The driver for w1 bus master must provide at minimum two functions. Emulated devices must provide the ability to set the output signal level (write_bit) and sample the signal level (read_bit). Devices that support the 1-wire natively must provide the ability to write and sample a bit (touch_bit) and reset the bus (reset_bus). Most hardware provides higher-level functions that offload w1 handling. See struct w1_bus_master definition in w1.h for details. w1 master sysfs interface ------------------------------------------------------------------ <xx-xxxxxxxxxxxxx> - A directory for a found device. The format is family-serial bus - (standard) symlink to the w1 bus driver - (standard) symlink to the w1 driver w1_master_add - (rw) manually register a slave device w1_master_attempts - (ro) the number of times a search was attempted w1_master_max_slave_count - (rw) maximum number of slaves to search for at a time w1_master_name - (ro) the name of the device (w1_bus_masterX) w1_master_pullup - (rw) 5V strong pullup 0 enabled, 1 disabled w1_master_remove - (rw) manually remove a slave device w1_master_search - (rw) the number of searches left to do, -1=continual (default) w1_master_slave_count - (ro) the number of slaves found w1_master_slaves - (ro) the names of the slaves, one per line w1_master_timeout - (ro) the delay in seconds between searches w1_master_timeout_us - (ro) the delay in microseconds beetwen searches If you have a w1 bus that never changes (you don't add or remove devices), you can set the module parameter search_count to a small positive number for an initially small number of bus searches. Alternatively it could be set to zero, then manually add the slave device serial numbers by w1_master_add device file. The w1_master_add and w1_master_remove files generally only make sense when searching is disabled, as a search will redetect manually removed devices that are present and timeout manually added devices that aren't on the bus. Bus searches occur at an interval, specified as a summ of timeout and timeout_us module parameters (either of which may be 0) for as long as w1_master_search remains greater than 0 or is -1. Each search attempt decrements w1_master_search by 1 (down to 0) and increments w1_master_attempts by 1. w1 slave sysfs interface ------------------------------------------------------------------ bus - (standard) symlink to the w1 bus driver - (standard) symlink to the w1 driver name - the device name, usually the same as the directory name w1_slave - (optional) a binary file whose meaning depends on the family driver rw - (optional) created for slave devices which do not have appropriate family driver. Allows to read/write binary data.