[Runnix-commits] SF.net SVN: runnix: [56] trunk
Status: Alpha
Brought to you by:
krisk84
From: <kr...@us...> - 2007-04-28 01:01:12
|
Revision: 56 http://svn.sourceforge.net/runnix/?rev=56&view=rev Author: krisk84 Date: 2007-04-27 18:01:00 -0700 (Fri, 27 Apr 2007) Log Message: ----------- actually build runnix image Modified Paths: -------------- trunk/target/generic/target_skeleton/runnix trunk/target/x86/syslinux/syslinux.mk Added Paths: ----------- trunk/target/generic/target_skeleton/etc/runnix-release trunk/toolchain/runrelease/ trunk/toolchain/runrelease/files/ trunk/toolchain/runrelease/files/INSTALL trunk/toolchain/runrelease/files/install trunk/toolchain/runrelease/files/rootfs_vfat/ trunk/toolchain/runrelease/files/rootfs_vfat/boot.msg trunk/toolchain/runrelease/files/rootfs_vfat/os/ trunk/toolchain/runrelease/files/rootfs_vfat/os/default.conf trunk/toolchain/runrelease/files/rootfs_vfat/runnix.conf.sample trunk/toolchain/runrelease/files/rootfs_vfat/syslinux.cfg trunk/toolchain/runrelease/runrelease.mk Removed Paths: ------------- trunk/target/generic/target_skeleton/runnix.new Added: trunk/target/generic/target_skeleton/etc/runnix-release =================================================================== --- trunk/target/generic/target_skeleton/etc/runnix-release (rev 0) +++ trunk/target/generic/target_skeleton/etc/runnix-release 2007-04-28 01:01:00 UTC (rev 56) @@ -0,0 +1 @@ +trunk Modified: trunk/target/generic/target_skeleton/runnix =================================================================== --- trunk/target/generic/target_skeleton/runnix 2007-04-27 21:45:08 UTC (rev 55) +++ trunk/target/generic/target_skeleton/runnix 2007-04-28 01:01:00 UTC (rev 56) @@ -1,8 +1,14 @@ #!/bin/sh PATH=/bin:/sbin:/usr/bin:/usr/sbin +# BASE is where the runnix partition is mounted BASE=/mnt/base +# ROOT is where the .run partition is mounted +ROOT=/mnt/root + +DRIVES="hda hdb hdc hdd hde hdf hdg hdh sda sdb sdc sdd" + if `mount -t proc none /proc` then echo "proc mounted" @@ -16,23 +22,39 @@ CMDLINE=`cat /proc/cmdline` -for x in hda1 hdb1 hdc1 hdd1 hde1 hdf1 hdg1 hdh1 sda1 sdb1 sdc1 sdd1 +for x in $DRIVES do - if `mount -t vfat /dev/${x} $BASE > /dev/null 2>&1` - then - if [ -f $BASE/runnix ] - then - DEVICE=${x} - fi - fi +if `mount -t vfat /dev/${x}1 $BASE > /dev/null 2>&1` +then +if [ -f $BASE/runnix ] +then +DEVICE=${x} +else +umount /dev/${x}1 +fi +fi done +for x in $DRIVES +do +if `mount -t iso9660 -o ro /dev/${x} $BASE > /dev/null 2>&1` +then +if [ -f $BASE/runnix ] +then +DEVICE=${x} +RODEV=yes +else +umount /dev/${x} +fi +fi +done + # Loader not found if [ ! $DEVICE ] then - echo "Device not found." - exec /bin/sh - exit +echo "Runnix device not found." +exec /bin/sh +exit fi # get image name @@ -59,10 +81,12 @@ if [ "$NDEV" ] then ifconfig lo up 127.0.0.1 + if [ "$MAC" ] then ifconfig "$NDEV" hw ether "$MAC" fi + if [ "$IP" = "dhcp" ] then echo "Configuring $NDEV with DHCP..." @@ -70,11 +94,14 @@ else ifconfig "$NDEV" inet "$IP" netmask "$NM" route add -net default gw "$GW" + for i in $DNS do echo "nameserver $i" >> /tmp/etc/resolv.conf done + fi + fi if [ "$URL" ] @@ -166,7 +193,7 @@ FSTYPE=ext2 fi -if `mount -t $FSTYPE -o ro /dev/loop0 /mnt/root` +if `mount -t $FSTYPE -o ro /dev/loop0 $ROOT` then echo "Root mounted" else @@ -176,19 +203,19 @@ if [ ! "$INITRD" ] then -INITRD=initrd.img +INITRD=$ROOT/boot/initrd.img fi if [ ! "$KERN" ] then -KERN=boot/bzImage +KERN=$ROOT/boot/bzImage fi mount -t tmpfs none /mnt/tmp -cp $BASE/$INITRD /mnt/tmp/initrd.img -cp /mnt/root/$KERN /mnt/tmp/bzImage +cp $INITRD /mnt/tmp/initrd.img +cp $KERN /mnt/tmp/bzImage -umount /mnt/root +umount $ROOT if [ ! "$KCMD" ] then Deleted: trunk/target/generic/target_skeleton/runnix.new =================================================================== --- trunk/target/generic/target_skeleton/runnix.new 2007-04-27 21:45:08 UTC (rev 55) +++ trunk/target/generic/target_skeleton/runnix.new 2007-04-28 01:01:00 UTC (rev 56) @@ -1,309 +0,0 @@ -#!/bin/sh -PATH=/bin:/sbin:/usr/bin:/usr/sbin - -BASE=/mnt/base - -donet () { -ifconfig lo0 down 2> /dev/null -ifconfig $NDEV down 2> /dev/null -ifconfig lo up 127.0.0.1 -if [ "$MAC" ] -then -ifconfig "$NDEV" hw ether "$MAC" -fi -if [ "$IP" = "dhcp" ] -then -# echo "Configuring $NDEV with DHCP..." -udhcpc -nq -s /etc/udhcpc.script -i "$NDEV" -else -ifconfig "$NDEV" inet "$IP" netmask "$NM" -echo $IP > /tmp/myip -route add -net default gw "$GW" -for i in $DNS -do -echo "nameserver $i" >> /tmp/etc/resolv.conf -done -fi - -if [ -f /tmp/myip ] -then -return 0 -else -return 1 -fi -} - -##Check for upgrade function -## 0 success with upgrade available -## 1 on general failure -## 2 no upgrade available - -checkup () { -# echo "Checking for updates..." - -if `wget -q -c -O /tmp/ver $URL/ver` -then -VER=`cat /tmp/ver` - -if [ -f $BASE/os/ver ] -then -OVER=`cat $BASE/os/ver` -else -OVER="NONE" -fi - -if [ "$VER" = "$OVER" ] -then -return 2 -else -return 0 -fi - -else -return 1 -fi -} - -getup () { -echo "Downloading $URL/$VER.tar.gz - Please Wait" -wget -c -O /tmp/$VER.tar.gz $URL/$VER.tar.gz -wget -q -c -O /tmp/$VER.tar.gz.sha1 $URL/$VER.tar.gz.sha1 -} - -extract () { -cd $BASE/os -tar -xzf /tmp/$VER.tar.gz -sync -} - -install () { -mv $BASE/os/$VER/* $BASE/os/ && mv /tmp/ver $BASE/os/ver -rmdir $BASE/os/$VER -} - -checkfile () { -if `sha1sum -cs $1` -then -return 0 -else -return 1 -fi -} - -getconfig () { -if [ -r $1 ] -then -OFILE=`basename $1` -#cat $1 | dos2unix -u > /tmp/etc/$OFILE -cp $1 /tmp/etc/$OFILE -. /tmp/etc/$OFILE -fi -} - -# mount crucial filesystems -mount -t proc none /proc -mount -t tmpfs none /tmp -mkdir /tmp/etc - -# get command line options -CMDLINE=`cat /proc/cmdline` - -# figure out what we are running from -for i in ${CMDLINE} -do -if `echo $i | grep -q "rundisk="` -then -RUNDISK=`echo $i | grep "rundisk="| sed -e 's/rundisk=//'` - -case $RUNDISK in - -cdrom|CDROM|cd|CD) -RFSTYPE=iso9660 -RFSDEV="hda hdb hdc hdd hde hde hdf hdg hdh" -;; - -usbflash|USBFLASH|usb|USB) -RFSTYPE=vfat -RFSDEV="sda1 sdb1 sdc1 sdd1" -;; - -cf|CF) -RFSTYPE=vfat -RFSDEV="hda1 hdb1 hdc1 hdd1 hde1 hdf1 hdg1 hdh1" -;; - -esac - -else -# fallback to "auto" -RFSTYPE=vfat -RFSDEV="hda1 hdb1 hdc1 hdd1 hde1 hdf1 hdg1 hdh1 sda1 sdb1 sdc1 sdd1" - -fi -done - -# look for loader -for i in $RFSDEV -do - if `mount -t $RFSTYPE /dev/${i} $BASE > /dev/null 2>&1` - then - if [ -f $BASE/runnix ] - then - DEVICE=${i} - else - umount /dev/${i} - fi - fi -done - -# Loader not found -if [ ! $DEVICE ] -then - echo "Runnix disk not found." - exec /bin/sh - exit -fi - -# get image name -for i in ${CMDLINE} -do -if `echo $i | grep -q "runimg="` -then -RUNIMG=`echo $i | grep "runimg="| sed -e 's/runimg=//'` -fi -done - -if [ ! "$RUNIMG" ] -then -RUNIMG="auto" -fi - -# get upgrade config file -getconfig $BASE/runnix.conf -getconfig $BASE/os/default.conf - -# Here we go - -if [ "$NDEV" ] -then -echo "Configuring the network..." -donet; DONET=$? -fi - -if [ "$DONET" = "0" ] -then -echo "Checking for updated image..." -checkup; CHECKUP=$? -fi - -if [ "$CHECKUP" = "0" ] -then -echo "Getting updated image..." -getup; GETUP=$? -fi - -if [ "$GETUP" = "0" ] -then -echo "Extracting update..." -doup; DOUP=$? -fi - -if [ "$DOUP" = "0" ] -then -echo "Installing update..." -install; INSTALL=$? -fi - -if [ "$USLEEP" ] -then -echo "Sleeping for "$USLEEP" seconds" -sleep $USLEEP -fi - -if [ "$RUNIMG" = "auto" ] -then -# Get the latest good one -cd $BASE/os -RUNIMG=`ls *.run | tail -n1` -fi - -#If we have a ver file, override auto value -if [ -f $BASE/os/ver ] -then -RUNIMG=`cat $BASE/os/ver`.run -CHECKIMG=0 -fi - -if [ "$CHECKIMG" ] -then -echo "Verifying image..." -cd $BASE/os -if `checkfile $RUNIMG.sha1` -then -echo "Image verified. Booting." -else -# try again -echo "Kris needs to put something in here" -fi -fi - -#grab the new config file -getconfig $BASE/os/$RUNIMG.conf - -# Setup root device -if [ ! "$OFFSET" ] -then -losetup /dev/loop0 $BASE/os/$RUNIMG -else -losetup -o "$OFFSET" /dev/loop0 $BASE/os/$RUNIMG -fi - -# fill in some defaults if we don't have them -if [ ! "$INITRD" ] -then -INITRD=initrd.img -fi - -if [ ! "$KERN" ] -then -KERN=boot/bzImage -fi - -if [ ! "$FSTYPE" ] -then -FSTYPE=ext2 -fi - -# Mount root device -if `mount -t $FSTYPE -o ro /dev/loop0 /mnt/root` -then -echo "Root mounted" -else -echo "Error mounting $RUNIMG root fs" -exec /bin/sh -fi - -#copy new kernel and initrd to RAM -mount -t tmpfs none /mnt/tmp -cp $BASE/$INITRD /mnt/tmp/initrd.img -cp /mnt/root/$KERN /mnt/tmp/bzImage - -#unmount old filesystem -umount /mnt/root - -# bomb if we don't have a kernel command line -if [ ! "$KCMD" ] -then -echo "You need to specify a kernel command line" -echo "I can't guess that" -exec /bin/sh -fi - -# free up some RAM -umount /tmp - -echo "Trying kexec..." -kexec --command-line="$KCMD" --initrd=/mnt/tmp/initrd.img -f /mnt/tmp/bzImage - -# Just in case -exec /bin/sh Modified: trunk/target/x86/syslinux/syslinux.mk =================================================================== --- trunk/target/x86/syslinux/syslinux.mk 2007-04-27 21:45:08 UTC (rev 55) +++ trunk/target/x86/syslinux/syslinux.mk 2007-04-28 01:01:00 UTC (rev 56) @@ -1,6 +1,6 @@ ############################################################# # -# syslinux to make target msdos/iso9660 filesystems bootable +# syslinux to make target msdos filesystems bootable # ############################################################# @@ -15,11 +15,11 @@ bzcat $(DL_DIR)/$(SYSLINUX_SOURCE) | tar -C $(BUILD_DIR) -xvf - touch -c $(SYSLINUX_DIR)/Makefile -$(SYSLINUX_DIR)/isolinux.bin: $(SYSLINUX_DIR)/Makefile - $(MAKE) CC=$(TARGET_CC) -C $(SYSLINUX_DIR) - touch -c $(SYSLINUX_DIR)/isolinux.bin +$(SYSLINUX_DIR)/unix/syslinux: $(SYSLINUX_DIR)/Makefile + $(MAKE) CC=gcc -C $(SYSLINUX_DIR) + touch -c $(SYSLINUX_DIR)/unix/syslinux -syslinux: $(SYSLINUX_DIR)/isolinux.bin +syslinux: $(SYSLINUX_DIR)/unix/syslinux syslinux-clean: -make -C $(SYSLINUX_DIR) clean Added: trunk/toolchain/runrelease/files/INSTALL =================================================================== --- trunk/toolchain/runrelease/files/INSTALL (rev 0) +++ trunk/toolchain/runrelease/files/INSTALL 2007-04-28 01:01:00 UTC (rev 56) @@ -0,0 +1,39 @@ +# RUNNIX 0.1 +# I don't write good docs (anymore) - Kristian Kielhofner <kr...@kr...> + +To install: + +create a fat 16 filesystem on something: +NOTE: syslinux does not seem to like dos volume names +don't specify -N when running mkdosfs + +mkdosfs -F 16 /dev/something1 + +install syslinux on it: + +./syslinux /dev/something1 +cat mbr.bin > /dev/something + +mount it: + +mount /dev/something1 /mnt/runnix + +copy runnix to it: + +cp -R rootfs_vfat/* /mnt/runnix/ + +Now all you have to do is get an image! + +AstLinux is currently the only image available, but I will be working +on more soon. + +All you should have to do is put a .run file (and its config file and other +stuff) in /mnt/runnix/os/ + +If you are not using a serial console, take a look at the various +syslinux.cfg files in /mnt/runnix + +Have fun! + +-- +Kristian Kielhofner Added: trunk/toolchain/runrelease/files/install =================================================================== --- trunk/toolchain/runrelease/files/install (rev 0) +++ trunk/toolchain/runrelease/files/install 2007-04-28 01:01:00 UTC (rev 56) @@ -0,0 +1,28 @@ +#!/bin/bash + +if [ ! $1 ] +then +echo " + +Usage: + +$0 [device] +" +exit 1 +fi + +DEVICE=$1 + +umount /media/* +fdisk $DEVICE + +rmmod usb-storage + +echo "Remove USB device" +read -p "Press enter to continue" + +umount /media/* + +mkdosfs -F 16 $DEVICE"1" + + Added: trunk/toolchain/runrelease/files/rootfs_vfat/boot.msg =================================================================== --- trunk/toolchain/runrelease/files/rootfs_vfat/boot.msg (rev 0) +++ trunk/toolchain/runrelease/files/rootfs_vfat/boot.msg 2007-04-28 01:01:00 UTC (rev 56) @@ -0,0 +1,4 @@ +runnix 0.1 - http://www.runnix.org + + + Property changes on: trunk/toolchain/runrelease/files/rootfs_vfat/boot.msg ___________________________________________________________________ Name: svn:executable + * Added: trunk/toolchain/runrelease/files/rootfs_vfat/os/default.conf =================================================================== --- trunk/toolchain/runrelease/files/rootfs_vfat/os/default.conf (rev 0) +++ trunk/toolchain/runrelease/files/rootfs_vfat/os/default.conf 2007-04-28 01:01:00 UTC (rev 56) @@ -0,0 +1,40 @@ +# Default runnix config file +# +# This is the config file that runnix will read +# before it attempts to do any upgrades, find +# images, etc. This is where you define the +# behavior of these features. + +# Network support +# Runnix can upgrade your .run files from a +# network +# Configure the network interface here +# Device connected to network +NDEV="eth0" + +# IP address - use "dhcp" for DHCP support +IP="dhcp" + +# Netmask if using static IP +# Ignored if IP=dhcp +#NM="255.255.255.0" + +# Default gateway if using static IP +# Ignored if IP=dhcp +#GW="192.168.0.1" + +# DNS Servers is using static IP +# Ignored if IP=dhcp +# You can specify multiple servers with spaces +#DNS="192.168.0.1 192.168.0.2" + +# MAC address spoofing for the interface above +#MAC="00:11:22:33:44:55" + +# URL to look for upgrade (AstLinux net4801 image by default) +# Must be http:// or ftp:// +#URL="http://www.krisk.org/upgrade/net4801" + +# Sometimes we need to sleep after upgrade +# This is a hack that you should not use +# USLEEP="10" Property changes on: trunk/toolchain/runrelease/files/rootfs_vfat/os/default.conf ___________________________________________________________________ Name: svn:executable + * Added: trunk/toolchain/runrelease/files/rootfs_vfat/runnix.conf.sample =================================================================== --- trunk/toolchain/runrelease/files/rootfs_vfat/runnix.conf.sample (rev 0) +++ trunk/toolchain/runrelease/files/rootfs_vfat/runnix.conf.sample 2007-04-28 01:01:00 UTC (rev 56) @@ -0,0 +1,42 @@ +# Sample runnix (http://www.runnix.org) configuration file +# +# Use this as a sample for your .run images +# +# Variables to read (DO NOT SET THESE) +# $BASE - The location where runnix is mounted +# $ROOT - The location where your .run is mounted +# +# Variables to set + +# Kernel command line +# This is the command line runnix will pass to kexec +# for your linux kernel +# Like GRUB or any other bootloader, it can be any +# option that is valid for your linux kernel +# (kernel to be booted from your .run, most likely) +KCMD="root=/dev/ram0 rw init=/linuxrc astlinux=geni586 astimg=trunk.run astkd=/dev/sda1 astlive ide=nodma" + +# Offset for root filesystem +# If your filesystem is a hard disk image with a full +# partition table and traditional bootloader, you can +# have losetup skip past the bootloader and partition +# table to find a filesystem. "32256" will usually +# find the beginning of the first partition. +# If undefined, runnix will not use an offset (default) +# OFFSET="32256" + +# The location of the kernel runnix will boot +# Can be any path accesible by runnix +# If the kernel is in the runnix partition (rare), use $BASE +# If the kernel is inside the .run file, use $ROOT +KERN="$ROOT/boot/bzImage" + +# root fs type - can be anything supported by runnix kernel +# If undefined, runnix will try everything - NOT RECOMMENDED +FSTYPE="ext2" + +# The location of the initrd runnix will use with your $KERN +# Can be any path accesible by runnix +# If the initrd is in the runnix partition, use $BASE +# If the initrd is inside the .run file (rare), use $ROOT +INITRD="$BASE/os/initrd.img" Added: trunk/toolchain/runrelease/files/rootfs_vfat/syslinux.cfg =================================================================== --- trunk/toolchain/runrelease/files/rootfs_vfat/syslinux.cfg (rev 0) +++ trunk/toolchain/runrelease/files/rootfs_vfat/syslinux.cfg 2007-04-28 01:01:00 UTC (rev 56) @@ -0,0 +1,10 @@ +# serial 0 19200 +# console 1 +default runnix +timeout 5 +prompt 1 +display boot.msg + +label runnix + kernel runnix + append initrd=runnix.img root=/dev/ram0 rw init=/runnix runimg=auto rootdelay=10 Property changes on: trunk/toolchain/runrelease/files/rootfs_vfat/syslinux.cfg ___________________________________________________________________ Name: svn:executable + * Added: trunk/toolchain/runrelease/runrelease.mk =================================================================== --- trunk/toolchain/runrelease/runrelease.mk (rev 0) +++ trunk/toolchain/runrelease/runrelease.mk 2007-04-28 01:01:00 UTC (rev 56) @@ -0,0 +1,36 @@ +###################################################################### +# +# Make a release for Runnix +# +###################################################################### +RUNVER=$(shell cat target/generic/target_skeleton/etc/runnix-release) + +$(RUNVER): syslinux ext2root + mkdir -p $(RUNVER) + cp -a toolchain/runrelease/files/* $(RUNVER)/ + -find $(RUNVER) -type d -name .svn | xargs rm -rf + $(INSTALL) -D -m 0644 $(SYSLINUX_DIR)/mbr.bin $(RUNVER)/mbr.bin + $(INSTALL) -D -m 0755 $(SYSLINUX_DIR)/unix/syslinux $(RUNVER)/syslinux + $(INSTALL) -D -m 0644 $(LINUX_KERNEL) $(RUNVER)/rootfs_vfat/runnix + $(INSTALL) -D -m 0644 $(EXT2_TARGET) $(RUNVER)/rootfs_vfat/runnix.img + +runrelease: $(RUNVER) + +runrelease-source: + +runrelease-clean: + -rm -rf $(RUNVER) + +runrelease-dirclean: + -rm -rf $(RUNVER) + +runnix-config: runnix.config + cp runnix.config .config + +runnix: runnix-config oldconfig all runrelease + +############################################################# +# +# Toplevel Makefile options +# +############################################################# This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |