New IT forum
20 November 2018, 04:16:15 pm *
Welcome, %1$s. Please login or register.

: PiHub now in stock.
 
Pages: [1] 2

Author Topic: U-Boot environment variables for Sheevaplug multi-boot version  (Read 47646 times)

NewIT_Marcus

  • Hero Member
  • *****
  • Posts: 960
U-Boot environment variables for Sheevaplug multi-boot version
« on: 09 December 2009, 10:48:56 pm »

Bootlog for multi-boot, customised NewIT SheevaPlug

Sold from 2009-12-09 - now

U-Boot version 3.4.23 (this is an upgrade from the SD-boot and UBIFS configurations)

Ubuntu with 2.6.30.2 kernel.

U-Boot code:

Code: [Select]
        __  __                      _ _
        |  \/  | __ _ _ ____   _____| | |
        | |\/| |/ _` | '__\ \ / / _ \ | |
        | |  | | (_| | |   \ V /  __/ | |
        |_|  |_|\__,_|_|    \_/ \___|_|_|
 _   _     ____              _
| | | |   | __ )  ___   ___ | |_
| | | |___|  _ \ / _ \ / _ \| __|
| |_| |___| |_) | (_) | (_) | |_
 \___/    |____/ \___/ \___/ \__|
 ** MARVELL BOARD: SHEEVA PLUG LE

U-Boot 1.1.4 (Nov  4 2009 - 12:58:36) Marvell version: 3.4.23

U-Boot code: 00600000 -> 0067FFF0  BSS: -> 006CFB00

Soc: 88F6281 A0 (DDR2)
CPU running @ 1200Mhz L2 running @ 400Mhz
SysClock = 400Mhz , TClock = 200Mhz

DRAM CAS Latency = 5 tRP = 5 tRAS = 18 tRCD=6
DRAM CS[0] base 0x00000000   size 256MB
DRAM CS[1] base 0x10000000   size 256MB
DRAM Total size 512MB  16bit width
Addresses 8M - 0M are saved for the U-Boot usage.
Mem malloc Initialization (8M - 7M): Done
NAND:512 MB
Flash:  0 kB

CPU : Marvell Feroceon (Rev 1)

Streaming disabled
Write allocate disabled


USB 0: host mode
PEX 0: interface detected no Link.
Net:   egiga0 [PRIME]
Hit any key to stop autoboot:  0

If there is no suitably configured SD card present, U-Boot will spew messages such as the following, for approximately 2 seconds:

Code: [Select]
Error! cmd : 8, err : 0201
Error! cmd : 55, err : 0201
Error! cmd : 41, err : 0201
Error! cmd : 55, err : 0201
Error! cmd : 41, err : 0201
Error! cmd : 55, err : 0201
Error! cmd : 41, err : 0201
Error! cmd : 55, err : 0201
Error! cmd : 41, err : 0201
Error! cmd : 55, err : 0201
Error! cmd : 41, err : 0201
Error! cmd : 55, err : 0201
Error! cmd : 41, err : 0201
Error! cmd : 55, err : 0201
Error! cmd : 41, err : 0201
Error! cmd : 55, err : 0201
Error! cmd : 41, err : 0201
Error! cmd : 55, err : 0201
Error! cmd : 41, err : 0201
Error! cmd : 55, err : 0201
Error! cmd : 41, err : 0201
Error! cmd : 1, err : 0201
Error! cmd : 1, err : 0201
Error! cmd : 1, err : 0201
Error! cmd : 1, err : 0201
Error! cmd : 1, err : 0201
Error! cmd : 1, err : 0201
Error! cmd : 1, err : 0201
Error! cmd : 1, err : 0201
Error! cmd : 1, err : 0201
Error! cmd : 1, err : 0201
No MMC card found
** Bad partition 1 **
## Booting image at 00800000 ...
Bad Magic Number

From this point, a normal NAND boot may proceed.

U-Boot environment variables (ethaddr is partially obfuscated):

Marvell>> printenv

Code: [Select]
baudrate=115200
loads_echo=0
ipaddr=10.4.50.165
serverip=10.4.50.5
rootpath=/mnt/ARM_FS/
netmask=255.255.255.0
console=console=ttyS0,115200 mtdparts=nand_mtd:0xc0000@0(uboot)ro,0x1ff00000@0x100000(root)
CASset=min
MALLOC_len=1
ethprime=egiga0
bootargs_end=:::DB88FXX81:eth0:none
image_name=uImage
standalone=fsload 0x2000000 $(image_name);setenv bootargs $(console) root=/dev/mtdblock0 rw ip=$(ipaddr):$(serverip)$(bootargs_end) $(mvPhoneConfig); bootm 0x2000000;
ethmtu=1500
mvPhoneConfig=mv_phone_config=dev0:fxs,dev1:fxs
mvNetConfig=mv_net_config=(00:11:88:0f:62:81,0:1:2:3),mtu=1500
usb0Mode=host
yuk_ethaddr=00:00:00:EE:51:81
nandEcc=1bit
netretry=no
rcvrip=169.254.100.100
loadaddr=0x02000000
autoload=no
ethact=egiga0
bootargs_root=ubi.mtd=1 root=ubi0:rootfs rootfstype=ubifs
mtdpartitions=mtdparts=orion_nand:0x400000@0x100000(uImage),0x1fb00000@0x500000(rootfs)
ethaddr=00:50:43:01:xx:xx
bootargs_console=console=ttyS0,115200
recover1=setenv mainlineLinux yes; setenv arcNumber 2097; setenv bootcmd run recover2; saveenv; reset
recover2=run recover3; setenv bootcmd $(real_bootcmd); saveenv; setenv bootargs $(bootargs_console) $(mtdpartitions) root=/dev/ram0 rw ramdisk=0x01100000,8M install_type=nand; bootm 0x00800000 0x01100000
recover3=run recover4; nand erase clean 0x00100000 0x00400000; nand write.e 0x00800000 0x00100000 0x00400000
recover4=usb start; fatload usb 0 0x00800000 uImage; fatload usb 0 0x01100000 initrd
bootargs_root_nand=ubi.mtd=1 root=ubi0:rootfs rootfstype=ubifs
bootcmd_nand=setenv bootargs $(bootargs_console) $(mtdpartitions) $(bootargs_root_nand); nand read.e 0x00800000 0x00100000 0x00400000; bootm 0x00800000
bootargs_root_mmc=root=/dev/mmcblk0p2 rootdelay=5
bootcmd_mmc=setenv bootargs $(bootargs_console) $(bootargs_root_mmc); mmcinit; ext2load mmc 0:1 0x800000 /uImage; bootm 0x00800000
real_bootcmd=run bootcmd_mmc; run bootcmd_nand
arcNumber=2097
filesize=32D62A
bootcmd=run bootcmd_mmc; run bootcmd_nand
stdin=serial
stdout=serial
stderr=serial
nandEnvBase=a0000
mainlineLinux=yes
enaMonExt=no
enaCpuStream=no
enaWrAllo=no
pexMode=RC
disL2Cache=no
setL2CacheWT=yes
disL2Prefetch=yes
enaICPref=yes
enaDCPref=yes
sata_dma_mode=yes
netbsd_en=no
vxworks_en=no
bootdelay=3
disaMvPnp=no
enaAutoRecovery=yes
pcieTune=no


sorted environment variables (ethaddr is partially obfuscated):

Code: [Select]
arcNumber=2097
autoload=no
baudrate=115200
bootargs_console=console=ttyS0,115200
bootargs_end=:::DB88FXX81:eth0:none
bootargs_root_mmc=root=/dev/mmcblk0p2 rootdelay=5
bootargs_root_nand=ubi.mtd=1 root=ubi0:rootfs rootfstype=ubifs
bootargs_root=ubi.mtd=1 root=ubi0:rootfs rootfstype=ubifs
bootcmd_mmc=setenv bootargs $(bootargs_console) $(bootargs_root_mmc); mmcinit; ext2load mmc 0:1 0x800000 /uImage; bootm 0x00800000
bootcmd_nand=setenv bootargs $(bootargs_console) $(mtdpartitions) $(bootargs_root_nand); nand read.e 0x00800000 0x00100000 0x00400000; bootm 0x00800000
bootcmd=run bootcmd_mmc; run bootcmd_nand
bootdelay=3
CASset=min
console=console=ttyS0,115200 mtdparts=nand_mtd:0xc0000@0(uboot)ro,0x1ff00000@0x100000(root)
disaMvPnp=no
disL2Cache=no
disL2Prefetch=yes
enaAutoRecovery=yes
enaCpuStream=no
enaDCPref=yes
enaICPref=yes
enaMonExt=no
enaWrAllo=no
ethact=egiga0
ethaddr=00:50:43:01:xx:xx
ethmtu=1500
ethprime=egiga0
filesize=32D62A
image_name=uImage
ipaddr=10.4.50.165
loadaddr=0x02000000
loads_echo=0
mainlineLinux=yes
MALLOC_len=1
mtdpartitions=mtdparts=orion_nand:0x400000@0x100000(uImage),0x1fb00000@0x500000(rootfs)
mvNetConfig=mv_net_config=(00:11:88:0f:62:81,0:1:2:3),mtu=1500
mvPhoneConfig=mv_phone_config=dev0:fxs,dev1:fxs
nandEcc=1bit
nandEnvBase=a0000
netbsd_en=no
netmask=255.255.255.0
netretry=no
pcieTune=no
pexMode=RC
rcvrip=169.254.100.100
real_bootcmd=run bootcmd_mmc; run bootcmd_nand
recover1=setenv mainlineLinux yes; setenv arcNumber 2097; setenv bootcmd run recover2; saveenv; reset
recover2=run recover3; setenv bootcmd $(real_bootcmd); saveenv; setenv bootargs $(bootargs_console) $(mtdpartitions) root=/dev/ram0 rw ramdisk=0x01100000,8M install_type=nand; bootm 0x00800000 0x01100000
recover3=run recover4; nand erase clean 0x00100000 0x00400000; nand write.e 0x00800000 0x00100000 0x00400000
recover4=usb start; fatload usb 0 0x00800000 uImage; fatload usb 0 0x01100000 initrd
rootpath=/mnt/ARM_FS/
sata_dma_mode=yes
serverip=10.4.50.5
setL2CacheWT=yes
standalone=fsload 0x2000000 $(image_name);setenv bootargs $(console) root=/dev/mtdblock0 rw ip=$(ipaddr):$(serverip)$(bootargs_end) $(mvPhoneConfig); bootm 0x2000000;
stderr=serial
stdin=serial
stdout=serial
usb0Mode=host
vxworks_en=no
yuk_ethaddr=00:00:00:EE:51:81

Differences between factory config and mult-boot config:

factory:
Code: [Select]
bootargs=console=ttyS0,115200 mtdparts=nand_mtd:0x400000@0x100000(uImage),0x1fb00000@0x500000(rootfs) rw root=/dev/mtdblock1 rw ip=10.4.50.4:10.4.50.5:10.4.50.5:255.255.255.0:DB88FXX81:eth0:none
bootargs_root=root=/dev/mtdblock2 ro
bootcmd=nand read.e 0x800000 0x100000 0x400000; bootm 0x800000
cesvcid=ULULULULULULPPULULULULULDA
console=console=ttyS0,115200
mainlineLinux=no
run_diag=no


multi-boot:
Code: [Select]
arcNumber=2097
bootargs_console=console=ttyS0,115200
bootargs_root_mmc=root=/dev/mmcblk0p2 rootdelay=5
bootargs_root_nand=ubi.mtd=1 root=ubi0:rootfs rootfstype=ubifs
bootargs_root=ubi.mtd=1 root=ubi0:rootfs rootfstype=ubifs
bootcmd_mmc=setenv bootargs $(bootargs_console) $(bootargs_root_mmc); mmcinit; ext2load mmc 0:1 0x800000 /uImage; bootm 0x00800000
bootcmd_nand=setenv bootargs $(bootargs_console) $(mtdpartitions) $(bootargs_root_nand); nand read.e 0x00800000 0x00100000 0x00400000; bootm 0x00800000
bootcmd=run bootcmd_mmc; run bootcmd_nand
console=console=ttyS0,115200 mtdparts=nand_mtd:0xc0000@0(uboot)ro,0x1ff00000@0x100000(root)
filesize=32D62A
mainlineLinux=yes
mtdpartitions=mtdparts=orion_nand:0x400000@0x100000(uImage),0x1fb00000@0x500000(rootfs)
nandEnvBase=a0000
pcieTune=no
real_bootcmd=run bootcmd_mmc; run bootcmd_nand
recover1=setenv mainlineLinux yes; setenv arcNumber 2097; setenv bootcmd run recover2; saveenv; reset
recover2=run recover3; setenv bootcmd $(real_bootcmd); saveenv; setenv bootargs $(bootargs_console) $(mtdpartitions) root=/dev/ram0 rw ramdisk=0x01100000,8M install_type=nand; bootm 0x00800000 0x01100000
recover3=run recover4; nand erase clean 0x00100000 0x00400000; nand write.e 0x00800000 0x00100000 0x00400000
recover4=usb start; fatload usb 0 0x00800000 uImage; fatload usb 0 0x01100000 initrd


The SD card must be prepared with 2 partitions; the first with the kernal, as uImage, and the second with the root file system. This is the standard method used by the plugcomputer.org installer. Other methods of booting from SD card are possible; note for instance that the Meteohub bootable SD cards require different environment variables.

How does this work?

There are versions of the key U-Boot environment variables (bootargs and bootcmd) that are configured for "regular" SD card booting, and other variables configured for NAND (UBIFS) booting. These variables are named:

  • bootargs_mmc
  • bootargs_nand
  • bootcmd_mmc
  • bootcmd_nand

The actual bootcmd that is used is run bootcmd_mmc; run bootcmd_nand; i.e. first of all the plug attempts to boot from SD card, and if this fails, it boots from the internal NAND.

The recover1/2/3/4 variables are used during the preparation of the configuration, and are not required after configuration is complete. They could be safely removed, but can also be useful for recovering a part-configured plug.

Therefore:

  • You can use this configuration without an SD card and gain the benefits of fast-booting (UBIFS) Ubuntu on the internal NAND memory
  • You can create a collection of SD cards with different configurations, for instance one with Ubuntu, another with debian lenny, another with debian squeeze.
  • You can create a snapshot / backup of your bootable SD card by booting from NAND, and copying the SD contents to a USB or network device.

We like this multi-boot configuration for all these reasons, and as of 2009-12-09, we are replacing our old SD-only and UBIFS-only configurations with this version.

You may:

  • Modify this multi-boot configuration to ignore the SD card, if you prefer never to boot from SD card
  • Modify your previously-purchased SD-booting configuration using techniques similar to those listed in this article, in order to change your system into a multi-boot configuration. Note that the environment variables for NAND booting here are for a UBIFS file system in NAND, and are not suitable for the original / factory file system. We'll work out and publicise some instructions that are appropriate to this task.
  • Modify your previously-purchased UBIFS configuration to optionally boot from a suitably formatted SD card, by applying the necessary changes to the environment variables listed above.


See also:


Logged

NewIT_Marcus

  • Hero Member
  • *****
  • Posts: 960
Re: U-Boot environment variables for Sheevaplug multi-boot version
« Reply #1 on: 11 December 2009, 07:19:47 pm »

This is our procedure for preparing Multi-Boot Sheevaplugs.

  • Use the plugcomputer.org installer to configure a plug to boot from SD card (with "mmc" parameter).
  • Use the installer again (and again) to prepare alternate versions of the SD card - i.e. with Ubuntu / Debian lenny / Debian squeeze (I'm still working on Fedora).
  • Use the installer to reconfigure a plug with UBIFS on the internal NAND (for faster booting). For this step we use an amended version of the uboot-nand-custom.txt configuration file (see below). The U-boot parameters specified in this configuration file allow for multi-booting, first from SD card, and if this is not available, from NAND.

Now you have a SheevaPlug that will boot from a suitably-formatted SD card, if one is present, or the internal NAND if no such SD card is found. You may also have one or more SD cards, with one or more different operating systems or configurations.

Once these steps have been completed you can then:

  • Remove SD card; boot from NAND.
  • Mount USB stick and insert bootable SD card
  • dd if=/mmcblk0 of=/mnt/my-usb-stick/my-sd-image.img
  • Wait. The completion message for dd will indicate the number of bytes copied and the transfer speed.
  • Upon completion, remove SD card and insert a new (blank) SD card
  • dd if=/mnt/my-usb-stick/my-sd-image.img of=/mmcblk0

Thereby cloning the bootable SD card.

In other words, if one prefers to boot from SD card, this configuration now allows for that SD card to be cloned / backed-up by the same plug, simply by not booting from the SD card. Furthermore, many different SD cards may be created, if you have prepared suitable rootfs's. We've created debian lenny, debian squeeze, and the original Ubuntu flavours so far.

There are other methods of copying the contents of the SD card; dd is a very blunt instrument to use but it's useful for us, when we are duplicating a significant quantity of identical cards. Hopefully one of us will describe at least one alternative method when time permits.

Here's the amended version of uboot-nand-custom.txt (actually mine is named uboot-dual-custom.txt and I use a slightly modified version of runme.php, but it's simpler if we just consider this file as a branch of uboot-nand-custom.txt. MAC address is, as usual, partly obfuscated - and it is the one element that you definitely should change in your own version of this file).

Code: [Select]
#### Change ONLY in the following few lines

# Following for installation on SD card. If you want to boot from USB stick change it to /dev/sda1
# or /dev/mtdblock1 if you installed rootfs on the NAND inside the plug
bootargs_root ubi.mtd=1 root=ubi0:rootfs rootfstype=ubifs

# NAND flash partitions. If using kernel >= 2.6.30 then replace orion_nand with orion_mtd
mtdpartitions mtdparts=orion_nand:0x400000@0x100000(uImage),0x1fb00000@0x500000(rootfs)

# The following is an example MAC address. Change it according the MAC on the back side of the plug
ethaddr 00:50:43:01:xx:xx

#### DONT change the following.
# Automated process the sets arcNumer to 2097, reset, runs uImage and initrd from USB stick and set bootcmd to 'real_bootcmd' above
# Bootcmd to be used after all installation is done
# New IT commented out 2009-11-18 real_bootcmd setenv bootargs $(bootargs_console) $(mtdpartitions) $(bootargs_root); nand read.e 0x00800000 0x00100000 0x00400000; bootm 0x00800000

bootargs_console console=ttyS0,115200
bootcmd run recover1
recover1 setenv mainlineLinux yes; setenv arcNumber 2097; setenv bootcmd run recover2; saveenv; reset
recover2 run recover3; setenv bootcmd $(real_bootcmd); saveenv; setenv bootargs $(bootargs_console) $(mtdpartitions) root=/dev/ram0 rw ramdisk=0x01100000,8M install_type=nand; bootm 0x00800000 0x01100000
recover3 run recover4; nand erase clean 0x00100000 0x00400000; nand write.e 0x00800000 0x00100000 0x00400000
recover4 usb start; fatload usb 0 0x00800000 uImage; fatload usb 0 0x01100000 initrd

# New IT added 2009-11-18
bootargs_root_nand ubi.mtd=1 root=ubi0:rootfs rootfstype=ubifs
bootcmd_nand setenv bootargs $(bootargs_console) $(mtdpartitions) $(bootargs_root_nand); nand read.e 0x00800000 0x00100000 0x00400000; bootm 0x00800000
bootargs_root_mmc root=/dev/mmcblk0p2 rootdelay=5
bootcmd_mmc setenv bootargs $(bootargs_console) $(bootargs_root_mmc); mmcinit; ext2load mmc 0:1 0x800000 /uImage; bootm 0x00800000
real_bootcmd run bootcmd_mmc; run bootcmd_nand
Logged

raj123

  • Newbie
  • *
  • Posts: 33
Re: U-Boot environment variables for Sheevaplug multi-boot version
« Reply #2 on: 01 January 2010, 03:09:06 am »

Hi,

I wanted to make my plug to multi-boot, now it boots it only with nand or sd card based on how I run the installer. If I understand correctly, it seems like you have modified the uboot-nand-custom file. If I just copy and Paste (modify mac address) your file into mine,will it work? or should I be aware of anything else. Please let me know.

Thanks,
Raj
Logged

NewIT_Marcus

  • Hero Member
  • *****
  • Posts: 960
Re: U-Boot environment variables for Sheevaplug multi-boot version
« Reply #3 on: 01 January 2010, 11:43:50 pm »

Yes. Copy our "multi-boot code" to uboot-nand-custom.txt.

You'll need to run the installer with an SD card target at least once in order to create a suitable bootable SD card (or use an alternative manual method; installer is easiest).
Logged

drbob49

  • Newbie
  • *
  • Posts: 7
Re: U-Boot environment variables for Sheevaplug multi-boot version
« Reply #4 on: 02 January 2010, 11:23:36 am »

Hi,

Done more-or-less what you have written above and have now got working multi-boot system based on Debian squeeze, starting from the original as-supplied version.  Thanks for the support and the effort put into the documentation - we certainly seem better served this side of the Atlantic than in the US.

One query, rather than copying your environment file into the installer custom.txt, I modified the environment line by line using the setenv command - bit tedious but I had already set the plug up and didn't want to lose the work I'd already done on the Debian install.  I understand the recover 1, 2 etc statements are not really necessary in a working system, but when I tried to enter them I got a 'Max Args 16' error message for the recover2 line. It accepted most of the line but chopped off the last part.  To avoid this, without having to go through a complete install is it possible to just load in a new set of environment variables from a custom.txt file?

TIA

Logged

NewIT_Marcus

  • Hero Member
  • *****
  • Posts: 960
Re: U-Boot environment variables for Sheevaplug multi-boot version
« Reply #5 on: 02 January 2010, 01:20:57 pm »

When you get the max 16 arguments error, you should be able to split the command up:

setenv my-env-var 'too many arguments'

Use instead:

setenv my-env-var '$(arguments-part1) $(arguments-part-2)'


(of course you'll need to do setenv arguments-part1 'argument1 argument2 argument3' etc first). Each space character is interpreted as a separator between arguments, if this helps understand why the error occurs. And I think that openocd can set the environment variables without this restriction: presumably there is a way to use it to change just the env vars, but I haven't looked into that at this time.
Logged

drbob49

  • Newbie
  • *
  • Posts: 7
Re: U-Boot environment variables for Sheevaplug multi-boot version
« Reply #6 on: 03 January 2010, 03:45:49 pm »

Thanks for the reply.  I thought it was possible to get round the 'max arguments' error by splitting the line, but was keen to get on with trying out the multi-boot!

Logged

truehl

  • Jr. Member
  • **
  • Posts: 58
Setting the recover2 varibale
« Reply #7 on: 26 February 2010, 11:48:50 am »

Hi,
I've still problems to set the recover2 variable. Does it look like this???

Code: [Select]
setenv recover2p1 'run recover3; setenv bootcmd $(real_bootcmd); saveenv;'
setenv recover2p2 'setenv bootargs $(bootargs_console) $(mtdpartitions) root=/dev/ram0 rw ramdisk=0x01100000,8M install_type=nand; bootm 0x00800000 0x01100000'
setenv recover2 '$(recover2p1) $(recover2p2)'

Thanks a lot,
Greetings Thomas
Logged

NewIT_Marcus

  • Hero Member
  • *****
  • Posts: 960
Re: U-Boot environment variables for Sheevaplug multi-boot version
« Reply #8 on: 26 February 2010, 05:58:56 pm »

The recover2 variable is only needed temporarily during the installer upgrade process. Once the plug has been upgraded, none of the recoverX variables is required any more.
Logged

truehl

  • Jr. Member
  • **
  • Posts: 58
Re: U-Boot environment variables for Sheevaplug multi-boot version
« Reply #9 on: 03 March 2010, 09:12:28 am »

Marcus:
Quote
In the thread you wrote: "Note that the environment variables for NAND booting here are for a UBIFS file system in NAND, and are not suitable for the original / factory file system. We'll work out and publicise some instructions that are appropriate to this task."
So it means that I can't use the settings for a non UBIFS Nand System (the NAND) won't boot i think.
Do you have a solution for muli-boot without UBIFS?

Thanks a lot,
Greetings Thomas
Logged

NewIT_Marcus

  • Hero Member
  • *****
  • Posts: 960
Re: U-Boot environment variables for Sheevaplug multi-boot version
« Reply #10 on: 03 March 2010, 06:01:01 pm »

Marcus:
Quote
In the thread you wrote: "Note that the environment variables for NAND booting here are for a UBIFS file system in NAND, and are not suitable for the original / factory file system. We'll work out and publicise some instructions that are appropriate to this task."
So it means that I can't use the settings for a non UBIFS Nand System (the NAND) won't boot i think.
Do you have a solution for muli-boot without UBIFS?

Thanks a lot,
Greetings Thomas

This is quite close to multi-boot - the boot method can be selected very easily from the U-Boot prompt:

http://www.newit.co.uk/forum/index.php/topic,193.msg578.html#msg578
Logged

alfon

  • Newbie
  • *
  • Posts: 28
Re: U-Boot environment variables for Sheevaplug multi-boot version
« Reply #11 on: 09 March 2010, 05:21:57 pm »

A note and a question:

a) The note
This is our procedure for preparing Multi-Boot Sheevaplugs.

  • ...
  • Use the installer again (and again) to prepare alternate versions of the SD card - i.e. with Ubuntu / Debian lenny / Debian squeeze (I'm still working on Fedora).
  • ...


Strictly speaking, it is not necessary to use the installer again for the additional cards. Just halt the plug, remove power cord, replace SD card and USB stick (for different versions), power up and, at the MARVEL> prompt, RUN RECOVER1. Aside from saving time, this also saves from rewriting the NAND flash (OK, I know that a couple of additional writes are not going to substantially reduce its lifetime). The only restriction is that this must be done BEFORE using the installer to write on the internal NAND memory.

b) the question:
Can an SD-card prepared in this way be used with t different plug, or is only usable only in the plug it was created on? i.e., is any device-specific info (e.g. MAC address) written in the card?

Best regards,
Alf
Logged

NewIT_Marcus

  • Hero Member
  • *****
  • Posts: 960
Re: U-Boot environment variables for Sheevaplug multi-boot version
« Reply #12 on: 09 March 2010, 06:06:17 pm »

A note and a question:

a) The note
This is our procedure for preparing Multi-Boot Sheevaplugs.

  • ...
  • Use the installer again (and again) to prepare alternate versions of the SD card - i.e. with Ubuntu / Debian lenny / Debian squeeze (I'm still working on Fedora).
  • ...


Strictly speaking, it is not necessary to use the installer again for the additional cards. Just halt the plug, remove power cord, replace SD card and USB stick (for different versions), power up and, at the MARVEL> prompt, RUN RECOVER1. Aside from saving time, this also saves from rewriting the NAND flash (OK, I know that a couple of additional writes are not going to substantially reduce its lifetime). The only restriction is that this must be done BEFORE using the installer to write on the internal NAND memory.

b) the question:
Can an SD-card prepared in this way be used with t different plug, or is only usable only in the plug it was created on? i.e., is any device-specific info (e.g. MAC address) written in the card?

Best regards,
Alf

The filesystem isn't specific to the hardware, but sometimes Debian can bind eth0 to the MAC address. If or when the MAC address changess, eth0 may disappear. It's easily fixable; there is information about it here I think, and some suggestions as to how to avoid. See here for instance.
Logged

truehl

  • Jr. Member
  • **
  • Posts: 58
Re: U-Boot environment variables for Sheevaplug multi-boot version
« Reply #13 on: 07 June 2010, 10:40:10 am »

Hi Marcus,
two more question depending to the multi-boot option:

1. If I use the SheevaPlug-Installer with the NAND option everything goes fine. If I use the MMC option everything goes fine too, but then the system boots only from SD-Card. That's is because I override the u-boot setting for multi-boot with sd-boot. So I have to do the MMC-option first and than the NAND-option to get a multi-boot Plug. So far so good. Do you have an idea how to change the uboot-mmc-custom.txt file so that is equal which option you run first?

2. What happens, if I run the installer with the MMC-Option and the Plug can't find an sd-card? It seems that in that case the NAND option is choosen automaticly and the installer overwright the NAND is that right?

Thanks a lot,
Greetings Thomas
Logged

NewIT_Marcus

  • Hero Member
  • *****
  • Posts: 960
Re: U-Boot environment variables for Sheevaplug multi-boot version
« Reply #14 on: 07 June 2010, 05:08:28 pm »

Hi Marcus,
two more question depending to the multi-boot option:

1. If I use the SheevaPlug-Installer with the NAND option everything goes fine. If I use the MMC option everything goes fine too, but then the system boots only from SD-Card. That's is because I override the u-boot setting for multi-boot with sd-boot. So I have to do the MMC-option first and than the NAND-option to get a multi-boot Plug. So far so good. Do you have an idea how to change the uboot-mmc-custom.txt file so that is equal which option you run first?

I don't understand what you are asking? For a method to write to an SD card and NAND at the same time? You'd have to change the script that runs when the installer executes (see below), and there is no need anyway, since you can prepare SD cards manually or as a separate job.

Or maybe you are asking if you can pass a parameter to runme.php so that you can use one custom.txt file in all cases. Well yes, you could - the meteohub installation script can do this with the mac address. You still need to write a text file with the required values; the existing script should give you some pointers.

Or maybe you are asking a completely different question ...

Quote
2. What happens, if I run the installer with the MMC-Option and the Plug can't find an sd-card? It seems that in that case the NAND option is choosen automaticly and the installer overwright the NAND is that right?

Thanks a lot,
Greetings Thomas

Here's the rcS script within the initrd on the USB stick:

Code: [Select]
#! /bin/sh

/bin/mount -a
mdev -s
ln -s /proc/mounts /etc/mtab

echo ""
echo ""
echo ""
echo "*****************************************************************"
echo ""     sheevaplug installer version 1.0
echo ""
echo "**** PRESS ENTER TO STOP THE COUNT DOWN"
if [ "$install_type" == "nand" ]; then
    echo "**** Will flash tarball from USB disk to internal NAND /dev/mtdblock1"
    echo "**** This will wipe out EVERYTHING on the internal NAND flash"
else
    echo "**** Will flash tarball from USB disk to SD card /dev/mmcblkp0"
    echo "**** This will wipe out EVERYTHING on the attached SD card"
fi
echo "**** Will wait 10 seconds before the flash."
echo ""
echo ""
echo ""
echo ""
read -t 10
if [ $? == 0 ]; then
exit 1
fi

mdev -s

# Comment out the following line if you want to use JFFS2 instead
if [ "$install_type" == "mmc" ]; then
MMC_INST=1
elif [ "$install_type" == "nand" ]; then
UBIFS=1
else
echo "****** ERROR - must specify in Kernel bootargs the install_type"
echo "******         nand- burn plug internal NAND flash"
echo "******         mmc-  burn connect Memory Card (SD/SDHC)"
exit 1
fi

if [ $MMC_INST ]; then
echo "**** Removing MMC partitions"
echo -e "o\nw\n" | fdisk /dev/mmcblk0
else
echo "**** Erasing all flash"
if [ $UBIFS ]; then
ubiformat -y /dev/mtd1
ubiattach /dev/ubi_ctrl -m 1
# Following will redetect devices, including /dev/ubi0 which we care about
mdev -s
ubimkvol -m -N rootfs /dev/ubi0
# Rescan. This will get us /dev/ubi0_0
mdev -s
# Wipe out the volume
ubiupdatevol /dev/ubi0_0 -t
else
flash_eraseall -j /dev/mtd1
fi
fi

mkdir -p /mnt/usb
mkdir -p /mnt/target

if [ -e /dev/sda1 ]; then
echo "**** Mounting /dev/sda1"
mount /dev/sda1 /mnt/usb
else
echo "**** Mounting /dev/sda"
mount /dev/sda /mnt/usb
fi

if [ $? != 0 ]; then
echo "**** ERROR - Could not mount USB drive"
echo "**** ERROR - Will try to continue anyway"
fi

if [ $MMC_INST ]; then
echo "**** Creating /dev/mmcblk0p1 & /dev/mmcblk0p2 partitions"
echo -e "n\np\n1\n\n+4M\nn\np\n2\n\n\nw\n" | fdisk /dev/mmcblk0

echo "**** Making EXT2 partition on /dev/mmcblk0p1 for uImage"
mkfs.ext2 -L shvplug-uImage /dev/mmcblk0p1
if [ $? != 0 ]; then
echo "**** ERROR - mkfs.ext2 /dev/mmcblk0p1"
exit 1
fi

echo "**** Making EXT3 partition on /dev/mmcblk0p2 for rootfs"
mkfs.ext3 -L shvplug-rootfs /dev/mmcblk0p2
if [ $? != 0 ]; then
echo "**** ERROR - mkfs.ext3 /dev/mmcblk0p2"
exit 1
fi

echo "**** Mounting /dev/mmcblk0p2"
mount /dev/mmcblk0p2 /mnt/target
else
if [ $UBIFS ]; then
mount -t ubifs ubi0:rootfs /mnt/target
else
mount -t jffs2 /dev/mtdblock1 /mnt/target
fi
fi

if [ $? != 0 ]; then
echo "**** ERROR - mount /dev/* /mnt/target"
exit 1
fi

cd /mnt/target
if [ -e /mnt/usb/rootfs.tar.gz ]; then
echo "**** Copying root filesystem. This will take few minutes"
/etc/init.d/bar -n /mnt/usb/rootfs.tar.gz | tar xzpf -
echo "**** done."
else
echo "****** ERROR - no rootfs.tar.gz file found on USB stick"
exit 1
fi

if [ -e /mnt/usb/modules.tar.gz ]; then
echo "**** Copying kernel modules"
/etc/init.d/bar -n /mnt/usb/modules.tar.gz | tar xzpf -
echo "**** done."
else
echo "**** NOTE - modules.tar.gz not found on USB stick"
fi

if [ -e /mnt/usb/uImage ]; then
if [ $MMC_INST ]; then
cd /
echo "**** Doing sync. This will take some time"
umount /mnt/target

echo "**** Mounting /dev/mmcblk0p1"
mount /dev/mmcblk0p1 /mnt/target

echo "**** Copying kernel"
cp /mnt/usb/uImage /mnt/target/
else
mkdir -p /mnt/target/boot
echo "**** Copying kernel"
cp /mnt/usb/uImage /mnt/target/boot
fi
echo "**** done."
else
echo"***** ERROR - no uImage file found on USB stick"
exit 1
fi

cd /
echo "**** Doing sync. This will take some time"
sync
echo "**** done. Rebooting..."
umount /mnt/target
umount /mnt/usb
reboot

I would expect it to barf on:

Code: [Select]
echo -e "o\nw\n" | fdisk /dev/mmcblk0
Logged
Pages: [1] 2
 
 

Powered by MySQL Powered by PHP SMF 2.0.10 | SMF © 2015, Simple Machines Valid XHTML 1.0! Valid CSS!