Jump to content

booten von USB


det-box

Empfohlene Beiträge

 

habe hier mal einen neuen Thread aufgemacht

 

bevor ich den "setenv" mache, mache ich ein "saveenv"

sichert die akt. Booteinstellung.

aber wohin?

was mache ch damit?

wie geht "das per "saveenv" zum default machen"?

 

Danke Euch

Link zu diesem Kommentar
Auf anderen Seiten teilen

  • Admin

@det-box

 

Umgekehrt. Zuerst "setenv", damit setzt Du die Booteinstellungen temporär (sind beim nächsten Booten

wieder auf Standard und es wird erneut ein Terminalprogramm benötigt). Machst Du nach "setenv" ein

"saveenv" (natürlich ohne vorher neu zu booten), werden diese temporären Einstellungen fest in den

Bootloader geschrieben und bleiben auch bei einem Neustart erhalten. Wird also in Zukunft die Datei

"linuxrc" im Root und ein angeschlossener USB-Stick gefunden, wird versucht, von dem zu booten. An-

derenfalls wird normal aus dem Flash gebootet. Ich schieb mal, da das nicht unbedingt im Fullmember-

bereich versteckt werden muss.

Link zu diesem Kommentar
Auf anderen Seiten teilen

habit ihr noch einen tip für die usb platte? die wird partout bei mir mit dieser methode nicht erkannt

im dbox2world gab es den tip mit mount /dev/sdb2 /mnt klappt aber leider nicht

edit:

p.s. platte hinten wird unter einstellungen als /dev/sdb angezeigt usb stick vorne ist /dev/sda1

 

bei normalen boot ist die platte /dev/sda und wird dann auch erkannt und unter /media/sda1 gemountet

wenn man nur einstellen könnte worauf der movieplayer und co zugreifen...

Link zu diesem Kommentar
Auf anderen Seiten teilen

hallo,

habe auch das mount problem mit selbst comp. Images.

 

Die Stick's und die HDD wird vom system erkannt aber nicht gemountet

 

es wurde vom Stick sda1 gebootet

im LOG ist:

sda1 = usb Stick von dem gebootet wurde (wird gemountet)

sdb1 = usb stick Daten (wird nicht autom. gemountet, manuell als /dev/sdb2 geht es)

sdc1 = SATA HDD (wird nicht gemountet, manuell als /dev/sdc2 geht es)

~ # mount
rootfs on / type rootfs (rw)
mtd2 on /oldroot type jffs2 (rw)
/dev/sda1 on / type ext3 (rw,errors=continue,data=ordered)
tmp on /dev type tmpfs (rw)
proc on /proc type proc (rw)
devpts on /dev/pts type devpts (rw,gid=5,mode=620)
tmpfs on /tmp type tmpfs (rw)
sysfs on /sys type sysfs (rw)
usb on /proc/bus/usb type usbfs (rw)
/dev/sda1 on /tmp/sda1 type ext3 (rw,errors=continue,data=ordered)

~ # fdisk /dev/sdb

Command (m for help): p

Disk /dev/sdb: 2063 MB, 2063597568 bytes
255 heads, 32 sectors/track, 493 cylinders
Units = cylinders of 8160 * 512 = 4177920 bytes

  Device Boot      Start         End      Blocks  Id System
/dev/sdb1   *           1         493     2011424   e Win95 FAT16 (LBA)

Command (m for help): q

~ # fdisk /dev/sdc

The number of cylinders for this disk is set to 121601.
There is nothing wrong with that, but this is larger than 1024,
and could in certain setups cause problems with:
1) software that runs at boot time (e.g., old versions of LILO)
2) booting and partitioning software from other OSs
  (e.g., DOS FDISK, OS/2 FDISK)

Command (m for help): p

Disk /dev/sdc: 1000.2 GB, 1000204886016 bytes
255 heads, 63 sectors/track, 121601 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

  Device Boot      Start         End      Blocks  Id System
/dev/sdc1               1      121601   976760032  83 Linux

Command (m for help): q

