boot Wandboard into / on lvm on raid?

Ask questions about Arch Linux ARM. Please search before making a new topic.

boot Wandboard into / on lvm on raid?

Postby ubootnewbie » Mon Dec 29, 2014 1:54 am

I want to use the sd card to hold the kernel image and the initramdisk only but have the filesystem root on a logical volume on top of a software raid.
I have a running arch on my wandboard quad and used it to to the following preparatory steps:
1.) Created a suitable kernel+initram combination:
I have set $this->bbcode_second_pass_code('', ' HOOKS="base udev autodetect modconf block mdadm lvm2 filesystems"') in /etc/mkinitcpio.conf
and run
$this->bbcode_second_pass_code('', '
pacman -Syu linux-armv7
mdadm --detail --scan >> /etc/mdadm.conf
mkinitcpio -g /boot/initrd
')
which did not report any errors
and created the new file initrd in /boot
2.) Created the raid and the lv on top and install an arch there:
This worked without problems
$this->bbcode_second_pass_code('', 'lvscan
ACTIVE '/dev/root/root' [200.00 GiB] inherit
bsdtar -xpf ArchLinuxARM-wand-latest.tar.gz -C')

3.) Configure uboot and write it (together wiht the kernel, ramdisk and what else) to an sd card:
.

This is where I get lost
Can I use a config file for u-boot, and what do I have to put in it?
Can I use the same version of uboot installed on my present sd card (from which I booted to perform the previous steps) and copy it via dd to the new sd-card?
Do I have to use mkimage (and how)?
...?

4.) put the new sd card in the wandboard module and reboot.

I am pretty sure that it is possible to achieve it. I would be very useful for me also.
So any help is very much appreciated.

Cheers and thanks in advance.
ubootnewbie
 
Posts: 4
Joined: Sun Dec 28, 2014 10:24 pm

Re: boot Wandboard into / on lvm on raid?

Postby pepedog » Mon Dec 29, 2014 8:30 am

