Quantcast
Channel: Linux Device Hacking
Viewing all articles
Browse latest Browse all 3178

Tutorial of native sata boot for pogoplug pro (4 replies)

$
0
0
I summed up the old post about sata boot for pogoplug pro and fixed some broken links

Just for reference to others, I made a very detailed summary.

Please revise my comment are there right in technical aspect. (?? if I have doubt - I will revise based on your comment)

Synopsys:
My device Pogo Plug P24 - V3 (nonpci) - oxnas 820
I have serial connection,

I Screw up UBoot in NAND - Therefore no boot from USB,
and NOTHING appears on Serial console!!!

Only way to boot is well prepared SATA because oxnas tries to boot Uboot on SATA then Uboot on NAND then USB. (?? is that right??)

Steps

1. Get a SATA HDD. You have to delete all partition from it. Sorry :(
2. Put it to USB HDD frame. Attache to PC. Umount all partition if automount happened.
3. remove partitions, and create new.

fdisk /dev/sdb
o - create a new empty DOS partition table
n - Create part 1 (start with 2048 ; size: +2G )
w - write
q - exit



4. mkext4 fs.

mkfs.ext4 /dev/sdb1




( If you have problems with "mkfs.ext4 /dev/sdb is not a block special device."
Detach USB _and_ reboot your PC. and attache again - will solve the problem...)

5 Labell it:

tune2fs -L "rootfs" /dev/sdb1




6.Mount rootfs

mount /dev/sdb1 /media/rootfs




7. Prepare Sata uboot file on PC :
a.) Extract the content Shv made ox820-sata-uboot.tar.gz to your PC

cd /yourpath
tar -xjf ox820-sata-uboot.tar.gz


(It is only a boot directory on your PC)
Navigate to /yourpath/boot/dts directory and rename this files:
-it is only needed in case noPCI devices like P24.

mv ox820-pogoplug-pro.dtb ox820-pogoplug-pro.dtb.ori
cp ox820-pogoplug-classic.dtb ox820-pogoplug-pro.dtb




b.) and copy modified /yourpath/boot directory to the rootfs partition.

c.)Modify 2 lines in disk create script on your PC:

c1.) disk=/dev/sdb
c2.) workarea="/yourpath"
d.) save changes

8. Now you have to run Sata uboot SCRIPT on your PC.
It will write U-Boot SPL to Sata disk on the beginning (in the first 2048 sector) on the disk.

8a.) Umount - Just to be safe side: Not write to disk which is mounted... - skip if brave.

umount rootfs



8b.) Run Sata uboot SCRIPT

./disk_create_shv




Prepare Debian Rootfs files.
9.) Mount rootfs again:

mount /dev/sdb1 /media/rootfs



10.) Extract debian files to your PC /yourpath directory. Debian-3.17.0-oxnas-tld-1-rootfs-bodhi.tar.bz2

tar -xjf Debian-3.17.0-oxnas-tld-1-rootfs-bodhi.tar.bz2




11. Copy all directory from PC to your rootfs partition BUT /boot . (It means do not overwrite the existing /boot on rootfs!!)

detach from PC and attache to Pogo.
Attache serial TTL connector and see output. Trust Bodhi, Picocom is better than GNU Screen. I learned :)

picocom -b 115200 /dev/ttyUSB0




Power on your POGO.

Debian will not boot because Uboot env not well set for this configuration. try it but for sure it will freeze. :) then power on - and - of again.

Now Stop the counter by press a key:

Hit any key to stop autoboot: 3


Now set the environment to this setup:


Looks like your V3 is trying to boot from ide. If what you posted is your complete printenv, you are missing some stuff.

Here is my ide boot setenv's (partial) for a frame of reference:

setenv uinitrd_addr '0x60e00000'
setenv uimage_addr '0x60500000'
setenv dtb_addr '0x62c00000'
setenv ide_set_bootargs 'setenv bootargs console=ttyS0,115200 root=/dev/sda1 rootdelay=10'
setenv dt_bootm 'bootm $uimage_addr $uinitrd_addr $dtb_addr'
setenv dt_load_dtb 'ext2load ide 0:1 $dtb_addr /boot/dts/ox820-pogoplug-pro.dtb'
setenv dt_load_initrd 'ext2load ide 0:1 $uinitrd_addr /boot/uInitrd'
setenv dt_load_uimage 'ext2load ide 0:1 $uimage_addr /boot/uImage'
setenv dt_ide_boot 'run dt_load_uimage; run dt_load_initrd; run dt_load_dtb; run dt_bootm'
setenv dt_ide_bootcmd 'run ide_set_bootargs; run dt_ide_boot'
setenv dt_bootcmd_ide 'ide reset; run dt_ide_bootcmd; reset'
setenv bootcmd 'run dt_bootcmd_ide'


And for usb booting it's this (complete):