~ # mount /dev/sdb1 /tmp/sdb1/
mount: mounting /dev/sdb1 on /tmp/sdb1/ failed: Invalid argument
~ # mount /dev/sdb2 /tmp/sdb1/
~ # mount /dev/sdc1 /tmp/sdc1/
mount: mounting /dev/sdc1 on /tmp/sdc1/ failed: Invalid argument
~ # mount /dev/sdc2 /tmp/sdc1/

~ # mount
rootfs on / type rootfs (rw)
mtd2 on /oldroot type jffs2 (rw)
/dev/sda1 on / type ext3 (rw,errors=continue,data=ordered)
tmp on /dev type tmpfs (rw)
proc on /proc type proc (rw)
devpts on /dev/pts type devpts (rw,gid=5,mode=620)
tmpfs on /tmp type tmpfs (rw)
sysfs on /sys type sysfs (rw)
usb on /proc/bus/usb type usbfs (rw)
/dev/sda1 on /tmp/sda1 type ext3 (rw,errors=continue,data=ordered)
/dev/sdb2 on /tmp/sdb1 type ext2 (rw,errors=continue)
/dev/sdc2 on /tmp/sdc1 type ext3 (rw,errors=continue,data=ordered)
~ #

 

 

nach dem flashen des selbst.comp Image direkt auf die Cooli, ist es das selbe.

sda1 = usb stick Daten (wird autom. gemountet)

sdb1 = SATA HDD (wird nicht gemountet, manuell als /dev/sdb2 geht es)

 

manuelles

# mount /dev/sdb2 /tmp/sdb1/
# mkdir /tmp/sdc1
# mount /dev/sdc2 /tmp/sdc1/

geht zumindest bei mir

Link zu diesem Kommentar
Auf anderen Seiten teilen

vielen dank werde es gleich heute abend ausprobieren!

 

was ich logisch nicht verstehe ist /dev/sdb2 bzw. /dev/sdc2

das wäre ja eine zweite partition auf der platte bzw. dem stick

obwohl beide nur eine partition (/dev/sdb1 und /dev/sdc1) haben

 

da, sind wir schon mind. 2 :blink:

 

hoffe wir finden einen, der es versteht und evtl. sogar beheben kann

Link zu diesem Kommentar
Auf anderen Seiten teilen

  • Admin

Warum die Festplatte zwei Partitionen hat, weiß ich auch nicht. Aber mit folgender fstab

(auch im neuen RootFS des Beta-Images enthalten) wird alles an den richtigen Platz

gemountet:

 

# /etc/fstab: static file system information.
#
# <file system> <mount pt> 	<type>	<options> 	<dump> <pass>
proc		/proc 	proc 	defaults 0 0
devpts		/dev/pts 	devpts defaults,gid=5,mode=620 0 0
tmpfs 	/tmp 	tmpfs	defaults 	0 	0
sysfs 	/sys 	sysfs	defaults 	0 	0
/dev/sda1 	/media/sdb1 	auto	defaults 	0 	0
/dev/sdb2 	/media/sda1 	auto	defaults 	0 	0

Diese Datei aber nicht in ein Image packen! Das geht schief.

Link zu diesem Kommentar
Auf anderen Seiten teilen

  • Admin

@sb206

 

Das sollte mit der beschriebenen fstab eigentlich auch bei der internen HDD funktionieren.

 

 

@det-box

 

Da Du gleich zwei USB-Sticks stecken hast (oder einen mit zwei Partitionen), wird die Platte

als hdc erkannt. Probiere mal diese fstab auf dem Stick:

 

# /etc/fstab: static file system information.
#
# <file system> <mount pt> <type> <options> <dump> <pass>
proc /proc proc defaults 0 0
devpts /dev/pts devpts defaults,gid=5,mode=620 0 0
tmpfs /tmp tmpfs defaults 0 0
sysfs /sys sysfs defaults 0 0
/dev/sda1 /media/sdb1 auto defaults 0 0
/dev/sdb2 /media/sdc1 auto defaults 0 0
/dev/hdc1 /media/sda1 auto defaults 0 0

Damit solltest Du dann folgende Anordnung bekommen:

 

/media/sda1 -> Festplatte

/media/sdb1 -> Boot-Stick

/media/sdc1 -> Daten-Stick

Link zu diesem Kommentar
Auf anderen Seiten teilen

ja,

werde ich morgen testen

(aber /dev/hdc1 geht nicht und /tmp/hdc1 muss erst manuell angelegt werden)

 

