*

Welcome, Guest. Please login or register.

Get your own OLPC - Buy an XO laptop on eBay!
Pages: 1 ... 3 4 5 [6] 7 8
Print
Author Topic: Microcore linux for the XO-1 and XO-1.5  (Read 60301 times)

#75 Re: Microcore linux for the XO-1 and XO-1.5

rbacher
Contributor
*
Posts: 31


July 30, 2010, 09:09:19 AM

Yes, I was using quozl's  microcore-2.8-xo-1-2010-01-28.  So now at least I know what the problem was.  That version of microcore was the only one I could find that was set up and ready to go.  I'm not sure I can built my own.  I will give it a try later (the server is down again anyway so I can't get to the files right now).

As to removing "superuser" from olpc.fth, I did figure that part out on my own by sheer "hit and miss" experimentation a couple of days ago.  The "hit and miss" technique is all too common (and time consuming) as I wander through the world of computers!  Eventually I usually "hit" the right answer, but I must have a hundred "misses" to get there.

Thank you for answering all my posts.  I appreciate your help.
Logged

#76 Re: Microcore linux for the XO-1 and XO-1.5

mavrothal
Administrator
OLPC News Forum Expert
*****
Posts: 1289


July 30, 2010, 10:46:31 AM

That version of microcore was the only one I could find that was set up and ready to go.  I'm not sure I can built my own.
 
Sure you can!
Below is quozl's script a bit modified to build the latest 3.0 microcore with the latest olpc kernel that supports squashfs
Make it executable (sudo chmod 755 mktinycorexo) and run it as sudo in a linux system (sudo ./mktinycorexo --xo-1)
will build you a microcore 3.0 for the XO-1!
Take the "boot" folder that in in the "output" folder that the scripts generates, transfer it to a USB stick and boot.
You can take it from there.

mktinycorexo
Code:
#!/bin/bash
#
# Tiny Core Linux 3.0 target system builder for OLPC XO-1.5
# Copyright (C) 2010  James Cameron ([email protected])
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
#
set -e

# local defaults


# the block device to create the partition on
# (ignored if it does not exist)
DEVICE=/dev/disk/by-id/usb-DSE_Micro_Drive_0000000000002F-0:0-part1

# your wireless network
ESSID=


# option defaults

# use a local cache of upstream files on your build system
# (--no-cache turns this off and verifies cache against upstream)
CACHE=yes

# additional kernel options
# see http://wiki.tinycorelinux.com/tiki-index.php?page=Boot+Options
# fbcon=font:SUN12x22, the same console font as the OLPC builds
# superuser, boots to a root shell
# quiet, reduces verbosity during boot
CMDLINE="fbcon=font:SUN12x22 waitusb=10 text"


# upstream versions

# the build from which to obtain matching kernel, modules and firmware
# (corresponds to an rsync module name on rsync://updates.laptop.org/)
OLPC_OS_BUILD=build-10.1.2_xo1.5-302

# the kernel version string in that build
# see uname --release
OLPC_OS_KERNEL=.6.31_xo1.5-20100607.1740.1.olpc.ead3d3e

# the wireless firmware blob
OLPC_FW_WIRELESS=sd8686.bin

# the tinycore variant; tinycore or microcore
VARIANT=microcore

# version of this script
VERSION=2010-01-28

# where to unpack the tinycore initrd tree
# (is not kept)
TREE=/tmp/${VARIANT}.tree.$$

# where to create the new tinycore initrd
# (is not kept)
INITRD=/tmp/${VARIANT}.gz.$$


function license {
    cat <<EOF
Tiny Core Linux target system builder for OLPC XO-1.5, ${VERSION}
Copyright (C) 2010  James Cameron ([email protected])

This program comes with ABSOLUTELY NO WARRANTY; for details see source.
This is free software, and you are welcome to redistribute it under
certain conditions; see source for details.

EOF
}

function usage {
    cat <<EOF
build [options] [device]

device         optional block device to create boot partition on.
               (otherwise you must copy output/boot to a device yourself)

--no-cache     ignores the local cache previously built.
               (verifies cache against upstream)

--essid id     associate to a wireless network during boot.

--version      displays script version.

--license      displays license.

--help         displays this what you are looking at, mate.
EOF
}

# process options and arguments
while [ ! -z "${1}" ]; do
    case "${1}" in
--xo-1)
    shift
    OLPC_OS_BUILD=build-10.1.2_xo1-302
    OLPC_OS_KERNEL=2.6.31_xo1-20100714.1740.1.olpc.1eac9a942c72b10
    OLPC_FW_WIRELESS=usb8388.bin
    ;;
--essid)
    shift
    ESSID=${1}
    shift
    ;;
--no-cache)
    shift
    CACHE=no
    ;;
--help)
    usage
    exit 0
    ;;
--license)
    license
    exit 0
    ;;
--version)
    echo ${VERSION}
    exit 0
    ;;
*)
    DEVICE=${1}
    shift
    if [ ! -e ${DEVICE} ]; then
echo "build: no such device ${DEVICE}"
exit 1
    fi
    esac

done

license

# build the cache
mkdir -p cache
mkdir -p cache/boot
mkdir -p cache/lib/modules
mkdir -p cache/lib/firmware

if [ $CACHE = no ]; then
    echo "fetch"
fi

if [ $CACHE = no -o ! -e cache/${VARIANT}.gz ]; then
    rsync --archive --checksum --quiet rsync://distro.ibiblio.org/distros/tinycorelinux/3.x/release/distribution_files/${VARIANT}.gz cache/
fi

if [ $CACHE = no -o ! -e cache/boot/vmlinuz-${OLPC_OS_KERNEL} ]; then
    if [ -e /boot/vmlinuz-${OLPC_OS_KERNEL} ]; then
echo "using kernel from this system"
cp --archive /boot/vmlinuz-${OLPC_OS_KERNEL} cache/boot/
    fi

    rsync --archive --checksum rsync://updates.laptop.org/${OLPC_OS_BUILD}/root/boot/vmlinuz-${OLPC_OS_KERNEL} cache/boot/
fi

if [ $CACHE = no -o ! -e cache/lib/modules/${OLPC_OS_KERNEL} ]; then
    if [ -e /lib/modules/${OLPC_OS_KERNEL} ]; then
echo "using modules from this system"
cp --archive /lib/modules/${OLPC_OS_KERNEL} cache/lib/modules/
    fi

    rsync --archive --checksum rsync://updates.laptop.org/${OLPC_OS_BUILD}/root/lib/modules/${OLPC_OS_KERNEL} cache/lib/modules/
fi

if [ $CACHE = no -o ! -e cache/lib/firmware/${OLPC_FW_WIRELESS} ]; then
    if [ -e /lib/firmware/${OLPC_FW_WIRELESS} ]; then
