Difference between revisions of "Talk:Sugar Creation Kit/sck/Advanced Topics"

From Sugar Labs
Jump to navigation Jump to search
m (delete entry)
 
(8 intermediate revisions by 3 users not shown)
Line 1: Line 1:
Sugar on a Raspberry pi is "functional" and testable by children (in progress).
 
  
== Test report ==
+
==Ubuntu on Chromebook==
 +
*Copied from: https://plus.google.com/109993695638569781190/posts/b2fazijJppZ
 +
Olof Johansson
 +
Oct 28, 2012 (edited)  -  Public
 +
[edited to fix some typos and the cgpt commandline and setting sector alignment]
  
Product of the command
+
Sunday night is "Hack your Chromebook" time!                                                                                                                                                                     
    sweets  sdk/sugar:emulator
 
Raspberry pi, running OS from  http://www.raspbian.org/ (pisces image)
 
  
Sweets, following these instructions [[Platform_Team/Guide/Sugar_via_Sweets]]
+
A word of caution: be careful, there are some ways in which you can mess up your system below, in particular the steps that partitions and writes data to the SD card. If you're unsure of what you're doing, you're better off waiting until someone refines the instructions and makes them more user friendly.
  
From my computer
+
I got Ubuntu installed on my ARM Chromebook tonight. Here's a messy brain dump of what I did. The system was already in devmode when I started (see http://goo.gl/TSZxs for info on how to achieve that). I also already had a tarball of an Ubuntu filesystem, created with the "rootstock" tool. [edit: you can use the distributed ubuntu-core tarball directly from ubuntu as well, and then install additional packages on top]
::Build: Debian GNU/Linux testing/unstable
 
::Sugar: 0.94.1
 
  
All Function keys, F1 to 6, work fine
+
Get an SD card, insert it in a reader on your Ubuntu PC (mine was a 16GB card that ended up at /dev/sdd on the PC, so the below reflects that):
  
Avatars seen correctly without error.
+
First, the SD card needs a GPT partition table. I'm lazy and mixed tools here to make it easy for myself. First, I created the blank partition table in parted:
  
Software Updates fully functional.
+
# sudo parted /dev/sdd
 +
(parted) mktable gpt
 +
(parted) quit
  
Calculate.activity  v.40        Starts and Resumes
+
Then edit it with gdisk (apt-get install gdisk), since the syntax is close to what I am used with regular cfdisk. The first part sets the sector alignment to 4M based on the recommendation from Arnd in the comments below:
  
Chat.activity        v.77      Starts and Resumes
+
sudo gdisk /dev/sdd
 +
x
 +
l
 +
8192
 +
m
  
HorseGame.activity      v.4    Starts and Resumes
+
n
 +
1
 +
<enter>
 +
+16M
 +
7f00    (ChromeOS kernel)
  
IRC.activity        v.10        Starts and Resumes
+
n
 +
2
 +
<enter>
 +
+16M
 +
7f00
  
Log                v.29        Starts and Resumes
+
n
 +
3
 +
<enter>
 +
<enter>
 +
<enter>
  
Labyrinth.activity  v.12        Starts and Resumes
+
This creates three partitions; two kernel ones and one for the root filesystem. I wanted two kernel partitions to make it easier to tinker with the kernel and have a fallback to a known-good kernel in case the one being tested fails.
  
Maze.activity          v.21    Starts and Resumes
 
  
Memorize.activity      v.4    Starts and Resumes
+
Then, create a filesystem on the root partition:
  
Moon.activity          v.14    Starts and Resumes
+
sudo mkfs.ext4 /dev/sdd3
  
Pippy.activity          v.49    Starts and Resumes
+
mount /dev/sdd3 somewhere and extract your rootstock filesystem to it:
 +
sudo mount /dev/sdd3 /mnt
 +
cd /mnt
 +
sudo tar xvpf /work/rootstock/armel.tar.gz
  
SprayPlay.activity      v.2    Starts and Resumes
+
Then, since we are going to use the same kernel as we boot Chrome
 +
OS with, copy over the contents from /lib/modules and /lib/firmware
 +
from your running system into the same location on the SD card
 +
(i.e. /mnt/lib/modules /mnt/lib/firmware). I did it by creating a tarball
 +