setenv autoload no
setenv baudrate 115200
setenv bootargs console=ttyS0,115200n8
setenv bootdelay 10
setenv console console=ttyS0,115200n8
setenv ethact mii0
setenv ethaddr (removed for security)
setenv ipaddr 192.168.1.100
setenv mtdids nand0=41000000.nand
setenv mtdparts mtdparts=41000000.nand:14m(boot),-(data)
setenv serverip 192.168.1.110
setenv stderr serial
setenv stdin serial
setenv stdout serial
setenv usb_device 0:1
setenv if_netconsole ping $serverip
setenv preboot_nc run if_netconsole start_netconsole
setenv start_netconsole setenv ncip $serverip; setenv bootdelay 10; setenv stdin nc; setenv stdout nc; setenv stderr nc; version
setenv usb_set_bootargs setenv bootargs console=ttyS0,115200 root=/dev/sda1 rootdelay=10
setenv uinitrd_addr 0x60e00000
setenv uimage_addr 0x60500000
setenv dtb_addr 0x62c00000
setenv dt_load_dtb ext2load usb 0:1 $dtb_addr /boot/dts/ox820-pogoplug-pro.dtb
setenv dt_load_initrd ext2load usb 0:1 $uinitrd_addr /boot/uInitrd
setenv dt_load_uimage ext2load usb 0:1 $uimage_addr /boot/uImage
setenv dt_bootm bootm $uimage_addr $uinitrd_addr $dtb_addr
setenv dt_usb_boot run dt_load_uimage; run dt_load_initrd; run dt_load_dtb; run dt_bootm
setenv dt_usb_bootcmd run usb_set_bootargs; run dt_usb_boot
setenv dt_bootcmd_usb usb start; run dt_usb_bootcmd; usb stop; reset
setenv bootcmd run dt_bootcmd_usb



Do a printenv and try to determine what you are missing based on what I have posted. Note that my boot env's are pretty simple compared to some of the really complicated netconsole / tftp ones I have seen on the forum so you might want to take a look at some of those if you wanna get funky.





Boot success!!


I hope -you Masters (Bodhi, SHV, Morph) - find my guide is useful. :) and it is a little benefit give back to community. Respect.


To be continued



No! But if you put the right stage1 bootloader and the right uboot to your SATA drive it might boot with them. You can't use the files which are provided here for Flash install. Moreover you must put the stage1 bootloader to your drive as it is done by OXNAS-SATA-Boot skript from ALARM forum. The uboot can be put to the filesystem of the first partition (Fat32 or ext4 depends on the stage1 loader).

I tested the following setups:
sda1: just für boot files like u-boot.img, u-boot.env, uImage, uInitrd (ext4 or fat32)
sda2: rootfs (ext3 or ext4)
sda3: linux swap partition
sda4: data (ext4)

or
sda1: rootfs including boot files (ext4)
sda2: linux swap partition
sda3: data (ext4)

For both setups you can use the same stage1 bootloader (u-boot-spl.bin) which reads the boot files from and stores boot environment to the first ext4 partition of the SATA drive. The device must support 512 Byte sector size either natively or by simulation.

u-boot files for SATA booting: http://pogoplug.square7.ch/ox820-sata-uboot.tar.gz (environment must be adapted with the serial console to boot the uImage and uInitrd files) - uImage, uInitrd and dtb file are for Pogoplug Pro - you might replace them with the right files of your kernel

can be download at :
 http://forum.doozan.com/read.php?3,28162,28313#msg-28313

This is courtesy of LeggoMyEggo. I've upload the tarball Leggo sent me to Dropbox.

There are 2 tarballs in it. One from shv, one from WarheadsSE. It's easier to use the shv's: ox820-sata-uboot.tar.gz.

ox820-sata-uboot.tar.gz
oxnas_sata_boot.tgz

Dropbox download link:
https://www.dropbox.com/s/p9bo06us5fo2i3s/oxnasboottarball.zip
md5
8e016437146f40cdb51ad9dbd63b1bdd


Preparing SATA drive and storing u-boot-spl.bin alias stage1 to it:
http://archlinuxarm.org/forum/viewtopic.php?f=55&t=2146&sid=f4dc4863e3a93822a4f9e925b3cbda45


You must execute the steps from the ALARM script until stage1 file (u-boot-spl.bin from my package must be used instead the provided stage1 file) is stored to the HDD.

You must adapt the following lines of the boot environment:
dt_ide_bootcmd=run ide_set_bootargs; run dt_ide_boot
ide_set_bootargs=setenv bootargs root=/dev/sda1 rootfstype=ext4 console=ttyS0,115200 mem=128M


to be continued

http://forum.doozan.com/read.php?3,16017,19666#msg-19666

@Robert,
your boot environment looks OK for the old WarheadsSE booting procedure. It looks that you don't have the right rootfs on partition sda2 (ext3/partition name rootfs).

Nevertheless I want to recommend you to use new uboot. Bodhi already pointed you to my post: http://forum.doozan.com/read.php?3,16017,17297#msg-17297.

The device must support 512 Byte sector size either natively or by simulation.

Step1: prepare mbr partition table:

sda1: rootfs including boot files (ext4) with partition name rootfs
sda2: linux swap partition
sda3: data (ext4)

Step2: Extract the content of the archive http://pogoplug.cwsurf.de/ox820-sata-uboot.tar.gz (http://pogoplug.square7.ch/ox820-sata-uboot.tar.gz)to your rootfs partition

Step3: Prepare SATA booting by adapting and executing the following script

#!/bin/sh

# uncomment line below and set to the correct disk
#disk=/dev/sda

if [ -z "${disk}" ] ; then
echo "You must uncomment/set the 'disk' variable"
exit -1
fi

workarea="/boot"

stage1File=$workarea/u-boot-spl.bin

perl <<EOF | dd of="$disk" bs=512
print "\x00" x 0x1a4;
print "\x00\x5f\x01\x00";
print "\x00\xdf\x00\x00";
print "\x00\x80\x00\x00";
print "\x00" x (0x1b0 -0x1a4 -12 );
print "\x22\x80\x00\x00";
print "\x22\x00\x00\x00";
print "\x00\x80\x00\x00";
EOF

if [ -f $stage1File ];then
echo "Writing stage 1"
dd if=$stage1File of="$disk" bs=512 seek=34
fi

Step4: Boot with serial cable connected and adapt the boot-env settings to your needs

Please also read the posts of morph027 starting from: http://forum.doozan.com/read.php?3,16017,18341#msg-18341

-shv

TBC

Viewing all articles
Browse latest Browse all 3178

Trending Articles