*

Welcome, Guest. Please login or register.

Get your own OLPC - Buy an XO laptop on eBay!
Pages: [1]
Print
Author Topic: Dual-boot Ubuntu/SD with Sugar - got it!  (Read 23875 times)

Dual-boot Ubuntu/SD with Sugar - got it!

linuxspice
Commenter

Posts: 18


January 23, 2008, 10:01:31 PM

I'm currently running build 653 of Sugar with the Q2D07 (stable) firmware on a G1G1 laptop, and over the past few days have been attempting to create a dual-boot system with Ubuntu on an SDHC card (8GB).  However, I was running into the same problem many other people were having: when booting into Ubuntu, the system would appear to freeze while loading the ramdisk.

As other posters have noted, what is actually happening is that the firmware, in its attempt to achieve a "pretty" boot sequence, "freezes" the DCON display controller directly after loading the ramdisk, which prevents the display from being updated to show the standard Linux boot messages scrolling by.  While Sugar knows to eventually "unfreeze" the display once it's ready for user input, Ubuntu doesn't do this, so the display continues to show the original "loading the ramdisk" message indefinitely.

The fix turns out to be incredibly simple.  My dual-boot olpc.fth script on the SD card (/boot/olpc.fth) now looks something like this:

Code:
\ Boot script
\ Boot from SD card if directional pad (rocker) down-arrow is pressed,
\ otherwise boot from internal NAND flash
\
game-key-mask h# 8 and if
    " sd:\boot\vmlinuz" to boot-device
    " sd:\boot\olpcrd.img" to ramdisk
    " ro root=/dev/mmcblk0p1 rootfstype=ext3 rootdelay=1 console=ttyS0,115200 console=tty0 fbcon=font:SUN12x22" to boot-file
    unfreeze
    drop
else
    " nand:\boot\vmlinuz" to boot-device
    " nand:\boot\olpcrd.img" to ramdisk
    " ro root=mtd0 rootfstype=jffs2 console=ttyS0,115200 console=tty0 fbcon=font:SUN12x22" to boot-file
then
boot

The important thing to note here is the "unfreeze" line, which directs the firmware to keep the display "unfrozen" throughout the boot process.  This is in fact the same command the firmware itself invokes to keep the display "unfrozen" when you boot into Sugar with the checkmark button pressed.  (Don't worry too much about the "drop" command; this just drops the game-key state value from the stack, since there's no need to keep it around after we've checked it and start booting into Ubuntu.)

I have chosen to use the directional pad (rocker button) down-arrow as the OS selector, simply to avoid interfering with the ever-increasing built-in functionality invoked by pressing the other buttons (see http://wiki.laptop.org/go/Cheat_codes). You may of course try other buttons or combinations thereof, but you should be aware that not all of them will work (for example, in firmware Q2D07 the checkmark button value appears to be "eaten" by the firmware before olpc.fth is executed, so it can't be detected in the usual way from within olpc.fth).  One good alternate candidate might be the square game pad key; to use this rather than the rocker button down-arrow, substitute h# 1 for h# 8 in the script above.

With a little work, this script could be updated to achieve triple-booting with an OS on a USB stick as well.

Hope this helps!
« Last Edit: January 23, 2008, 10:20:59 PM by linuxspice » Logged

#1 Re: Dual-boot Ubuntu/SD with Sugar - got it!

alanh
New

Posts: 4


January 24, 2008, 06:05:49 AM

I've been trying to get Ubuntu up and running.  When I'm setting things up, should I put the olpc.fth file in /boot/ or in /media/OLPCRoot/boot/  ?  I.e. does it go in the built-in root file system or do I put it on the card? 
Logged

#2 Re: Dual-boot Ubuntu/SD with Sugar - got it!

linuxspice
Commenter

Posts: 18


January 24, 2008, 07:29:43 AM

I've been trying to get Ubuntu up and running.  When I'm setting things up, should I put the olpc.fth file in /boot/ or in /media/OLPCRoot/boot/  ?  I.e. does it go in the built-in root file system or do I put it on the card? 

I would put it into the SD card's filesystem (i.e., into /media/OLPCRoot/boot/ when you're first setting it up).  This is because the OLPC's firmware will first check the SD card's filesystem for the olpc.fth file, and will use that one if it exists.  (If it doesn't find it, it will then try looking for it on an inserted USB key or the internal flash drive, in that order.)

Although I haven't tried it yet, it should also be possible to *omit* the olpc.fth file entirely from the SD card, in which case the firmware will use the *internal* flash drive's olpc.fth file instead (suitably modified to allow booting from either the internal flash or the SD card, of course).  One problem with that approach, however, is that the internal flash's olpc.fth will be reset to the default version any time you re-flash the internal drive (e.g. when updating to a new version of Sugar), so you'd have to keep modifying it again with every re-flash of the internal drive.  And that would get old after a while.  :-)
Logged

#3 Re: Dual-boot Ubuntu/SD with Sugar - got it!

alanh
New

Posts: 4


January 24, 2008, 03:58:25 PM

Hmmm.   Well, I've restored the /boot/olpc.fth to its factory status, put your version on the SD card, but whenever I boot up, it's always booting off of the nand and goes directly into Sugar. 

I think I've followed the directions on http://olpcnews.com/forum/index.php?topic=1436.0 for general ubuntu installation to the card.  I know I see what looks like the root directory of a standard linux install when I do "ls /media/OLPCRoot" from the command line.

when I reboot holding down the "down" game key, it says "Can't open disk label package"  and it proceeds to boot off of nand into Sugar. 

If I hit escape and try to boot by typing "boot sd:\boot\vmlinuz" from he "ok " prompt,

it says "Can't open disk label package" "Can't open boot device" and returns me to "ok ".

Anyone have any additional hints?  Do I need to try a different SD card or something?

-a
Logged

#4 Re: Dual-boot Ubuntu/SD with Sugar - got it!

linuxspice
Commenter

Posts: 18


January 24, 2008, 05:17:56 PM

I'm sorry you're still having trouble... I hope I didn't mess something up when posting that script.

I did some poking around, and am beginning to wonder about something (a possible failure point or two).  If it wouldn't be too much trouble, I'd like to ask you to post all of the following five things here so I or someone else can try to help you further (and don't worry, none of this will compromise your privacy):

* What make and model number is your SD card?

* What firmware revision does your OLPC have?  (can be seen on startup)

* From the Sugar terminal, and with the SD card mounted, enter the command "df". What is the output?

* Enter the command "fdisk -l /dev/mmcblk0". What is the output?

* Enter the command "dumpe2fs -h /dev/mmcblk0p1".  What is the output?
Logged

#5 Re: Dual-boot Ubuntu/SD with Sugar - got it!

sracer
Master Contributor
***
Posts: 286


January 24, 2008, 07:29:53 PM

Hmm.  I followed the instructions to install Ubuntu on an SD card and didn't encounter any of those problems.  I wonder if it is because I had installed the developer key and permanently disabled the security feature.
Logged

#6 Re: Dual-boot Ubuntu/SD with Sugar - got it!

gameguy43
Commenter

Posts: 9


pyrak


WWW
January 24, 2008, 08:03:35 PM

you are my hero.  that did it!  thank you so much.
Logged

pyrak

#7 Re: Dual-boot Ubuntu/SD with Sugar - got it!

alanh
New

Posts: 4


January 25, 2008, 07:37:20 AM

Just to be clear, it's not your olpc.fth that's messing up.  I'm sure it's something wrong with what I've done or maybe with my card.  Here's the information you requested:

SD card is a generic "connect 3D" card.  It mounts as EXT3 when I put it in a flash drive and connect it to my desktop Ubuntu box.

OLPC firmware is OpenFirmware  CL1 Q2D06 Q2D  (I also updated to build 653 if that's what you mean)

Filesystem           1K-blocks      Used Available Use% Mounted on
mtd0                   1048576    598328    450248  58% /
tmpfs                    35676         0     35676   0% /dev/shm
/dev/mmcblk0p1         1961328    642124   1219572  35% /media/OLPCRoot

Disk /dev/mmcblk0: 2040 MB, 2040528896 bytes
255 heads, 63 sectors/track, 248 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

        Device Boot      Start         End      Blocks   Id  System
/dev/mmcblk0p1   *           1         249     1992672+  a8  Darwin UFS
Partition 1 has different physical/logical endings:
     phys=(1023, 254, 63) logical=(248, 20, 28)
Filesystem volume name:   OLPCRoot
Last mounted on:          <not available>
Filesystem UUID:          955b74ff-207b-43fd-b914-f3a3cfa3220e
Filesystem magic number:  0xEF53
Filesystem revision #:    1 (dynamic)
Filesystem features:      has_journal resize_inode dir_index filetype needs_recovery sparse_super large_file
Filesystem flags:         signed directory hash
Default mount options:    (none)
Filesystem state:         clean
Errors behavior:          Continue
Filesystem OS type:       Linux
Inode count:              249344
Block count:              498168
Reserved block count:     24908
Free blocks:              329801
Free inodes:              208819
First block:              0
Block size:               4096
Fragment size:            4096
Reserved GDT blocks:      121
Blocks per group:         32768
Fragments per group:      32768
Inodes per group:         15584
Inode blocks per group:   487
Filesystem created:       Wed Jan 23 13:39:45 2008
Last mount time:          Fri Jan 25 23:20:45 2008
Last write time:          Fri Jan 25 23:20:45 2008
Mount count:              16
Maximum mount count:      35
Last checked:             Wed Jan 23 13:39:45 2008
Check interval:           15552000 (6 months)
Next check after:         Mon Jul 21 14:39:45 2008
Reserved blocks uid:      0 (user root)
Reserved blocks gid:      0 (group root)
First inode:              11
Inode size:        128
Journal inode:            8
Default directory hash:   tea
Directory Hash Seed:      4c741271-1703-4bd3-9af5-d103a0f6277d
Journal backup:           inode blocks
Journal size:             32M


Logged

#8 Re: Dual-boot Ubuntu/SD with Sugar - got it!

linuxspice
Commenter

Posts: 18


January 25, 2008, 10:58:55 PM

From what I can tell, everything looks good except for one thing: the partition type code is set to a8 (Darwin UFS) when it should be 83 (Linux ext2/3).  While the Linux kernel is smart enough to recognize an ext3 filesystem when it sees one, no matter what the partition table says (which is why you're able to mount the filesystem from within Sugar), the boot firmware is pickier and is probably rejecting the SD card as a boot candidate out of hand.  To change the partition type code from Sugar, you will need to "su" to root and run fdisk on your card ("fdisk /dev/mmcblk0").  Please let me know if that works.

By the way, you should also upgrade your firmware to version Q2D07 or later as soon as possible, since the version you have (Q2D06) has a known problem that can result in bricking the laptop under certain circumstances (!)  See the http://wiki.laptop.org/go/Firmware page for a list of the available revisions and links to upgrading instructions.
Logged

#9 Re: Dual-boot Ubuntu/SD with Sugar - got it!

alanh
New

Posts: 4


January 26, 2008, 07:52:19 AM

Changing the fs to '83' (EXT3) worked, and now I have successfully booted my OLPC into Xubuntu. 

Thanks for your help.

At startup, the network doesn't work and the touchpad is way, way too sensitive. I was able to fix the latter in the XFCE settings, but I didn't see the friendly Ubuntu networking GUI stuff.  I was able to get networking up by doing "sudo dhclient eth3" from a command line, but that's decidely unfriendly. 

Am I just missing the settings in a menu somewhere? 


Logged

#10 Re: Dual-boot Ubuntu/SD with Sugar - got it!

sracer
Master Contributor
***
Posts: 286


January 26, 2008, 09:59:03 AM

Changing the fs to '83' (EXT3) worked, and now I have successfully booted my OLPC into Xubuntu. 

Thanks for your help.

At startup, the network doesn't work and the touchpad is way, way too sensitive. I was able to fix the latter in the XFCE settings, but I didn't see the friendly Ubuntu networking GUI stuff.  I was able to get networking up by doing "sudo dhclient eth3" from a command line, but that's decidely unfriendly. 

Am I just missing the settings in a menu somewhere? 
There's a network connection button on the lower right corner of the screen (next to the virtual desktop buttons)
Logged

#11 Re: Dual-boot Ubuntu/SD with Sugar - got it!

jbeard
Commenter

Posts: 17


February 26, 2008, 09:38:31 AM

I'm currently running build 653 of Sugar with the Q2D07 (stable) firmware on a G1G1 laptop, and over the past few days have been attempting to create a dual-boot system with Ubuntu on an SDHC card (8GB).  However, I was running into the same problem many other people were having: when booting into Ubuntu, the system would appear to freeze while loading the ramdisk.

As other posters have noted, what is actually happening is that the firmware, in its attempt to achieve a "pretty" boot sequence, "freezes" the DCON display controller directly after loading the ramdisk, which prevents the display from being updated to show the standard Linux boot messages scrolling by.  While Sugar knows to eventually "unfreeze" the display once it's ready for user input, Ubuntu doesn't do this, so the display continues to show the original "loading the ramdisk" message indefinitely.

The fix turns out to be incredibly simple.  My dual-boot olpc.fth script on the SD card (/boot/olpc.fth) now looks something like this:

Code:
\ Boot script
\ Boot from SD card if directional pad (rocker) down-arrow is pressed,
\ otherwise boot from internal NAND flash
\
game-key-mask h# 8 and if
    " sd:\boot\vmlinuz" to boot-device
    " sd:\boot\olpcrd.img" to ramdisk
    " ro root=/dev/mmcblk0p1 rootfstype=ext3 rootdelay=1 console=ttyS0,115200 console=tty0 fbcon=font:SUN12x22" to boot-file
    unfreeze
    drop
else
    " nand:\boot\vmlinuz" to boot-device
    " nand:\boot\olpcrd.img" to ramdisk
    " ro root=mtd0 rootfstype=jffs2 console=ttyS0,115200 console=tty0 fbcon=font:SUN12x22" to boot-file
then
boot

The important thing to note here is the "unfreeze" line, which directs the firmware to keep the display "unfrozen" throughout the boot process.  This is in fact the same command the firmware itself invokes to keep the display "unfrozen" when you boot into Sugar with the checkmark button pressed.  (Don't worry too much about the "drop" command; this just drops the game-key state value from the stack, since there's no need to keep it around after we've checked it and start booting into Ubuntu.)

I have chosen to use the directional pad (rocker button) down-arrow as the OS selector, simply to avoid interfering with the ever-increasing built-in functionality invoked by pressing the other buttons (see http://wiki.laptop.org/go/Cheat_codes). You may of course try other buttons or combinations thereof, but you should be aware that not all of them will work (for example, in firmware Q2D07 the checkmark button value appears to be "eaten" by the firmware before olpc.fth is executed, so it can't be detected in the usual way from within olpc.fth).  One good alternate candidate might be the square game pad key; to use this rather than the rocker button down-arrow, substitute h# 1 for h# 8 in the script above.

With a little work, this script could be updated to achieve triple-booting with an OS on a USB stick as well.

Hope this helps!


Perfect! This absolutely did the trick for me.

Jake
Logged

#12 Re: Dual-boot Ubuntu/SD with Sugar - got it!

HarshReality
New

Posts: 4


June 01, 2008, 10:37:06 AM

Im using the "latest and greatest" firmware (14 I think) and cant get this to work correctly for hte life of me... can somebody hang their actual file for me to get at as I think it might be an editing/spacing error on my part.. or even email it to [email protected]

Ideally I liked the original idea of haveing a tri-boot option (standard sugar, alt boot & XFCE Ubuntu) but as this is for my 11yr old who I'd like to learn linux early Im not picky at all... HOPEFULLY she will bypass the "MS dependancy" that some of us older generation folks have caught.
Logged

#13 Re: Dual-boot Ubuntu/SD with Sugar - got it!

PiForEver
Contributor
*
Posts: 60


I like pi(e)


November 04, 2008, 01:35:24 PM

I'm currently running build 653 of Sugar with the Q2D07 (stable) firmware on a G1G1 laptop, and over the past few days have been attempting to create a dual-boot system with Ubuntu on an SDHC card (8GB).  However, I was running into the same problem many other people were having: when booting into Ubuntu, the system would appear to freeze while loading the ramdisk.

As other posters have noted, what is actually happening is that the firmware, in its attempt to achieve a "pretty" boot sequence, "freezes" the DCON display controller directly after loading the ramdisk, which prevents the display from being updated to show the standard Linux boot messages scrolling by.  While Sugar knows to eventually "unfreeze" the display once it's ready for user input, Ubuntu doesn't do this, so the display continues to show the original "loading the ramdisk" message indefinitely.

The fix turns out to be incredibly simple.  My dual-boot olpc.fth script on the SD card (/boot/olpc.fth) now looks something like this:

Code:
\ Boot script
\ Boot from SD card if directional pad (rocker) down-arrow is pressed,
\ otherwise boot from internal NAND flash
\
game-key-mask h# 8 and if
    " sd:\boot\vmlinuz" to boot-device
    " sd:\boot\olpcrd.img" to ramdisk
    " ro root=/dev/mmcblk0p1 rootfstype=ext3 rootdelay=1 console=ttyS0,115200 console=tty0 fbcon=font:SUN12x22" to boot-file
    unfreeze
    drop
else
    " nand:\boot\vmlinuz" to boot-device
    " nand:\boot\olpcrd.img" to ramdisk
    " ro root=mtd0 rootfstype=jffs2 console=ttyS0,115200 console=tty0 fbcon=font:SUN12x22" to boot-file
then
boot

The important thing to note here is the "unfreeze" line, which directs the firmware to keep the display "unfrozen" throughout the boot process.  This is in fact the same command the firmware itself invokes to keep the display "unfrozen" when you boot into Sugar with the checkmark button pressed.  (Don't worry too much about the "drop" command; this just drops the game-key state value from the stack, since there's no need to keep it around after we've checked it and start booting into Ubuntu.)

I have chosen to use the directional pad (rocker button) down-arrow as the OS selector, simply to avoid interfering with the ever-increasing built-in functionality invoked by pressing the other buttons (see http://wiki.laptop.org/go/Cheat_codes). You may of course try other buttons or combinations thereof, but you should be aware that not all of them will work (for example, in firmware Q2D07 the checkmark button value appears to be "eaten" by the firmware before olpc.fth is executed, so it can't be detected in the usual way from within olpc.fth).  One good alternate candidate might be the square game pad key; to use this rather than the rocker button down-arrow, substitute h# 1 for h# 8 in the script above.

With a little work, this script could be updated to achieve triple-booting with an OS on a USB stick as well.

Hope this helps!

What do you do with the script. I would like to add ubuntu to my xo but would need a "total idiot's guide" type of thing to do it. I have close to no linux expeirence and would love it if someone tell exactally what to do. Thanks Wink Wink Wink Cheesy Cheesy Cheesy Smiley Smiley Wink Cheesy
Logged

Me+Pie+Linux= Smiley
Pages: [1]
Print
Jump to:  

Members
Total Members: 2406
Latest: sembik
Stats
Total Posts: 31943
Total Topics: 3843
Online Today: 25
Online Ever: 238
(April 18, 2011, 09:48:50 PM)
Users Online
Users: 0
Guests: 21
Total: 21