Re: FC4 CF-based Router

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Bob Chiodini wrote:

plain text document attachment (linuxrc)
#!/bin/busybox msh

# System config variables
SYSROOT=/sysroot
IMAGEDEV=/dev/sda2
IMAGENOD="3 2"
IMAGELOC=/dos
IMAGENAME=image.vhd
LOOPDEV=/dev/loop1
LOOPNOD="7 1"

# create the links /bin/busybox ln -s /bin/busybox /bin/ln

/bin/ln -s /bin/busybox /bin/chroot
/bin/ln -s /bin/busybox /bin/echo
/bin/ln -s /bin/busybox /bin/ls
/bin/ln -s /bin/busybox /bin/mount
/bin/ln -s /bin/busybox /bin/mknod
/bin/ln -s /bin/busybox /bin/mkdir
/bin/ln -s /bin/busybox /bin/msh

echo Creating the directories and links
/bin/mkdir /sys /dev /proc /sys $SYSROOT $IMAGELOC
/bin/mount -o mode=0755 -t tmpfs /dev /dev
/bin/ln -s /bin /sbin
/bin/mkdir /dev/pts /dev/shm

echo Loading the modules
/sbin/insmod /lib/loop.ko
/sbin/insmod /lib/jbd.ko
/sbin/insmod /lib/ext3.ko
/sbin/insmod /lib/fat.ko
/sbin/insmod /lib/vfat.ko

echo Creating device nodes
/bin/mknod $IMAGEDEV b $IMAGENOD
/bin/mknod $LOOPDEV b $LOOPNOD
/bin/mknod /dev/console c 5 1
/bin/mknod /dev/null c 1 3
/bin/mknod /dev/zero c 1 5

/bin/mount -tproc /proc /proc
/bin/mount -tsysfs /sys /sys
/bin/mount -tvfat $IMAGEDEV $IMAGELOC
/bin/mount -tiso9660 -oloop $IMAGELOC/$IMAGENAME $SYSROOT
/bin/mount -tproc /proc /$SYSROOT/proc

echo 0x0100 > /proc/sys/kernel/real-root-dev

echo Starting system
cd $SYSROOT

#chroot . /bin/sh -c "exec /sbin/init 3" chroot . /bin/bash

/bin/busybox msh


Steve,

The script seems inconsistent with the previous email:

       /dev/hda2 on /dos type vfat (rw,noatime, )
       /dev/loop0 on /sysroot type iso9660 (ro)
       /proc on /sysroot/proc type proc (rw,nodiratime)
/dev/hda2 hasn't been created, neither has /dev/loop0

Sorry for the confusion. I have been trying with two different drives. One is a USB key-fob thing, which comes up as a SCSI drive (sda), and the other is a CF card plugged into an IDE convertor (this comes up as hda). When I couldn't get the USB fob to work, I tried the CF card, since the IDE modules should already be in the kernel, and therefore should be slightly simpler.

Using the linuxrc script above, what happens if you cd /sysroot, then
run pivot_root . initrd?  /sysroot/initrd must exist.

Yes. It does. What happens is that it returns EINVAL, because it is a CPIO-style image, not a ramfs.

When linuxrc exits the kernel should run init.  Is busybox compiled for
x86_64 and statically linked?
Yes. I went so far as to go to the source and get the svn copy/build it. Ldd reports "not a dynamic executable" and file says ELF 64-bit LSB executable. That seemed to work a little better, though pivot_root/switch_root threw up on my shoes. I was able to get it to chroot into the target filesystem, though I cannot seem to run init.


Other than that,I'm at a loss.

Same here. I am about ready to redo the thing in Debian, as they seem to have slightly better support for stateless stuff. *Extremely* frustrating...

Maybe someone on the fedora-devel list might have some insight.


They have been quiet, so far.

Steve


[Index of Archives]     [Current Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]     [Fedora Docs]

  Powered by Linux