on the Chrome OS machine and scp:ing it over to my PC. I'll leave the
 +
details as an exercise for the reader here.
  
SugarCommander.activity v.8    Starts and Resumes
+
Now the only remaining piece is to put an actual kernel on the kernel
 +
partitions of the SD card.
  
Terminal.activity      v.40    Starts and Resumes
+
This is something I did on my Chromebook system directly. Be VERY careful here, mmcblk1 and mmcblk0 are very easy to mistype, and you won't like the results from doing it (I nuked my stateful partition by mistake once when I went through this because I dd:d a kernel to mmcblk0p1 instead of mmcblk1p1).
  
Turtle Art              v.149  Starts and Resumes
+
The kernel command line is going to be different from what you use for
 +
Chrome OS, so you'll need to repack the kernel blob manually first. This
 +
is what I did:
  
TurtleConfusion.activity v.10    Starts and Resumes
+
cd /tmp
 +
echo "console=tty1 debug verbose root=/dev/mmcblk1p3 rootwait rw" > /tmp/config
 +
vbutil_kernel --pack /tmp/newkern --keyblock /usr/share/vboot/devkeys/kernel.keyblock --version 1 --signprivate /usr/share/vboot/devkeys/kernel_data_key.vbprivk --config=/tmp/config --vmlinuz /boot/vmlinuz-3.4.0 --arch arm
  
Surf.activity          v.115          Reports, Failed to start.
+
Then I moved the SD card to the Chromebook, and wrote out the kernel:
  
ImportError: No module named webkit
+
dd if=/tmp/newkern of=/dev/mmcblk1p1
To fix tried:
+
dd if=/tmp/newkern of=/dev/mmcblk1p2
sudo apt-get install libwebkitgtk-3.0-dev
 
which added
 
gir1.2-javascriptcoregtk-3.0 gir1.2-soup-2.4 gir1.2-webkit-3.0 libgtk-3-dev libjavascriptcoregtk-3.0-dev libsoup2.4-dev libwebkitgtk-3.0-dev libxml2-dev
 
But error persists:
 
ImportError: No module named webkit
 
  
Earlier in the process, to fix:
+
Now, enable boot from "USB" (which includes SD card on these systems):
 +
crossystem dev_boot_usb=1
  
ImportError: No module named vte
+
Final step is to mark the partitions on the SD card as known good so
ImportError: No module named gst
+
that the firmware will try to boot them:
ImportError: No module named pygame
 
  
sudo apt-get install python-vte python-gst0.10 python-pygame
+
cgpt add -i 1 -S 1 -T 5 -P 10 -l KERN-A /dev/mmcblk1
 +
cgpt add -i 2 -S 1 -T 5 -P 5 -l KERN-B /dev/mmcblk1
  
--[[User:Inkyfingers|Inkyfingers]] 06:35, 25 June 2012 (EDT)
+
I.e. mark both as successful, first partition as priority 10, second
== Help with install on IRC ==
+
as priority 5. I don't think tries are technically needed here since
*from IRC with permission--[[User:Satellit|Satellit]] 08:01, 22 June 2012 (EDT)
+
the partition is already marked as successful, but I included it by
*Based on these instructions: http://wiki.sugarlabs.org/go/Platform_Team/Guide/Sugar_via_Sweets
+
habit. Same with the label names, they shouldn't be needed.
<inkyfingers> Image from: http://www.raspbian.org/
+
 
<inkyfingers> is Debian Hard Float (armhf) for RPi
+
Then reboot. At the devmode screen, you type ctrl-u to load the kernel
<inkyfingers> Is armhf likely to be a problem for <sweets>?
+
and boot from the SD card.
<alsroot> inkyfingers: I didn't try to run sugar on arm. OLPC people support it but I dunno do they use sugar directly from upstream brunches (what was used for sweets (not SD)) or not
+
 
