OESF Portables Forum

Everything Else => Zaurus Distro Support and Discussion => Distros, Development, and Model Specific Forums => Archived Forums => Debian => Topic started by: matthis on July 15, 2008, 09:22:21 pm

Title: Kexec From Debian To Sharprom, Really Working How-to!
Post by: matthis on July 15, 2008, 09:22:21 pm
Hello, I was frustrated about not being able to kexec successfully into sharprom, but frustration is over!!
Following Pelrun's hint that the NAND partition layout had to be hardcoded, I recompiled eviljazz's kernel passing the necessary argument to the kernel, and now using this kernel for kexec the dreaded: "unable to open initial console" is GONE!!"

How-to


1. On your Z
Boot into the sharprom using your usual kernel, check the file /var/log/dmesg and find the line which contains this:
mtdparts=sharpsl-nand:7168k@0k(smf),44032k@7168k(root),-(home) jffs2_orphaned_inodes=delete EQUIPMENT=5 LOGOLAND=1 DEFYEAR=2008 LOGO=1 LAUNCH=q
(Your values for sharpsl-nand may vary, and this is why you need to build your own kernel)

2. On your linux Desktop:
- download eviljazz's toolchain http://katastrophos.net/zaurus/kernels/com...1.09.05.tar.bz2 (http://katastrophos.net/zaurus/kernels/compiler/arm-cacko-linux-gnu-2.95.3-2.2.5-hardfloat-19.50_21.09.05.tar.bz2)
- download eviljazz's kernel tarball http://katastrophos.net/zaurus/kernels/cur....20-v55.tar.bz2 (http://katastrophos.net/zaurus/kernels/current/zaurus-kernel-2.4.20-v55.tar.bz2)

- Follow the instructions in the kernel tarball's README, but after executing "make oldconfig", do "make menuconfig".
In there, go to General Setup, and scroll down until you find the place to edit kernel arguments. By default, they should be: "console=ttyS0 root=/dev/mtdblock2"
Select that, and add the line you have noted on your Z earlier, so that the boot param becomes:
console=ttyS0 root=/dev/mtdblock2 mtdparts=sharpsl-nand:7168k@0k(smf),44032k@7168k(root),-(home) jffs2_orphaned_inodes=delete EQUIPMENT=5 LOGOLAND=1 DEFYEAR=2008 LOGO=1 LAUNCH=q
(Again, with your values for sharpsl-nand)

Go on with "make dep" and "make zImage", the resulting zImage will work for kexecing to sharprom!
Title: Kexec From Debian To Sharprom, Really Working How-to!
Post by: xamindar on July 17, 2008, 02:11:20 am
Here is my kernel line from the sharp rom on my 3100. Just in case anyone wants to know. Looks like I will need to compile my own kernel too.

Code: [Select]
Kernel command line: console=ttyS0 root=/dev/mtdblock2 mtdparts=sharpsl-nand:7168k@0k(smf),32768k@7168k(root),-(home) jffs2_orphaned_inodes=delete EQUIPMENT=4 LOGOLANG=1 DEFYEAR=2006 LOGO=1 LAUNCH=q
wow, it did work! woohoo. In case someone wants to try (this c3100 kernel is probably the same on other c3100 I would imagine). Here is the kernel I compiled.
Title: Kexec From Debian To Sharprom, Really Working How-to!
Post by: maemorandum on November 13, 2008, 04:34:45 am
Quote from: matthis
Following Pelrun's hint that the NAND partition layout had to be hardcoded, I recompiled eviljazz's kernel passing the necessary argument to the kernel, and now using this kernel for kexec the dreaded: "unable to open initial console" is GONE!!"

Thank you, matthis. Following your guide, i got a working sharp-rom zimage for dualbooting!
But, i need the cacko-rom one instead of the sharp one.

So, is there an instruction to get a "hardcoded" cacko-zImage (C1000/C3200)?
Title: Kexec From Debian To Sharprom, Really Working How-to!
Post by: xamindar on November 13, 2008, 05:41:28 pm
Quote from: maemorandum
But, i need the cacko-rom one instead of the sharp one.

So, is there an instruction to get a "hardcoded" cacko-zImage (C1000/C3200)?
I don't get it. Is there some special cacko kernel that you were using before? The kernel should work on both cacko and sharp rom as they use the same kernel anyway. Please explain why these instructions didn't work for you.
Title: Kexec From Debian To Sharprom, Really Working How-to!
Post by: maemorandum on November 14, 2008, 05:28:04 am
using a c1000:

