Skip to main content

U-Boot with "Shutdown"

Posted in

UPDATE: Check my download page for the latest u-boot and kernel.

Thanks to sweetlilmre we now have U-Boot with "proper" shutdown. Basically sweet's code puts the Zipit into deep sleep when you halt the system from linux. When you press the power button or plugin AC power the Zipit will turn back on. It's pretty much the way it worked with the old blob bootloader.

If you'd like to try compiling your own, check out Geordy's instructions and here's the irc log with some minimal instructions for adding the code:

[13:19] (sweet_away) mozzwald: this one is sleep friendly and tested (flashed): http://pastebin.com/sf8vWzBy
[13:20] (sweet_away) save the contents as wakeup_macro.h in the board/zipitz2 dir, #include it in lowlevel_init.S and replace the call to pxa_wakeup with z2_wakeup

Also included in my release is Marex's new keyboard driver. Unfortunately though, I did not enable it in my U-Boot environment so it's not usable until you "setenv stdin pxa27x-mkp" in U-Boot.

And I've included a fancy schmancey splash screen with U-Boot. You can change it if you follow Geordy's instructions. You can follow the directions in my previous post to flash from your current rootfs using this new download. You'll also need a new kernel with the proper shutdown code as well which can be downloaded here. Or you can compile your own kernel using the following patches and config file:

http://www.mozzwald.com/zipit/kernel/2.6.36-rc2+_patches.tar
http://www.mozzwald.com/zipit/kernel/config.09262010

Pre-compiled kernel:
http://www.mozzwald.com/zipit/z2uflasher_09022010.tar.bz2
http://www.mozzwald.com/zipit/kernel/z2-2.6.35+_08222010.tar.bz2

Volume keys wakeup

The volume keys on the side of the zipit will take the zipit out of sleep mode. Is there a way to disable the volume keys from causing a wake up?

Thanks

Suspend if closed

I'm not aware of a way to disable wakeup on keypress. One might need to modify the uboot source code to get that working which can be a bit dangerous without the proper tools. A work around is to check if the lid is closed at wakeup and go back to sleep if it is. Thanks to rkdavis pointing me to the proper registers. Put the code below into /etc/apm/resume.d/90lid and make it executable.


#!/bin/bash
# Suspend if lid closed on wakeup

REGISTER="0x40E00100"
CLOSED="0x1E5FF91"
OPEN="0x1E5FF85"

EVENT=`devmem2 $REGISTER | grep $CLOSED`
if [ -z $EVENT ]; then
echo "OPEN" > /dev/null
else
echo "CLOSED `date`" >> /var/log/lidapm.log
sleep 3
pm-suspend &
fi

Iid sensor not reliable

I already have this script, thanks for the pointer.

After adding more debug to the script it appears that the lid sensor isn't very reliable on my zipit. Sometimes it even reports the OPEN code when the lid is closed, I've also seen 0x1E5FFA5 and 0x1E5FF81.

I'll look into disabling the volume keys. I don't understand why uboot would be involved since the system is already booted and is going into and out of deep sleep. Can you give a little explanation?

Thanks

U-Boot GPIO

I could be totally wrong, but my understanding is that U-Boot sets up the GPIO's and which ones will wake up the Zipit. Sweetlilmre was able to get the zipit to enter deep sleep and only the green power button would wake it up by modifying U-Boot. I'm not sure if this could be done in the kernel or userspace, but it would certainly be less dangerous.

shutdown -h now doesn't sleep

I flashed the new uboot boot loader (with the splash screen that says "now with U-Boot") and installed the 2.6.35-rc3+ kernel but shutdown -h doesn't put the zipit to sleep. It just sits at the message that says "system halted." and I have to remove/replace the battery.

Do you have any ideas on what to try next?

Shutdown -h

Which userland are you using? Make sure the proper kernel is loading. What does uname -r return?

I am using the z2buntu

I am using the z2buntu userland.

uname -r
2.6.35-rc3+

uname -a
Linux zipit-ubuntu 2.6.35-rc3+ #10 Fri Jul 16 08:44:42 CDT 2010 armv5tel GNU/Linux

Kernel

It appears that the older kernel is being loaded. If you are using the older z2buntu release you'll need to extract the kernel to the root directory on your sd card which puts the kernel in /boot and the modules in /lib/modules.

If you're using the z2buntu for U-Boot release, then the kernel needs to be on the fat partition as uImage and the modules on the ext partition at /lib/modules

My latest kernel can be downloaded here:
http://www.mozzwald.com/zipit/kernel/z2-2.6.35+_08222010.tar.bz2

I am using the z2buntu for

I am using the z2buntu for U-Boot. I moved the kernel uImage to the fat partition and now "uname -a" reports a kernel that was built Aug 22 16:01:08 and "shutdown -h" works.

With this kernel the wireless isn't working for me.
I'll have to look into that further.

Thanks for he help!

z2 keymap

Hi
and thanks for the great work.

You say