<inkyfingers> #644010 is now marked fixed - so wheezy seems fine to me with python 2.7 - I believe eliminated.
+
After a few seconds, you'll get the kernel log on the console, followed by
<alsroot> btw, whats exact sugar version you are running on Raspberry?
+
(depending on what you have on your root filesystem) a login prompt. I
<inkyfingers> Ok tried sdk/sugar and dextrose/
+
had a very minimal install without X-windows first, so I just got a text login prompt. I later installed ubuntu-desktop, and it will boot up to login prompt and let you login with an UI environment. The trackpad isn't behaving perfectly though, so there's some tuning to be done.
<inkyfingers> dextrose marginally more success.
+
 
<inkyfingers> * Booting Rpi ... will try to ssh for notes . I tested Sugar 0.88 and 0.94
+
I'm sure there will be others more than happy to carry the flag on getting this going nice and smoothly from here though. I'm also looking forward to getting reports of other distros being functional, so bring them on!
...
 
<inkyfingers>  raspbian@pisces:~$ sweets  dextrose/sugar:emulator
 
<inkyfingers> Xephyr on :30.0
 
<inkyfingers> About my computer:
 
<inkyfingers> Build: Debian GNU/Linux testing/unstable
 
<inkyfingers> Sugar: 0.88.1
 
...
 
<inkyfingers> I will try to write only about sweets  dextrose/sugar:emulator ...
 
<inkyfingers> F1 to F6 all fine ok
 
<alsroot> thats fine..
 
<alsroot> though, in my mind SD, finally, is more useful way to start sugar itself. but unfortunately, it does not [yet]support arm
 
<inkyfingers> I could see no avatars in F1 in dextrose <seen fine in sdk, 0.94>
 
<inkyfingers> I have no Activities in F3
 
<alsroot> for activities, you can unzip some of them (that are pure python) to ~/Activities
 
<inkyfingers> That would be a good next step.
 
<inkyfingers> Two usb ports are used by mouse and kbd. I will prepare a USB stick next and try that out.
 
<alsroot> inkyfingers: btw, how long it took to build sugar via "sweets" command?
 
<inkyfingers> Over 8 or 9 mins of 100% CPU
 
<inkyfingers> sorry ssh into my rubbish notes is hard !! I keep not finding what I want!
 
<inkyfingers> raspbian@pisces:~$ sweets  sdk/sugar:emulator
 
<inkyfingers> -- Solve sdk/sugar-artwork for building
 
<inkyfingers> -- Solve sdk/sugar-base for building
 
<inkyfingers> -- Solve sdk/sugar-toolkit for building
 
<inkyfingers> -- Solve sdk/sugar-datastore for building
 
<inkyfingers> -- Solve sdk/telepathy-mission-control for building
 
<inkyfingers> -- Solve sdk/sugar for building
 
<inkyfingers> -- Build sdk/sugar-artwork (0.94.0)
 
<inkyfingers> -- Build sdk/sugar-base (0.94.0)
 
<inkyfingers> -- Build sdk/sugar-toolkit (0.94.0)
 
<inkyfingers> -- Build sdk/sugar-datastore (0.94.0)
 
<inkyfingers> -- Build sdk/telepathy-mission-control (5.7.1)
 
<inkyfingers> -- Build sdk/sugar (0.94.1)
 
<inkyfingers> this made me think Activities should be on-board?
 
<alsroot> inkyfingers: nope, this way you can't install activities
 
<alsroot> dunno will Browse work on or not (to open ASLO), but just download .xo files to unzip them to ~/Activities
 
<inkyfingers> So that trace was just my first successful launch
 
<inkyfingers> df -h (before that command)
 
<inkyfingers> Filesystem      Size  Used Avail Use% Mounted on
 
<inkyfingers> rootfs          3.3G  2.1G  1.1G  68% /
 
<inkyfingers> now
 
<inkyfingers> rootfs          3.3G  2.2G  985M  69% /
 

Latest revision as of 21:52, 28 October 2013

Ubuntu on Chromebook

Olof Johansson Oct 28, 2012 (edited) - Public [edited to fix some typos and the cgpt commandline and setting sector alignment]

Sunday night is "Hack your Chromebook" time!

A word of caution: be careful, there are some ways in which you can mess up your system below, in particular the steps that partitions and writes data to the SD card. If you're unsure of what you're doing, you're better off waiting until someone refines the instructions and makes them more user friendly.

I got Ubuntu installed on my ARM Chromebook tonight. Here's a messy brain dump of what I did. The system was already in devmode when I started (see http://goo.gl/TSZxs for info on how to achieve that). I also already had a tarball of an Ubuntu filesystem, created with the "rootstock" tool. [edit: you can use the distributed ubuntu-core tarball directly from ubuntu as well, and then install additional packages on top]

Get an SD card, insert it in a reader on your Ubuntu PC (mine was a 16GB card that ended up at /dev/sdd on the PC, so the below reflects that):

First, the SD card needs a GPT partition table. I'm lazy and mixed tools here to make it easy for myself. First, I created the blank partition table in parted:

  1. sudo parted /dev/sdd

(parted) mktable gpt (parted) quit

Then edit it with gdisk (apt-get install gdisk), since the syntax is close to what I am used with regular cfdisk. The first part sets the sector alignment to 4M based on the recommendation from Arnd in the comments below:

sudo gdisk /dev/sdd x l 8192 m

n 1 <enter> +16M 7f00 (ChromeOS kernel)

n 2 <enter> +16M 7f00

n 3 <enter> <enter> <enter>

This creates three partitions; two kernel ones and one for the root filesystem. I wanted two kernel partitions to make it easier to tinker with the kernel and have a fallback to a known-good kernel in case the one being tested fails.


Then, create a filesystem on the root partition:

sudo mkfs.ext4 /dev/sdd3

mount /dev/sdd3 somewhere and extract your rootstock filesystem to it: sudo mount /dev/sdd3 /mnt cd /mnt sudo tar xvpf /work/rootstock/armel.tar.gz

Then, since we are going to use the same kernel as we boot Chrome OS with, copy over the contents from /lib/modules and /lib/firmware from your running system into the same location on the SD card (i.e. /mnt/lib/modules /mnt/lib/firmware). I did it by creating a tarball on the Chrome OS machine and scp:ing it over to my PC. I'll leave the details as an exercise for the reader here.

Now the only remaining piece is to put an actual kernel on the kernel partitions of the SD card.

This is something I did on my Chromebook system directly. Be VERY careful here, mmcblk1 and mmcblk0 are very easy to mistype, and you won't like the results from doing it (I nuked my stateful partition by mistake once when I went through this because I dd:d a kernel to mmcblk0p1 instead of mmcblk1p1).

The kernel command line is going to be different from what you use for Chrome OS, so you'll need to repack the kernel blob manually first. This is what I did:

cd /tmp echo "console=tty1 debug verbose root=/dev/mmcblk1p3 rootwait rw" > /tmp/config vbutil_kernel --pack /tmp/newkern --keyblock /usr/share/vboot/devkeys/kernel.keyblock --version 1 --signprivate /usr/share/vboot/devkeys/kernel_data_key.vbprivk --config=/tmp/config --vmlinuz /boot/vmlinuz-3.4.0 --arch arm

Then I moved the SD card to the Chromebook, and wrote out the kernel:

dd if=/tmp/newkern of=/dev/mmcblk1p1 dd if=/tmp/newkern of=/dev/mmcblk1p2

Now, enable boot from "USB" (which includes SD card on these systems): crossystem dev_boot_usb=1

Final step is to mark the partitions on the SD card as known good so that the firmware will try to boot them:

cgpt add -i 1 -S 1 -T 5 -P 10 -l KERN-A /dev/mmcblk1 cgpt add -i 2 -S 1 -T 5 -P 5 -l KERN-B /dev/mmcblk1

I.e. mark both as successful, first partition as priority 10, second as priority 5. I don't think tries are technically needed here since the partition is already marked as successful, but I included it by habit. Same with the label names, they shouldn't be needed.

Then reboot. At the devmode screen, you type ctrl-u to load the kernel and boot from the SD card.

After a few seconds, you'll get the kernel log on the console, followed by (depending on what you have on your root filesystem) a login prompt. I had a very minimal install without X-windows first, so I just got a text login prompt. I later installed ubuntu-desktop, and it will boot up to login prompt and let you login with an UI environment. The trackpad isn't behaving perfectly though, so there's some tuning to be done.

I'm sure there will be others more than happy to carry the flag on getting this going nice and smoothly from here though. I'm also looking forward to getting reports of other distros being functional, so bring them on!