From 144fba14de1f73fb7f8ce38639f05b795c8af141 Mon Sep 17 00:00:00 2001 From: dufourj Date: Mon, 16 Jan 2006 21:47:12 +0000 Subject: PC104 : - modifications mineurs pour les scripts du mode autonome ; - début du script d'update en autonome ; - correction du problème de dhcp en autonome ; - problème de ctrl-c ; - SD Card sux à mort !! --- i/pc104/initrd/conf/busybox/config | 10 +++++----- i/pc104/initrd/conf/fstab | 6 +++--- i/pc104/initrd/conf/linuxrc | 11 +++++++---- i/pc104/initrd/conf/udhcpc.script | 3 +++ i/pc104/initrd/conf/update_initrd.sh | 33 +++++++++++++++++++++++++++++++++ i/pc104/initrd/create.sh | 13 +++++++++---- 6 files changed, 60 insertions(+), 16 deletions(-) create mode 100755 i/pc104/initrd/conf/udhcpc.script create mode 100755 i/pc104/initrd/conf/update_initrd.sh (limited to 'i/pc104') diff --git a/i/pc104/initrd/conf/busybox/config b/i/pc104/initrd/conf/busybox/config index 3a798b4..8aeee0f 100644 --- a/i/pc104/initrd/conf/busybox/config +++ b/i/pc104/initrd/conf/busybox/config @@ -155,7 +155,7 @@ CONFIG_TEST=y # CONFIG_TR is not set # CONFIG_FEATURE_TR_CLASSES is not set # CONFIG_FEATURE_TR_EQUIV is not set -# CONFIG_TRUE is not set +CONFIG_TRUE=y # CONFIG_TTY is not set # CONFIG_UNAME is not set # CONFIG_UNIQ is not set @@ -434,7 +434,7 @@ CONFIG_FEATURE_FANCY_PING=y CONFIG_UDHCPC=y # CONFIG_DUMPLEASES is not set # CONFIG_FEATURE_UDHCP_SYSLOG is not set -CONFIG_FEATURE_UDHCP_DEBUG=y +# CONFIG_FEATURE_UDHCP_DEBUG is not set # CONFIG_ZCIP is not set # @@ -451,8 +451,8 @@ CONFIG_FEATURE_UDHCP_DEBUG=y # CONFIG_FEATURE_PS_WIDE is not set # CONFIG_RENICE is not set # CONFIG_BB_SYSCTL is not set -# CONFIG_TOP is not set -# CONFIG_FEATURE_TOP_CPU_USAGE_PERCENTAGE is not set +CONFIG_TOP=y +CONFIG_FEATURE_TOP_CPU_USAGE_PERCENTAGE=y # CONFIG_UPTIME is not set # @@ -476,7 +476,7 @@ CONFIG_ASH_JOB_CONTROL=y # CONFIG_ASH_MATH_SUPPORT_64 is not set # CONFIG_ASH_GETOPTS is not set # CONFIG_ASH_CMDCMD is not set -CONFIG_ASH_BUILTIN_ECHO=y +# CONFIG_ASH_BUILTIN_ECHO is not set # CONFIG_ASH_MAIL is not set # CONFIG_ASH_OPTIMIZE_FOR_SIZE is not set # CONFIG_ASH_RANDOM_SUPPORT is not set diff --git a/i/pc104/initrd/conf/fstab b/i/pc104/initrd/conf/fstab index df2712b..929b4c7 100644 --- a/i/pc104/initrd/conf/fstab +++ b/i/pc104/initrd/conf/fstab @@ -1,5 +1,5 @@ # /etc/fstab: static file system information. # -# -proc /proc proc defaults 0 0 - +# +proc /proc proc defaults 0 0 +/dev/hda1 /mnt/localsys ext2 defaults,ro 0 0 diff --git a/i/pc104/initrd/conf/linuxrc b/i/pc104/initrd/conf/linuxrc index 7b1e789..6ddf919 100755 --- a/i/pc104/initrd/conf/linuxrc +++ b/i/pc104/initrd/conf/linuxrc @@ -10,11 +10,14 @@ mount /proc echo -ne "\007" #done +# Launch update script in background +./etc/update_initrd.sh & + # TODO Export variables (LD...) # Launch the program # . /robot/start.sh # -while true -do - /bin/sh -done +#while true +#do +# /bin/sh +#done diff --git a/i/pc104/initrd/conf/udhcpc.script b/i/pc104/initrd/conf/udhcpc.script new file mode 100755 index 0000000..6008ffa --- /dev/null +++ b/i/pc104/initrd/conf/udhcpc.script @@ -0,0 +1,3 @@ +#!/bin/sh +# Configure network +/sbin/ifconfig $interface $ip diff --git a/i/pc104/initrd/conf/update_initrd.sh b/i/pc104/initrd/conf/update_initrd.sh new file mode 100755 index 0000000..b06057c --- /dev/null +++ b/i/pc104/initrd/conf/update_initrd.sh @@ -0,0 +1,33 @@ +#!/bin/sh +# The purpose of this script is to provide a system to update the PC104 in +# autonomous mode via the network. +# It is called by the linuxrc and should not be called by hand. + +# PATH is not correctly set... +PATH=$PATH:/usr/sbin/ +# Bring eth0 up +ifconfig eth0 up +# Get the configuration of the network via dhcp +udhcpc -i eth0 -s /etc/udhcpc.script +# Wait here for a connection. I do not know if it is a feature or a bug, but +# when nc receive a connection, it is end here. +nc -l -p 1234 + +# Mount the real system +mount /mnt/localsys +# Pivot root to the new_root. +# XXX It is a good idea to pivot_root ? Chroot is better ? +cd /mnt/localsys +pivot_root . old_root +exec chroot . sh dev/console 2>&1 +# This part sux : what's about the old process ? +# Kill them ? +umount /old_root +# We should call all the script +# TODO : find a better way to call it. +/etc/init.d/mountvirtfs start +/etc/init.d/mountall.sh start +/etc/init.d/networking start +/etc/init.d/ssh start +# XXX And for the end ? +# The FS has enough errors so do it well ! Umount everything ! diff --git a/i/pc104/initrd/create.sh b/i/pc104/initrd/create.sh index b0d66ab..9bca54b 100755 --- a/i/pc104/initrd/create.sh +++ b/i/pc104/initrd/create.sh @@ -50,15 +50,17 @@ mount_initrd () create_empty_struct () { # Create an empty root structure - mkdir -p $INITRD_TEMPDIR/{bin,dev,etc,lib,proc,sbin,usr/{sbin,bin},var/lock,robot,initrd} + mkdir -p $INITRD_TEMPDIR/{bin,dev,etc,proc,sbin,usr/{sbin,bin},var/lock,robot,initrd,mnt/localsys} # Create all the devices files we need create_dev # Fstab install -m 644 $INITRD_CONFIG_DIR/fstab $INITRD_TEMPDIR/etc/fstab - # Inittab - #install -m 644 $INITRD_CONFIG_DIR/inittab $INITRD_TEMPDIR/etc/inittab + # Udhcpc script + install -m 755 $INITRD_CONFIG_DIR/udhcpc.script $INITRD_TEMPDIR/etc/udhcpc.script # Copy the linuxrc script install -m 755 $INITRD_CONFIG_DIR/linuxrc $INITRD_TEMPDIR/linuxrc + # Copy the update script for autonome mode + install -m 755 $INITRD_CONFIG_DIR/update_initrd.sh $INITRD_TEMPDIR/etc/update_initrd.sh } create_dev () @@ -73,7 +75,10 @@ create_dev () # Create the console for logging ? Useful ? XXX $makedev -v consoleonly #tty1 tty2 tty3 tty4 tty5 - #$makedev -v ttyS0 ttyS1 ttyS2 ttyS3 ttyS4 ttyS5 ttyS6 + # Serial + $makedev -v ttyS0 ttyS1 ttyS2 + # Hard disk + $makedev -v hda # XXX Complete... # Back to the originated directory cd $cur_dir -- cgit v1.2.3