1. I prepared a sd-card with the zaurus_eabi_rootfs_071201.tar.bz2 (http://matrixmen.free.fr/zaurus/debian/zaurus_eabi_rootfs_071201.tar.bz2) and the 2.6.24.3-yonggun kernel modules (http://yonggun.tistory.com/attachment/ik0.gz) and checked fstab, depmod hwclock.

2. I made a trisoft sharp nand (http://trisoft.de/) restore from cf-card

3. I started the sharp-rom and noticed the mtdparts=sharpsl-nand command

4. I installed the http://katastrophos.net/zaurus/kernels/com...1.09.05.tar.bz2 (http://katastrophos.net/zaurus/kernels/compiler/arm-cacko-linux-gnu-2.95.3-2.2.5-hardfloat-19.50_21.09.05.tar.bz2) and the eviljazz's kernel tarball (http://katastrophos.net/zaurus/kernels/current/zaurus-kernel-2.4.20-v55.tar.bz2) and compiled the kernel with the new noticed line

5. I copied the zImage.bin.sd1 (http://yonggun.tistory.com/attachment/gk080000000003.sd1) and the updater.sh (https://www.oesf.org/forum/index.php?act=attach&type=post&id=5403) for the C1000 on a cf-card and did the yonggun kernel installation for the sharp bootloader

6. I booted into debian from the inserted sd-card without problems, installed the kexec (https://www.oesf.org/forum/index.php?act=attach&type=post&id=5297) package and placed the compiled zimage and sharp-bootloader-script (https://www.oesf.org/forum/index.php?act=attach&type=post&id=5364) into the /root directory.

7. I started the script and the C1000 perfectly boots into the sharp-rom. (Dualbooting eabi-sharprom)

-----------------------------------------------------------------------------------------------------------------

In order to boot into cacko i installed the cacko-light rom with 19 MB resize (flash-utility) and eviljazz kernel update (http://www.katastrophos.net/zaurus/kernels/current/) fastfpe. Then i went on with number 5. Unfortunately the booting of the cacko started and failed with the old "initial console" error.

Did it once more with the original cacko-light rom with 19 MB resize without kernel update. This ended in a
Code: [Select]
Kernel panic: Attempted to kill init! too.
Title: Kexec From Debian To Sharprom, Really Working How-to!
Post by: xamindar on November 17, 2008, 04:15:12 am
Did you recheck your step 3 after flashing cacko?  It might be different so you would need to recompile a new kernel.
Title: Kexec From Debian To Sharprom, Really Working How-to!
Post by: maemorandum on November 18, 2008, 08:12:29 am
Quote from: xamindar
Did you recheck your step 3 after flashing cacko?  It might be different so you would need to recompile a new kernel.

Thank you, xamindar. I forgot to use the cacko-specific parameters. Now, finally, it works!
Title: Kexec From Debian To Sharprom, Really Working How-to!
Post by: gojira on December 10, 2008, 08:58:36 am
Quote from: matthis
Hello, I was frustrated about not being able to kexec successfully into sharprom, but frustration is over!!
Following Pelrun's hint that the NAND partition layout had to be hardcoded, I recompiled eviljazz's kernel passing the necessary argument to the kernel, and now using this kernel for kexec the dreaded: "unable to open initial console" is GONE!!"

couldn't this be done just by passing the options with 'kexec --append=' ?

Quote from: matthis
PS: If you have exactly the same values for sharpsl-nand, then you may want to try the kernel image I have built., to save compiling time  
http://web.mita.keio.ac.jp/~mh070504/sharp-zImage.bin (http://web.mita.keio.ac.jp/~mh070504/sharp-zImage.bin)
I am using SL-C3200 and I doubt the values are the same for other models, so be careful. Other SL-C3200 may also be different, depending on whether they use sharp/cacko/trisoft-sharp roms, etc... so check sharpsl-nand values!

and if not, is that kernel still available somewhere?
Title: Kexec From Debian To Sharprom, Really Working How-to!
Post by: pelrun on December 10, 2008, 09:10:20 am
Quote from: gojira
couldn't this be done just by passing the options with 'kexec --append=' ?

It would have been easier that way - pity it simply doesn't work.
Title: Kexec From Debian To Sharprom, Really Working How-to!
Post by: gojira on December 10, 2008, 10:40:12 am
Quote from: pelrun
It would have been easier that way - pity it simply doesn't work.

bugger!  I guess it's a deficiency in kexec on arm then, cos the args must be being passed by the usual bootloader if they're not already in the kernel?  does anyone have a 3200 kernel available as the one above is gone now?  thanks!
Title: Kexec From Debian To Sharprom, Really Working How-to!
Post by: ant on December 10, 2008, 10:46:39 am
>It would have been easier that way - pity it simply doesn't work.

FYI we almost have a solution for the mtdparts string: using the linux-kexecboot kernel as second stage bootloader we parse the mtdparts passed by the (broken) Zaurus bootloader reading /proc/cmdline.

And in case you use u-boot and custom partitioning sizes, well, these are the passed to the kexecbooted kernel.
This way you don't need to hardcode these in cmdline.
 
See  https://www.oesf.org/forum/index.php?showtopic=26388 (https://www.oesf.org/forum/index.php?showtopic=26388)

Ant


Ref: http://projects.linuxtogo.org/pipermail/op...ber/018129.html (http://projects.linuxtogo.org/pipermail/openembedded-commits/2008-September/018129.html)
Title: Kexec From Debian To Sharprom, Really Working How-to!
Post by: gojira on December 10, 2008, 11:19:26 am
Quote from: matthis
Boot into the sharprom using your usual kernel, check the file /var/log/dmesg and find the line which contains this:
mtdparts=sharpsl-nand:7168k@0k(smf),44032k@7168k(root),-(home) jffs2_orphaned_inodes=delete EQUIPMENT=5 LOGOLAND=1 DEFYEAR=2008 LOGO=1 LAUNCH=q

that wasn't in my dmesg, but the best place to get it is /proc/cmdline anyway.  also, that should be LOGOLANG not LOGOLAND...  I just built a 3200 kernel, here it is: [ You are not allowed to view attachments ]
Title: Kexec From Debian To Sharprom, Really Working How-to!
Post by: gojira on December 13, 2008, 03:15:49 am
Quote from: gojira
I just built a 3200 kernel, here it is: [ You are not allowed to view attachments ]

sorry, I couldn't test it before, it works if booted directly but gives a kernel panic when booted via kexec...  does it work for anyone, or does anyone have a 3200 sharprom kernel that works from kexec?
Title: Kexec From Debian To Sharprom, Really Working How-to!
Post by: Jon_J on December 28, 2008, 08:42:20 pm
Quote from: matthis
1. On your Z
Boot into the sharprom using your usual kernel, check the file /var/log/dmesg and find the line which contains this:
mtdparts=sharpsl-nand:7168k@0k(smf),44032k@7168k(root),-(home) jffs2_orphaned_inodes=delete EQUIPMENT=5 LOGOLAND=1 DEFYEAR=2008 LOGO=1 LAUNCH=q
(Your values for sharpsl-nand may vary, and this is why you need to build your own kernel)

Does anyone have these values for a Cacko Full install on a SL-C3100?
Quote
mtdparts=sharpsl-nand:7168k@0k(smf),44032k@7168k(root),-(home)
I don't have this line, or anything close to it in my /var/log/dmesg
Here's what my /var/log/dmesg shows that is related to mtd partition locations: (note the spelling error on first line)
Code: [Select]
Using static partision definition
Creating 1 MTD partitions on "sharpsl-flash":
0x00140000-0x007f0000 : "Filesystem"
NAND device: Manufacture ID: 0xec, chip ID: 0xf1 (Samsung NAND 128MB 3,3V)
Creating 3 MTD partitions on "NAND 128MB 3,3V":
0x00000000-0x-00700000 : "smf"
0x00700000-0x-03c00000 : "root"
0x03c00000-0x-08000000 : "home"
I'm trying to put these values in /boot/kernel-cmd (Using the new multiboot kernel for zubuntu posted on cortez's site).
I can boot zubuntu and angstrom just fine from the multiboot menu, but cacko just will not appear on this menu.
I could use the default Sharp values, but I think they may be different from Cacko.
Or, How do I convert:
0x00000000-0x-00700000 : "smf"
0x00700000-0x-03c00000 : "root"
0x03c00000-0x-08000000 : "home"
to
xxxxk@0k(smf),xxxxxk@xxxxk(root),-(home)
Thank you,
Jon
Title: Kexec From Debian To Sharprom, Really Working How-to!
Post by: ant on December 29, 2008, 08:59:11 am
Quote
Or, How do I convert:
0x00000000-0x-00700000 : "smf"
0x00700000-0x-03c00000 : "root"
0x03c00000-0x-08000000 : "home"
to
xxxxk@0k(smf),xxxxxk@xxxxk(root),-(home)
Thank you,
Jon

03c00000 is hex format, convert it to dec:
7340032 - 62914560  bytes = 5574528 bytes /1024 = 54272 kb  /1024 = 53 mb

You can find your actual mtdparts doing "cat /proc/mtd" and if they are in cmdline "cat /proc/cmdline".

The thing here is the 2.4 kernels (cacko) is not able to get mtdparts by atag, nor from Zaurus bootloader....so the solution found by kernel devs was to add a static compiled mtdparts string in cmdline. If this is missing, the kernel defaults to Sharp's standard sizes (in sharpsl.c).

At the moment, only u-boot bootloader is able to pass the mtdparts correctly to the kernel on Zaurus.
The kexecboot/multiboot kernel has a special patch for reading the mtdparts /from proc/cmdline and pass it to the new booted kernel.

Cheers

Ant
Title: Kexec From Debian To Sharprom, Really Working How-to!
Post by: Jon_J on December 29, 2008, 10:20:45 am
So you're saying I cannot boot cacko from NAND using the multiboot kernel that cortez posted with zubuntu?
I did cat/proc/mtd It still spits out some sort of hex number.
(I'm not a math genus or binary wizard, so these numbers don't resemble the numbers the sharp users have posted above)
Code: [Select]
cat /proc/mtd
dev     size   erasesize  name
mtd0: 006b0000 00020000 "Filesystem"
mtd1: 00700000 00020000 "smf"
mtd2: 03500000 00020000 "root"
mtd3: 04400000 00020000 "home"
after reading another post on NAND partitions: https://www.oesf.org/forum/index.php?showto...sharpsl\.c (https://www.oesf.org/forum/index.php?showtopic=24195&hl=sharpsl\.c)
I found my kernel command line in dmesg, but it is severally truncated:
Code: [Select]
kernel command line: console=ttyS0 root=/dev/mtdblock2
Title: Kexec From Debian To Sharprom, Really Working How-to!
Post by: ant on December 29, 2008, 12:13:01 pm
Quote from: Jon_J
So you're saying I cannot boot cacko from NAND using the multiboot kernel that cortez posted with zubuntu?
...
mtd2: 03500000 00020000 "root"

For 2.4 kernels (cacko) the kernel-cmdline should contain the mtdparts string, because the old kernels cannot process the cmdline passed by atags nor appended by the (broken) bootloader.


Btw 53mb rootfs is the standard for 760 / 860 (husky and boxer).
0x03c00000-
0x00700000=
0x03500000 (=53mb)


Ant
Title: Kexec From Debian To Sharprom, Really Working How-to!
Post by: Jon_J on December 29, 2008, 12:32:44 pm
Quote from: ant
Quote from: Jon_J
So you're saying I cannot boot cacko from NAND using the multiboot kernel that cortez posted with zubuntu?
...
mtd2: 03500000 00020000 "root"

For 2.4 kernels (cacko) the kernel-cmdline should contain the mtdparts string, because the old kernels cannot process the cmdline passed by atags nor appended by the (broken) bootloader.


Btw 53mb rootfs is the standard for 760 / 860 (husky and boxer).
0x03c00000-
0x00700000=
0x03500000 (=53mb)


Ant
That goes back to my original question.
Where or how do I get the mtdparts string? It is NOT in /var/log/dmesg, like it is for the first several people in this thread.
Mine only shows: console=ttyS0 root=/dev/mtdblock2
The rest of it is missing.
When I originally flashed zubuntu, cortez said to use a copy of /boot/kernel-cmdline (from zubuntu) to boot "other" OS's
Could this be why my mtdparts string is truncated?

Thank you for your help on this. This kernel stuff and NAND stuff is all new to me.
Title: Kexec From Debian To Sharprom, Really Working How-to!
Post by: Jon_J on December 29, 2008, 12:49:36 pm
I just booted back to cacko and removed /boot/kernel-cmdline
Then I rebooted back to angstrom and then back to cacko (using kexec -f ~/zimage.bin)
This confirmed that the "kernel-cmdline" in /boot (in cacko's filesystem),
has no effect on the "kernel command line" shown in /var/log/dmesg. It is still the same.
Title: Kexec From Debian To Sharprom, Really Working How-to!
Post by: cortez on December 29, 2008, 01:31:32 pm
/boot/kernel-cmdline should contain something like: mtdparts=sharpsl-nand:7168k@0k(smf),44032k@7168k(root),-(home) jffs2_orphaned_inodes=delete. I haven't tested this, so I don't know what it should be exactly. I gladly leave this for others to find out  
Title: Kexec From Debian To Sharprom, Really Working How-to!
Post by: Jon_J on December 29, 2008, 07:59:35 pm
Quote from: cortez
/boot/kernel-cmdline should contain something like: mtdparts=sharpsl-nand:7168k@0k(smf),44032k@7168k(root),-(home) jffs2_orphaned_inodes=delete. I haven't tested this, so I don't know what it should be exactly. I gladly leave this for others to find out  
I tried this string, it's still a no go. No option shows on the menu for my cacko nand partition when booting.
I'll wait for your next release.
I noticed on the instructions page for installing zubuntu, that you have a picture of Zaurus with zubuntu on flash, on the boot menu.

I found a thread in pdaxrom that has several "different" sets of numbers in this string, and a default set of numbers.
I would paste them in here, but I don't want to confuse anyone else with these widely varying sets of numbers.
You do know most people re-partition their flash in pdax beta3 to 121MB