echo "using wireless firmware from this system"
cp --archive /lib/firmware/${OLPC_FW_WIRELESS/.bin/*} cache/lib/firmware/
    fi

    rsync --archive --checksum rsync://updates.laptop.org/${OLPC_OS_BUILD}/root/lib/firmware/${OLPC_FW_WIRELESS/.bin/*} cache/lib/firmware/
fi

function encapsulate {
    bin=${1}
    BIN=$(basename ${bin})

    # ignore if the binary is already present
    if [ -x bin/${BIN} -o -x sbin/${BIN} ]; then return; fi

    # make a wrapper
    cat > bin/${BIN} <<EOF
#!/bin/sh
LD_LIBRARY_PATH=/lib:/foreign /foreign/${BIN} \$*
EOF
    chmod +x bin/${BIN}

    # copy the binary and required libraries
    mkdir -p foreign
    cp -p ${bin} foreign/

    for lib in `ldd ${bin}|egrep -v "linux-gate|ld-linux"|awk '{print $3}'`; do
LIB=$(basename ${lib})
if [ -x foreign/${LIB} ]; then continue; fi
if [ ! -x lib/${LIB} -a ! -x usr/lib/${LIB} ]; then
    cp -p ${lib} foreign/
fi
    done
}

# unpack
echo "unpack"
mkdir -p ${TREE}
zcat cache/${VARIANT}.gz | \
    (cd ${TREE} && cpio --extract --make-directories --quiet)

# modify version
echo "modify - version"
cat <<EOF >> ${TREE}/etc/motd
${VERSION} [email protected]

EOF

# modify kernel
echo "modify - kernel"
rm -rf ${TREE}/lib/modules/2.6.29.1-tinycore
cp -pr cache/lib/modules/${OLPC_OS_KERNEL} ${TREE}/lib/modules/
cp -pr cache/lib/firmware ${TREE}/lib/

# supply missing utilities from this system
echo "modify - utilities"
for sbin in parted iwconfig iwlist iwpriv; do
    if [ -x /sbin/${sbin} ]; then
        (cd ${TREE} && encapsulate /sbin/${sbin})
    fi
done

# associate with wireless on boot
if [ ! -z "${ESSID}" ]; then
    echo "modify - wireless"
    echo iwconfig eth0 essid ${ESSID} >> ${TREE}/opt/bootlocal.sh
    # FIXME: on XO-1 delay until eth0 present
fi

# pack
echo "pack"
(cd ${TREE} && (find | cpio -o -H newc --quiet | gzip -2 > ${INITRD}) )
rm -rf ${TREE}

# make the output filesystem tree
echo "structure"
rm -rf output
mkdir -p output
mkdir -p output/boot

cp ${INITRD} output/boot/${VARIANT}.gz
cp cache/boot/vmlinuz-${OLPC_OS_KERNEL} output/boot/vmlinuz

cat << EOF > output/boot/olpc.fth
\ olpc.fth
setup-smbios
unfreeze
dcon-unfreeze
visible
.( -- Tiny Core Linux boot script for OpenFirmware    ) cr
.(    by [email protected], ${VERSION}              -- ) cr cr
" ${CMDLINE}" to boot-file
" u:\boot\vmlinuz" to boot-device
" u:\boot\\${VARIANT}.gz" to ramdisk
boot
EOF

# cleanup
rm -f ${INITRD}

# copy to media
if [ -w ${DEVICE} ]; then
    echo "copy"
    mke2fs -q ${DEVICE}
    mount ${DEVICE} /mnt
    rsync --archive output/boot /mnt/
    umount /mnt/
fi

Quote
(the server is down again anyway so I can't get to the files right now).
#&/\#@^$%*#$@?|
« Last Edit: July 30, 2010, 11:00:17 AM by mavrothal » Logged

XO-1: Is never going to run Flash, but is certainly flashy!
(If you want Flash, get an XO-1.5 running OLPC 11.2.0 or XOpup Grin )

#77 Re: Microcore linux for the XO-1 and XO-1.5

rbacher
Contributor
*
Posts: 31


July 30, 2010, 01:38:12 PM

Okay, I'll try it (once the server is working again).  I am curious how much time will be added to the microcore boot if I add Xfbdev and a browser (and nothing else).  I did some comparisons (nothing scientific, just clocking what my particular XO did starting from a cold boot) with the following results:
   (1) microcore..............................................25 sec
   (2) tinycore with all extensions removed.........45 sec
   (3) DebXO..................................................50 sec
   (4) Fedora 11..............................................1 min 25 sec
As expected microcore is the fastest boot.  Now if I can just get it to add an X system and minimal desktop in less than 20 seconds I may have the system I'm looking for.

Logged

#78 Re: Microcore linux for the XO-1 and XO-1.5

mavrothal
Administrator
OLPC News Forum Expert
*****
Posts: 1289


August 03, 2010, 01:43:50 AM

Okay, I'll try it (once the server is working again). 

It is now and hopefully will stay that way.
Logged

XO-1: Is never going to run Flash, but is certainly flashy!
(If you want Flash, get an XO-1.5 running OLPC 11.2.0 or XOpup Grin )

#79 Re: Microcore linux for the XO-1 and XO-1.5

mavrothal
Administrator
OLPC News Forum Expert
*****
Posts: 1289


August 03, 2010, 08:42:11 AM

Yes, I was using quozl's  microcore-2.8-xo-1-2010-01-28.  So now at least I know what the problem was.

FYI as of August 2 Quozl provides a new microcore 3.0  for the XO-1 and 1.5 with squashfs enabled kernels, so tcz extension will load fine.
« Last Edit: August 03, 2010, 08:45:03 AM by mavrothal » Logged

XO-1: Is never going to run Flash, but is certainly flashy!
(If you want Flash, get an XO-1.5 running OLPC 11.2.0 or XOpup Grin )

#80 Re: Microcore linux for the XO-1 and XO-1.5

rbacher
Contributor
*
Posts: 31


August 07, 2010, 02:20:52 PM

I'm getting closer.  I downloaded microcore 3.0, connected to wifi, and ran "tce-load -wi Xfbdev.tcz" like you explained in a previous post

[ You Wrote >> So after you get microcore going and have a connection just "tce-load -wi Xfbdev.tcz". After it loads  "xsetup" and select option 1 for mouse. Then "startx" and you are on the desktop. You will also need one of flwm.tcz/jwm.tcz/fluxbox.tcz/icewm.tcz etc for window management and probably one of Xfe.tcz/pcmanfm.tcz/rox-filer.tcz or other file manager.]

The tce-load ran perfectly this time, but I don't think it loaded "xsetup" and there was no select option 1 for mouse, and I can't run "startx".  Here's what I see on the screen:
------------------------------------------
$ tce-load -wi Xfbdev.tcz
Downloading: Xfbdev.tcz
Connecting to distro.ibiblio.org (152.46.7.109:80)
Xfbdev.tcz       100% |*************************| 372k --:--:--ETA
Xfbdev.tcz: OK
tc@box:~$
------------------------------------------
There's nothing about "xsetup" or option 1, etc.  It I try to run "xsetup" or "startx" I get the error message "-sh: xsetup: not found" or "-sh: startx: not found"

I can, however, run "Xfbdev"  but it takes me to a screen with gray and black cross hatching, and the mouse cursor is a black "X" (and it does respond to the touch pad).  But I can't do anything after that.  No desktop or little xterm window.

I know I am close.  I have seen the gray and black cross hatching before when I ran "startx" from console without having fluxbox installed (but I got a little xterm box then, which I don't get now).

I can feel that I am close to solving this, that I am missing like one or two little steps in here.  Any help would be appreciated.  Thanks
Logged

#81 Re: Microcore linux for the XO-1 and XO-1.5

mavrothal
Administrator
OLPC News Forum Expert
*****
Posts: 1289


August 07, 2010, 10:27:45 PM

You still need to follow the instructions you mentioned originally eg also get Xlibs.core.gz and Xprogs.core.gz to be able to setup and use X. Also get a window manager (flwm.tcz) if you do not want a gray desktop  Smiley
« Last Edit: August 07, 2010, 11:13:58 PM by mavrothal » Logged

XO-1: Is never going to run Flash, but is certainly flashy!
(If you want Flash, get an XO-1.5 running OLPC 11.2.0 or XOpup Grin )

#82 Re: Microcore linux for the XO-1 and XO-1.5

rbacher
Contributor
*
Posts: 31


August 08, 2010, 09:43:39 AM

First, thanks (again) for your help.  Second, I don't know why I didn't try downloading Xlibs.gz and Xprogs.gz yesterday.  But, third, it still doesn't work.

The instructions say enter: $ cd `cat /opt/.tcd_dir`
That takes me to tc@box:/tmp/tce$
Then wget -c Xlibs.gz and Xprogs.gz
They download fine
Then tce-load -wi Xfbdev.tcz
It downloads fine

But there's still no startx.  If I enter "sudo find / -name startx" I get no result.  If I try to run it, I get the error "-sh: startx: not found"

A post on another site said you have to reboot, but when you do that, the files are gone (I guess because they were in /tmp/tce)

The original instructions seem to indicate to run wget -c from /mnt/sda1/tce (rather than from /tmp/tce) but there is no "tce" in /mnt/sda1.  I did sudo mkdir to make such a directory, and I did wget from there, but then I ran into problems with tce-load -wi Xfbdev.tcz (I got error messages, something like, no permission to create /tce/)

I guess my question is this -- Is there a particular "tce" directory where the two files Xlibs and Xprogs have to go?  And should it work without rebooting or do I need to reboot after they are downloaded (in which case I have to create some kind of backup or persistence, I assume)?
Logged

#83 Re: Microcore linux for the XO-1 and XO-1.5

mavrothal
Administrator
OLPC News Forum Expert
*****
Posts: 1289


August 08, 2010, 10:06:44 AM

I guess my question is this -- Is there a particular "tce" directory where the two files Xlibs and Xprogs have to go?  And should it work without rebooting or do I need to reboot after they are downloaded (in which case I have to create some kind of backup or persistence, I assume)?
I would guess you need to modify the command line boot arguments to tell it where permanent directories are. Do this modifying the /boot/olpc.fth file. Check in the beginning of this thread for details as well as relevant files and instructions from current and "older versions" of my tinycore builds.
Logged

XO-1: Is never going to run Flash, but is certainly flashy!
(If you want Flash, get an XO-1.5 running OLPC 11.2.0 or XOpup Grin )

#84 Re: Microcore linux for the XO-1 and XO-1.5

rbacher
Contributor
*
Posts: 31


August 09, 2010, 06:24:32 AM

Okay, it works.  I added "home=LABEL=<disk-label>" and the same for "tce" and "opt" to the olpc.fth.  Doing that created directories labeled "home" "tce" and "opt" in /mnt/sda1.  I did wget -c to download Xlibs.gz and Xprogs.gz into the "tce" directory and rebooted.  Then I used tce-load -wi to get Xfbdev.tcz and fluxbox.tcz.  After that "startx" worked.  Boot time (from cold boot) is now 39 sec (and more time with extensions - I added chromium-browser but didn't time it yet).  Thanks for you help and patience as I stumbled through this.
Logged

#85 Re: Microcore linux for the XO-1 and XO-1.5

mavrothal
Administrator
OLPC News Forum Expert
*****
Posts: 1289


August 09, 2010, 08:14:07 AM

Good!
Have fun Grin
So are you getting the xauthority warning during boot?
Logged

XO-1: Is never going to run Flash, but is certainly flashy!
(If you want Flash, get an XO-1.5 running OLPC 11.2.0 or XOpup Grin )

#86 Re: Microcore linux for the XO-1 and XO-1.5

rbacher
Contributor
*
Posts: 31


August 09, 2010, 10:38:31 AM

No, no warnings.  The boot runs smoothly (or did at first -- at this time, after adding Chromium-Browser, there is a delay of a few seconds right before fluxbox starts during which the gray screen flickers for a couple of seconds -- but it doesn't disrupt anything - just slows down the boot process another second or two)

The current issue is changing the fonts on fluxbox.  They are too small to read.  I did this on previous installations on the XO by adding some lines to the overlay file in the .fluxbox directory.  But when I tried to do that last night, using sudo vi and also trying sudo nano, I got an error message both times that the overlay file is "file system read only".  Running "ls -la" shows that the overlay file in .fluxbox is a link file to something in tcloop, so it's got something to do with the microcore / tinycore "everything in ram".

I may (or may not) work more on this. I achieved my initial objective (with your assistance) of running microcore plus a minimal desktop plus a minimal browser in order to compare the boot time with my basic Debian install.  Although I still have to time it with Chromium, without Chromium I was at 39 or 40 seconds.  It's more with Chromium of course.  Debian is 50 seconds, and it works perfectly, so there is little practical reason to continue struggling with microcore (on the other hand, I kind of enjoy the challenge of trying new things on the XO)
Logged

#87 Re: Microcore linux for the XO-1 and XO-1.5

rbacher
Contributor
*
Posts: 31


August 09, 2010, 09:19:51 PM

Did a fresh install of microcore + Xlibs, Xprogs, Xfbdev + fluxbox onto the SD card,  Boot time from cold boot is 30 sec (browser yet to be added)

Still having the problem of editing the fluxbox files.  Can't even get the menu file to keep the changes.  Never had that problem before
Logged

#88 Re: Microcore linux for the XO-1 and XO-1.5

rbacher
Contributor
*
Posts: 31


August 10, 2010, 08:38:31 AM

Solved the menu problem.  According to a post on the Tinycore Forum, the menu is dynamically set every time you run startx. (Why the heck is that?)  The work around is to make the menu file you want, save it in the home directory, then add a line to .xsession "sudo cp ~/menu ~/.fluxbox" which has the effect of overwriting the dynamically set menu.  It's a backwards way to do it but at least it worked.

Changing the font size, I fear, will be more difficult to figure out
Logged

#89 Re: Microcore linux for the XO-1 and XO-1.5

rbacher
Contributor
*
Posts: 31


August 14, 2010, 12:43:04 PM

Boot time now down to 23-24 sec from cold boot to window manager.  I switched from fluxbox to jwm which seems to be slightly faster, and I entered some code into olpc.fth for moderate overclocking.
Logged
Pages: 1 ... 3 4 5 [6] 7 8
Print
Jump to:  

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