"Also included in my release is Marex's new keyboard driver. Unfortunately though, I did not enable it in my U-Boot environment so it's not usable until you "setenv stdin pxa27x-mkp" in U-Boot."

How do you get to u-boot to enter "setev ........."

I'm assuming once I do this, then I will be able to access the alt-characters on the keyboard again.

Kindest regards

James

U-Boot Keyboard

The U-Boot keyboard driver is for U-Boot only and has no effect on keyboard usage in a userland/rootfs. It sounds as if you might be having issues with your keymap. What userland are you using?

I'm using a variation of

I'm using a variation of rootnexus.

Sidetrack?

Sidetrack? Or your own variation?

You can try downloading rkdavis' keymap and loading it with
loadkeys keymap.map

http://russelldavis.org/ZipitZ2/keymap.map
http://russelldavis.org/ZipitZ2/keymap.map.jpg

Thanks for the quick

Thanks for the quick replies.

Yes, the keymap doesn't seem to be loading during boot.

When I manually use loadkeys I get my alt keys back.

(my own variation of rootnexus, which I'm now trying to set up with your ubuntu userland)

Regards

James

loadkeys

I had issues with pre U-Boot lines in my /etc/rc.local that would cause things to not load. Make sure all the lines in your rc.local file work properly now with U-Boot, or put the loadkeys line at the beginning of your rc.local.

My latest rootfs works fine with U-Boot.

How can i

pardon me if i am a noob but i can't use the alt keys in my rootnexus userland x windows or the terminal before startx, the mouse, or do a proper shutdown which it could before.

all this after I install u-boot
can you help me.

Rootnexus and U-Boot

The keyboard and mouse with rootnexus won't work properly after upgrading to U-Boot. Did you try this for the keyboard: http://www.mozzwald.com/node/73#comment-146 Try replacing your rootnexus z2mouse application with this one: http://www.mozzwald.com/zipit/z2mouse-2.6.35

Please describe your wifi problems in more detail.

so this is it

it uses the eth1 connection not the wlan0

how do i replace the keyboard keymap.map and mouse z2mouse?

Rootnexus

You'll need to modify the scripts in Rootnexus to look for wlan0 instead of eth1. Look in /usr/share/netconfig for the scripts.

If I remember correctly, replace /etc/keymap.map with the keymap from here.

and replace /bin/z2mouse-option with the new z2mouse from here

Before you go replacing files though, you should double check the paths in your ~/.xinitrc file. You could also just comment out the current line in your xinitrc file and add a new line to the new file.

I'll do that

thanks for the help

I'll post back with the results

this happened

the good news is i fix the mouse the bad news is that the keyboard types both capital and lower case letters but not alt like the numbers, hyphens, backslash which are important.

any more tips

X and Keymaps

Are you trying to use this keymap in X? The keymap I linked before only works properly for the command line. Load this keymap in your xinitrc file: http://www.mozzwald.com/zipit/xkeymap.map

load how

how do i load the keymap for x and how do i load the keymap for command line.

the mouse works but i can't type in the command line before x after i replaced the keymap in /etc/keymap.map

Keymaps cont

The X keymap is loaded in your .xinitrc file. Look for a line that has xmodmap.

In /etc/rc.local add the line loadkeys /path/to/keymap.map to load the console keymap.

hi, i flashed the new kernel,

hi, i flashed the new kernel, but don't know how to do the shutdown.

i tried sudo halt and sudo shotdown -P now, it always said that the system is halted, but is doesn't power off.

what do i have to do?

Shutdown

So, you flashed the new U-Boot and extracted the new kernel to your rootfs? Then all you hafta do is shutdown -h now.

What userland are you using?

i'm using your new userland

i'm using your new userland (X for u-boot). when i type 'sudo showdown -h now' it sais System halted, but is now powering down.

Just to make sure, did you

Just to make sure, did you flash with the newest U-Boot? Did you extract the newest kernel to your rootfs?

i did the following again: i

i did the following again:

i flashed your newest userland tu a sd-card.
i booted the zipit.
i copied the two directories /boot and /lib from this post to the rootfs of my sd-card.
i ran the uflasher from this post.

is that it?

It sounds like you've done

It sounds like you've done everything needed. When you boot your Zipit now you should have a splash screen that says openzipit "now with u-boot". After you reach the command prompt type uname -r and you should see 2.6.35+.

If you continue to have problems, stop by #zipit-dev or #zipit on irc.freenode.net and ask for some help there.

yes, your right, i have the

yes, your right, i have the splashscreen and the 2.6.35+ kernel.

i looking forward to build a serial cable to see what u-boot is telling me.

when i use the small rootfs

when i use the small rootfs in your last post with your kernel with shutdown, i can poweroff my zipit using 'poweroff'.

i'll try a total reflash with your rootfs.

wakeup_macro.h

You have sweet_away above saying to save the contents of the file in the board/zipitz2 dir. What/where is that directory located at so we can get it updated? Or is that something that needs to be incorporated into a u-boot build?

Compile

That's only if you wanted to try compiling your own.