You will need to wrap it, then it's down to uboot settings
$this->bbcode_second_pass_code('', 'mkinitcpio -g /boot/initrd
mkimage -A arm -O linux -T ramdisk -a 15100000 -e 15100000 -n "Initial Ram Disk" -d /boot/initrd /boot/uInitrd')
pepedog
Developer
 
Posts: 2431
Joined: Mon Jun 07, 2010 3:30 pm
Location: London UK

Re: boot Wandboard into / on lvm on raid?

Postby ubootnewbie » Tue Dec 30, 2014 1:29 am

Many thanks for the quick reaction.
I created the image as suggested and everything seems to be ok with it:$this->bbcode_second_pass_code('', '
[root@alarm mm]# mkimage -l /boot/uInitrd
Image Name: Initial Ram Disk
Created: Mon Dec 29 15:32:02 2014
Image Type: ARM Linux RAMDisk Image (gzip compressed)
Data Size: 6574459 Bytes = 6420.37 kB = 6.27 MB
Load Address: 15100000
Entry Point: 15100000
')
So I probably have to tell uboot at least two things
1.) which image and kernel to boot
2.) what kernel commandline (to make the new kernel recognize its root)
The problem is that I dont know how to do either.
My uboot was installed (and flashed to the card) by pacman
I dont see any config file that could carry the information.
I expect to be able to use $this->bbcode_second_pass_code('', ' uEnv.txt ')
but I can't find the original one to adapt it.
Do you know where I can find it?
(I only found one in an old post: http://archlinuxarm.org/forum/viewtopic.php?f=45&t=5995&p=33791&hilit=wandboard#p33791
but I am not sure if this one is the one used presently.
I cloned the src of the package uboot-wandboard from her https://github.com/archlinuxarm/PKGBUILDs/tree/master/alarm/uboot-wandboard

Or do I have to build the uboot-wandboard package ?

Thanks
Markus
ubootnewbie
 
Posts: 4
Joined: Sun Dec 28, 2014 10:24 pm

Re: boot Wandboard into / on lvm on raid?

Postby opotonil » Tue Dec 30, 2014 8:48 am

I don't know about this, but you can try to rename "uInitrd" to "initramfs-linux.img".

On https://github.com/archlinuxarm/PKGBUIL ... ions.patch

I can see on line 55:
$this->bbcode_second_pass_code('', '
rdfile=initramfs-linux.img
')
And on line 124:
$this->bbcode_second_pass_code('', '
loadrd=load mmc ${bootpart} ${rdaddr} ${bootdir}/${rdfile}
')

I hope this can help you.
opotonil
 
Posts: 44
Joined: Sat Feb 08, 2014 1:17 pm

Re: boot Wandboard into / on lvm on raid?

Postby ubootnewbie » Wed Dec 31, 2014 12:02 am

Thanks for your suggestions. I have tried them but ran into problems before they could take effect.
After some unsuccesful attempts to boot with my changed image I decided to mak sure that I can rebuild and install the standard uboot (which boots from the sdcard).
So I did the following.
$this->bbcode_second_pass_code('', '
git clone https://github.com/archlinuxarm/PKGBUILDs.git
cd PKGBUILDs/alarm/uboot-wandboard
makepkg
....
==> Finished making: uboot-wandboard 2014.10-1 (Tue Dec 30 23:57:20 CET 2014)
sudo pacman -U uboot-wandboard-quad-2014.10-1-armv7h.pkg.tar.xz
')
Which flushed the newly created image to my sdcard.
After this I could not boot any more because uboot tries to boot over the network.( although I used the clean git checkout)
When I dd the old u-boot.imx installed origianally by pacman vi to the new card booting works again.
Do I do something wrong or is the binary package built differently?

Thanks in advance for any helpful comments
Markus
ubootnewbie
 
Posts: 4
Joined: Sun Dec 28, 2014 10:24 pm

Re: boot Wandboard into / on lvm on raid?

Postby opotonil » Thu Jan 08, 2015 8:29 am

See this post: viewtopic.php?f=45&t=8215

uEnv.txt
$this->bbcode_second_pass_code('', '
mmc_load_image=load mmc ${mmcdev}:${mmcpart} 0x10000000 zImage
mmc_load_initrd=load mmc ${mmcdev}:${mmcpart} 0x12000000 uInitrd; setenv
initrd_size ${filesize}

#Just: zImage
xyz_mmcboot=run mmc_load_image; run mmc_load_dtb; echo Booting from mmc ...
loaduimage=run xyz_mmcboot; run mmcargs; bootz 0x10000000 - 0x11ff0000

#zImage and initrd
#xyz_mmcboot=run mmc_load_image; run mmc_load_initrd; run mmc_load_dtb; echo
#Booting from mmc ...
#loaduimage=run xyz_mmcboot; run mmcargs; bootz 0x10000000
')
opotonil
 
Posts: 44
Joined: Sat Feb 08, 2014 1:17 pm

Re: boot Wandboard into / on lvm on raid?

Postby ubootnewbie » Tue Mar 10, 2015 10:26 pm

Many thanks to opotonil
I found time at last to test the suggestion and got my lvm to work.
My first exercise was to boot from one partition (boot) into a root filesystem on another partition (not yet with lvm).
This didn't require a new kernel or initramdisk and could be achieved easier. I learned what I needed from the link mentioned in the last reply
http://archlinuxarm.org/forum/viewtopic.php?f=45&t=8215.
One thing worth mentioning is that with the default uboot settings the kernelimage lives in a boot directory on the boot partition.
This is different to all my previos linux installs where the kernel und bootloader stuff lived directly on the boot partition
that was usually mounted to /boot. If you do that you have to put the image under /boot/boot ....


Here is what I did to get lvm to work.
On my running wandboard arch system I first installed the new uboot.
$this->bbcode_second_pass_code('', ' pacman -Sy uboot-wandboard-quad ')
and the mainline kernel
$this->bbcode_second_pass_code('', 'pacman -Syu linux-armv7')
Then I followed the normal instructions to install lvm https://wiki.archlinux.org/index.php/LVM#Installing_Arch_Linux_on_LVM
with the exception that i ran
$this->bbcode_second_pass_code('', 'mkinitcpio -g initramfs-linux.img')
The filename $this->bbcode_second_pass_code('', 'initramfs-linux.img') I learned from the error message uboot gave me via the serial cable.
I put it in the same directory where the zImage,uEnv.txt, u-boot.imx lived.
After I had successfully booted the first time into my lvm i tried to minimize my $this->bbcode_second_pass_code('', 'uEnv.txt') to see what parts had an effect. Here is what it looks like now:
$this->bbcode_second_pass_code('', '
mmcroot=/dev/vg25G/root rw
mmcrootfstype=ext4 rootwait fixrtc

video=mxcdi1fb:1280x720M@60

mmc_load_image=load mmc ${mmcdev}:${mmcpart} 0x10000000 zImage
mmc_load_dtb=load mmc ${mmcdev}:${mmcpart} 0x11ff0000 /dtbs/${dtb_file}

mmcargs=setenv bootargs console=${console} ${optargs} root=${mmcroot}
rootfstype=${mmcrootfstype} ${video}

#Just: zImage
xyz_mmcboot=run mmc_load_image; run mmc_load_dtb; echo Booting from mmc ...
loaduimage=run xyz_mmcboot; run mmcargs; bootz 0x10000000 - 0x11ff0000

')
My fstab looks like this:
$this->bbcode_second_pass_code('', '
/dev/vg25G/root / ext4 noatime
/dev/mmcblk0p1 /mnt/boot ext2 noatime
')

Finally to make maintenance easier I made /boot a synlink to /mnt/boot
so a kernel or uboot update falls in the right location automatically.
ubootnewbie
 
Posts: 4
Joined: Sun Dec 28, 2014 10:24 pm


Return to User Questions

Who is online

Users browsing this forum: No registered users and 3 guests

cron