im org.Image ist es hdc1 in selber compii. Image ist Partition ebenfals nur über hdc2 ansprechbar

also, dann so:

# /etc/fstab: static file system information.
#
# <file system> <mount pt> <type> <options> <dump> <pass>
proc /proc proc defaults 0 0
devpts /dev/pts devpts defaults,gid=5,mode=620 0 0
tmpfs /tmp tmpfs defaults 0 0
sysfs /sys sysfs defaults 0 0
usb /proc/bus/usb usbfs defaults 0  0 
/dev/sda1 /media/sdb1 auto defaults 0 0
/dev/sdb2 /media/sdc1 auto defaults 0 0
/dev/hdc2 /media/sda1 auto defaults 0 0

 

 

im "db2w" forum kahm zudiesem Problem gerade,

das hat Seife schon mal irgendwo ganz am Anfang geschrieben.

Im org. Image wird das anders gemacht, da ist das /dev Verzeichnis von Hause aus nicht leer.

 

habe aber seife's text noch nicht gefunden

 

Danke

Link zu diesem Kommentar
Auf anderen Seiten teilen

Hallo,

mit dieser "linuxrc" bootet das System auch von "/dev/sdb1":

(zumindest bei mir"

 

#!/bin/sh
#
# /linuxrc script for USB booting
#
# (C) 2009 Stefan Seyfried, License: GPL V2
#
# this is a hack for booting the coolstream HD1 from USB
# put this script into the original root fs as /linuxrc,
# chmod it to 0755 and add "init=/linuxrc" to the bootargs of
# U-Boot
#
# the usb stick should have an "/oldroot" directory, so you
# can unmount the jffs2 "old" root later.
#
e="/bin/echo linuxrc:"

$e "***** linuxrc ******"
/bin/mkdir -p /tmp/newroot

$e mounting sda1...

if ! /bin/mount -n /dev/sda1 /tmp/newroot; then
if ! /bin/mount -n /dev/sdb1 /tmp/newroot; then
	$e "mount failed, doing normal init. Goodbye!"
	exec /sbin/init
  	fi
fi

if /bin/test -e /tmp/newroot/sbin/pivot_root; then
$e "using pivot_root to enter new root"
cd /tmp/newroot
sbin/pivot_root . oldroot
bin/mknod dev/console c 5 1
exec sbin/chroot . sbin/init < dev/console > dev/console 2>&1
fi

$e "no /sbin/pivot_root on sda1, trying normal chroot"

if /bin/test -x /tmp/newroot/sbin/init; then
exec /sbin/chroot /tmp/newroot /sbin/init
fi

$e "no /sbin/init on sda1, booting from flash."
exec /sbin/init 

 

Viel Spass :blink:

Link zu diesem Kommentar
Auf anderen Seiten teilen

  • 5 weeks later...

Hallo,

hier eine aktualisierte Version,

auf Basis von diesem Script (von LittleBoy)

 

mount_rootfs()

{

for i in /dev/sd??; do

if /bin/mount -n $i /tmp/newroot; then

if /bin/test -e /tmp/newroot/.is_rootfs; then

return

fi;

/bin/umount /tmp/newroot

fi

done

echo "No rootfs found"

}

 

 

habe ich obiges "linuxrc" angepasst.

 

Es sollte jetzt jedes angesteckte USB-Gerät finden, mounten und testen ob es ein System enthält.

 

Ich benutze es seit geraumer Zeit ohne Probleme:

(Da das Device des BootStick's sich manchmal ändert von sda1 auf sdb1 oder sdb2, bei angestecktem 2.

USB Stick und 1x eSATA HDD an der Cooli)

 

#!/bin/sh

#

# /linuxrc script for USB booting

#

# © 2009 Stefan Seyfried, License: GPL V2

#

# this is a hack for booting the coolstream HD1 from USB

# put this script into the original root fs as /linuxrc,

# chmod it to 0755 and add "init=/linuxrc" to the bootargs of

# U-Boot

#

# the usb stick should have an "/oldroot" directory, so you

# can unmount the jffs2 "old" root later.

#

e="/bin/echo linuxrc:"

 

$e "***** linuxrc ******"

/bin/mkdir -p /tmp/newroot

 

for i in /dev/sd??; do

$e "+++++ mounting $i... +++++"

if /bin/mount -n $i /tmp/newroot; then

/bin/sleep 2

if /bin/test -e /tmp/newroot/sbin/pivot_root; then

$e "+++ using pivot_root to enter new root +++"

$e "******************************************"

cd /tmp/newroot

sbin/pivot_root . oldroot

bin/mknod dev/console c 5 1

exec sbin/chroot . sbin/init < dev/console > dev/console 2>&1

fi

 

$e "++++ no /sbin/pivot_root on $i, trying normal chroot ++++"

$e "***********************************************************"

 

if /bin/test -x /tmp/newroot/sbin/init; then

$e "++++++++++++ run System from $i ++++++++++++"

$e "********************************************"

exec /sbin/chroot /tmp/newroot /sbin/init

fi

fi

/bin/umount /tmp/newroot

done

 

/bin/rmdir /tmp/newroot

 

$e "*************************************************"

$e "+++ mount failed, doing normal init. Goodbye! +++"

$e "*************************************************"

exec /sbin/init

 

 

 

es wird von "/dev/sda1" bis "/dev/sdh9" nach einem Device gescannt

Link zu diesem Kommentar
Auf anderen Seiten teilen

Hallo,

hier eine aktualisierte Version,

auf Basis von diesem Script (von LittleBoy)

 

mount_rootfs()
{
  for i in /dev/sd??; do
 	if /bin/mount -n $i /tmp/newroot; then
     	if /bin/test -e /tmp/newroot/.is_rootfs; then
         	return
     	fi;
     	/bin/umount /tmp/newroot
 	fi
  done
  echo "No rootfs found"
}

 

habe ich obiges "linuxrc" angepasst.

 

Es sollte jetzt jedes angesteckte USB-Gerät finden, mounten und testen ob es ein System enthält.

 

Ich benutze es seit geraumer Zeit ohne Probleme:

(Da das Device des BootStick's sich manchmal ändert von sda1 auf sdb1 oder sdb2, bei angestecktem 2.

USB Stick und 1x eSATA HDD an der Cooli)

 

#!/bin/sh
#
# /linuxrc script for USB booting
#
# (C) 2009 Stefan Seyfried, License: GPL V2
#
# this is a hack for booting the coolstream HD1 from USB
# put this script into the original root fs as /linuxrc,
# chmod it to 0755 and add "init=/linuxrc" to the bootargs of
# U-Boot
#
# the usb stick should have an "/oldroot" directory, so you
# can unmount the jffs2 "old" root later.
#
e="/bin/echo linuxrc:"

$e "***** linuxrc ******"
/bin/mkdir -p /tmp/newroot

for i in /dev/sd??; do
	$e "+++++ mounting $i... +++++"
	if /bin/mount -n $i /tmp/newroot; then
		/bin/sleep 2
		if /bin/test -e /tmp/newroot/sbin/pivot_root; then
			$e "+++ using pivot_root to enter new root +++"
			$e "******************************************"
			cd /tmp/newroot
			sbin/pivot_root . oldroot
			bin/mknod dev/console c 5 1
			exec sbin/chroot . sbin/init < dev/console > dev/console 2>&1
		fi

		$e "++++ no /sbin/pivot_root on $i, trying normal chroot ++++"
		$e "***********************************************************"

		if /bin/test -x /tmp/newroot/sbin/init; then
			$e "++++++++++++ run System from $i ++++++++++++"
			$e "********************************************"
			exec /sbin/chroot /tmp/newroot /sbin/init
		fi
	fi
	/bin/umount /tmp/newroot
done

/bin/rmdir /tmp/newroot

$e "*************************************************"
$e "+++ mount failed, doing normal init. Goodbye! +++"
$e "*************************************************"
exec /sbin/init

 

 

es wird von "/dev/sda1" bis "/dev/sdh9" nach einem Device gescannt

Link zu diesem Kommentar
Auf anderen Seiten teilen

Archiviert

Dieses Thema ist jetzt archiviert und für weitere Antworten gesperrt.

  • Wer ist Online   0 Benutzer

    • Keine registrierten Benutzer online.
×
×
  • Neu erstellen...