Wednesday, 10 February 2010

Running Fedora ARM on Nokia N900

When I’ve got mine N900, I thought, pity that it doesn’t have Fedora in it. But now, I’ve managed to run Fedora ARM port on it.

Steps were the following:
  1. Rebuild kernel with FRAMEBUFFER_CONSOLE=y enabled to see console output and flash it. It is well described on Maemo Kernel Guide and Jebba’s notes
  2. Setup bootmenu
  3. Unpack prebuilt rootfs to partition on an SD card
  4. Copy kernel modules to /lib/modules and firmware to /lib/firmware inside new system

Hardware support

Watchdog

To prevent hardware reset by watchdog chip it needs to have chars regularly written to correspondent device. On N900’s board this is /dev/watchdog and /dev/twl4030_wdt. I’ve made simple rpm with config for watchdog daemon and startup script.

Wifi

Wifi is working “out-of-the-box”. Only script to startup it like this one should be prepared and put to PATH, as there is no way to type anything except english letters from console.

Touchscreen

tslib could provide touchscreen support, but to be available in X it needs xf86-input-tslib driver.

Battery

To have battery charging it needs to run bme proprietary daemon.


But it is more useful to run Fedora system in chroot from Maemo to have familiar userspace instead of cripple busybox.

Wednesday, 14 October 2009

Making an evil initrd with febootstrap

Иногда, мне приходится админить известную ОС Вселенского Зла. И чтобы производить разные автоматические действия, типа разбиения диска, я сделал специальный initrd который может загрузиться по сети и сделать свою работу. Это просто благодаря утилитке febootstrap. Хотя, мне пришлось пропатчить её чтобы она работала из-под рута — патч в баге 528687.

Скрипт для создания злобного initrd, который сотрёт все разделы на диске, создаст два и отформатирует первый в NTFS в конце заметки. Не запускайте его на своей машинке >:)

----

Sometimes, I have a need to admin an well-known World Evil OS (Windows, yeah). And to do some unattended operations like custom disk partitioning, I've made special initrd that could be booted over network, and do the work. This was simple thanks to febootstrap util. Though, I had to patch it to flawlessly run under root, see bug 528687.

Script that makes an evil initrd that erases all partitions, creates two and formats first to NTFS at the end of post. Be careful not to run it on your machine >:)

----

LANG=C i386 febootstrap fedora-11 fedora-parted file:///home/alex/tmp/repo -i coreutils -i parted -i ntfsprogs -i upstart

MAKEDEV -d fedora-parted/dev -x sd{a,b,c,d}{,1,2,3,4,5,6,7,8}

febootstrap-minimize fedora-parted

cat > fedora-parted/init <<EOF
#!/bin/sh

/sbin/parted -s /dev/sda mklabel msdos mkpart primary ntfs 0 50% mkpart primary ext2 50% 100% set 1 boot on
/sbin/partprobe /dev/sda
/sbin/mkfs.ntfs /dev/sda1
/sbin/reboot -f
EOF
chmod +x fedora-parted/init

febootstrap-to-initramfs fedora-parted > initrd-parted.img

Monday, 21 September 2009

Mounting raw and qcow2 VM disk images

Mounting a partition from raw image is pretty simple:
losetup /dev/loop0 image.img
kpartx -a /dev/loop0
mount /dev/mapper/loop0p1 /mnt/image

If kernel parameter (as loop in compiled into Fedora’s kernel) like loop.max_part=63 added it is even simplier:
losetup /dev/loop0 image.img
mount /dev/loop0p1 /mnt/image

Alternative way is to specify direct offset to partition:
mount image.img /mnt/image -o loop,offset=32256


To mount qcow2 images there is (at least in F-11 qemu) very useful qemu-nbd util. It shares image through kernel network block device protocol and this allows to mount it:
modprobe nbd max_part=63
qemu-nbd -c /dev/nbd0 image.img
mount /dev/nbd0p1 /mnt/image


If LVM is present on image it could be initialized with:
vgscan
vgchange -ay
mount /dev/VolGroupName/LogVolName /mnt/image


Finishing is done with (depending on how it was initalized):
umount /mnt/image
vgchange -an VolGroupName
killall qemu-nbd
kpartx -d /dev/loop0
losetup -d /dev/loop0

Tuesday, 14 July 2009

Tasks properties widget

On last week I had to spend some days on my postgraduate application. Good news here that it is ended now and I hopefully will have more time to work.

Also I've committed the tasks properties widget code but it does not work properly yet. Going to fix it this week.

Tuesday, 7 July 2009

No progress :/

Last week was a busy for me - I had to do some bureaucratic things to receive my diploma and apply for postgraduate course. So, was tired and did almost nothing. Anyway, I’m going to some progress on client part next week. And also, I’ve find that we deviate from original plan long time ago (tasks properties were not part of it at all), so it should be rehashed, I guess.

Tuesday, 30 June 2009

Adding coverage tests

I've created unit test for my new tasks property code last week. It was useful as it helped to find one problem in code with uninitialised variable. Also, I've started some code to create tasks properties widget in Ember (but didn't commit it yet).

The list of things to do is left unchanged: parameters filtering on server side; Eris changes and widget on client side. I want to do some client stuff on this week.

Tuesday, 23 June 2009

Task properties are doing something

On last week, Al helped me to fix the “bug” with python script which turned to be not a bug but simple error.

Also I’ve make a new world initialization script (define_world_empty.py) that creates an empty script. It helps to monitor with cycmd without being spammed with all kind of different event from entities and NPCs from default world. While it is possible create empty world with calling some functions from main define_world.py, I think that having separate script to create empty world, is useful by itself, to serve as a template.

Next, Al made a prototype for some core class that would allow to change task property and I added some logic to it. So now, operation for change of task properties is successfully processed, property changed and exposed back to client.

Next things to do on server side, is to implement filtering to let change only allowed properties, and on client side to make changes in Eris and create widget to select task parameters.

Tuesday, 16 June 2009

Tasks interface exploration

On this week I did some exploring on what is needed to implement tasks interface along with some learning on usage of cycmd and cypython tools.

I started wiki page with specification of tasks interface.

Then, I was trying to do set operation from python task script, but this run into a bug in current python bindings.

Next, I did some exploring on client side. Added sample attribute to task class and tried to load the class in Ember. Basic code like request a class and print its attributes does the work.

As I see, all task handling on client is done in Eris. So, I need to add to Eris::Task class ability to store attributes. That is adding some variables and logic to fill them in Task::updateFromAtlas().

From server side, as it doesn't use Eris, something in Character use operation handler should be made. And also nasty python bindings should be fixed.

That’s what I’m going to do on next week. But Al should enlighten me on what exactly should be made on server side.

Tuesday, 9 June 2009

Tasks interface discussion

Last week we started to discuss how to express user interface for tasks. To recall, we want to provide an UI for task that would allow player to select the parameters of a task and control it.

We want add additional declarations for attributes that are allowed to be changed to existing declaration of task. This data then should be sent to client and used to present an interface when task started.

And that’s what I’m going to do next week: try to manipulate attributes of an existing task, also write draft specification for attributes declarations in task, add some example attributes and see what should be done for it to be shown in client.

Tuesday, 2 June 2009

The Void in code space

Not much happened last week in mason game systems from. Better to say, nothing happened at all. But this is expected, as I had exams.

Now, exams are over and I can get back to work on the project. Seeking forward to postponed replies on my mail on expressing interface for tasks.

Monday, 25 May 2009

Playing with fire and rope making

So, GSoC officially started, and here is my first report this summer :)

All development for this project is happens on ‘mason_game’ branches in mine gsoc2009/alex-cyphesis.git and main ember.git repos at git.worldforge.org.

I started to work some weeks ago and did a few things. To learn about representations of types, entities and scripts inside Cyphesis server, I decided to change starting place in the world.

One thing for improve was the behaviour of campfires. With addition of proper dynamic lighting and shadows support in Ember we got nights to be dark. And having light source become essential to move without striking against the trees or being trapped by goblins.

In default world, campfire starts with fire but it soon goes out without fuel. On the contrary, if some fuel added to it, then it lasts forever because there is no feature to remove objects when they are fully burned. So, adding some fuel from the start does the trick and sheds the light on starting point place.

To let players have their own light source, I put two torches that players are free to take. Currently, Ember deserve some fixes to properly show the torch when hold by character.

Also, in between, some fixes were made in Ember to finally finish the shadow shader. But this really is not part of GSoC.

Next thing I made is rough implementation for rope making. I read a bunch of articles on rope making and history of agriculture to get some understanding of how they were making ropes in middle ages. Basing on this, I created a wiki page to collect info about farming in Mason. After that, added type definitions for correspondent tools and implemented simple task for making grass rope. It could be refined if that’ll be necessary.

On the ongoing week, I’m not planning to code anything as I’ll have exam at the beginning on June, granting that I did some work earlier. Nevertheless, we will discuss next steps about next sawing task.

Wednesday, 20 May 2009

Patches for Pidgin

I’m using pidgin for all IM and chat conversations for some time and there were two things annoying me. And I made patches for them:
  1. Pidgin does not report OS version due to some subtle security reasons. Here is the patch №1 that reports current Fedora version.
  2. No way to change nick completion suffix from colon to comma. Here is the patch №2.

Thursday, 7 May 2009

Accepted again!

I’ll work for WF second time this summer. Yay!
Here is essential part of proposal.

Synopsis

Implement game systems require to build a basic castle fortification from scratch from gathering raw materials to the completed construction.

Benefits for WorldForge

When asked about what WF is, you cannot simply answer “It is a set of tools for making games, look what cool game they made”, because there is currently no any playable game. Completing of this will increase number of things players can do in stock Mason game. It will also act as an example tasks for world creators. And hopefully, help to increase overall number of people who do custom world creation.

Deliverables

In the end, the set of tasks, tools and entity classes for cyphesis for constructing walls should be implemented. Needed core and client modifications will be made along the way.

Detailed Description

Proposal is to improve and implement cyphesis tasks and necessary accompanied things for following mason techs: plants, plant-fibre, logging, rope, sawing, pioneering, palisade, scaffolding, mining, earthworks, walls, gate, and fortification.
List taken from blueprint: https://blueprints.launchpad.net/cyphesis/+spec/gs-fortification
Each tech will require a set (zero, one or several) of tasks, a set of correspondent tools to perform the tasks and a set of entity classes on which action is performed. Some, tasks, tools and classes are already present in current mason impelementation and could be reused.
Here is the list of techs, a brief description taken from blueprints and my comments about how it should work and what should be done for each tech:

plants. Gather plants growing on the terrain.
Cut action could be performed with scythe on grassy terrain now.
An other task could be added for gathering different kind of plants suitable for making ropes, like gather reeds with knife.

plant-fibre. Process the right kind of plants into plant fibres to be used as a raw material.
Gathered plants should be cleaned, dried and somehow processed. This doesn’t require any tool, just time. Needs adding fibre class.

rope. Wind plant fibre into rope.
Here several fibres are winded into rope. Doesn’t require any tool either . Needs adding rope class.
Cyphesis, though, does not have ability to perform an action on several entities. So, perhaps, it require an improvement to server or a workaround.

logging. Gather timber by logging trees.
Chop trees could be performed with axe on trees now.

palisade. Palisade from logs.
Lever action could be performed with pole now.
But logs should be processed before levering so they look pretty, like the palisade around goblins camp.

sawing. Take raw logs and process them into the different types of shaped timber required for construction and crafting.
Slice action could be performed with bucksaw on logs now.
Task for making differently shaped timber could be added.

pioneering.
Create rough structures using rough cut timber and ropes.
It is good to have ability to make arbitrary wooden structures, but this proposal is not targeted at this.
This tech could be skipped and simulated by creation predefined wooden structures or by consumption of wood when constructing walls (like Warcraft :)

scaffolding. Construct scaffolding from sawn timber.
This is construction of predefined wooden structure that consume sawn timber and ropes.

mining. Gather rock by quarrying rocky terrain.
This was “quarrying” in blueprint, I renamed it to be more traditional.
Cut action could be performed with pickaxe on rocky terrain now.
It could be modified to produce rocks of different styles and sizes.

walls. Construct walls out of stone or wood.
Constructs a wall section like one we already have in media:
http://amber.worldforge.org/ember/screenshots/tn/screenshot_20081030_001318.jpg.html

gate. Construct a primitive gate from rough wood and ropes.
Like a wall, but constructs section with gate.

earthworks. Modify the terrain by digging trenches, embankments and other shapes.
Creating new and modifing existing terrain modifiers. It could be “flatten” task that is based on Level modifier.
Modifier for digging trenches may be implemented.

fortification. Construct a fortification with stone walls and gates.
A generic tech just head the hierarchy.

Project Schedule

We have 12 weeks on program. Here is the approximate plan on spending that time:

1. Tame the python.
2. Analyse the tasks. Describe what exactly they should perform and document this on wiki.
3. Add/improve simple tasks (plants, plants-fibre, rope, mining).
4-5. Start needed cyphesis core modification or invent the workarounds.
6. Make middle-level tasks that doesn’t require core modifications (palisade).
7. --- Mid-term evaluations: present some working code.
8. Finish cyphesis core modifications.
9-10. Make tasks down in hierarchy (scaffolding, walls, gate).
11. Make earthwork tasks, possibly expanding terrain modifiers.
12. --- The last week is to finish the work.



I was proposing something similar but vague last year: http://alexeytorkhov.blogspot.com/2008/04/improving-mason-game.html

Tuesday, 10 February 2009

Bulk file renames

I was always using shell scripts to do mass file renamings. But now there are definitely simplier tools exist. One of them came to my knowledge recently is rename. It is standard tool and does the most simple and common task—replace one substring with another in filenames.

Second useful tool is convmv. It not only allows to convert filenames between different encodings, but also to convert between upper and lower case.

Also mmv deserves mention. It could do replacement basing on pattern.

Monday, 9 February 2009

RPM verify and restore capabilities

Good that RPM could verify files (-V option) and restore permissions and owner modes (--setperms and --setugids keys). More here: How to reset the permissions of the installed rpm packages with --setperms option. It allow me to repair part of root filesystem with accidentally changed owner.

Saturday, 7 February 2009

Typographic layout

Finally, typographic layout has been included into xkeyboard-config release 1.5 that is available in rawhide now. It enables access to symbols like «, », ©, ≠, —, … from keyboard which is very convenient for typing web texts.

Unfortunately, something makes it non-working when selecting from gnome keyboard config dialog. So, I had to add typo typo:2 to xkb_symbols from setxkbmap -print output and put call of setxkbmap in autostartup programs. Resulting command line is:
$ setxkbmap -symbols 'pc+us+ru(typewriter):2+inet(evdev)+group(shifts_toggle)+level3(ralt_switch)+typo+typo:2'

Yay! I have typographic symbols in both English and Russian layouts switched with AltGr.

Friday, 6 February 2009

Interpretation of old paintings

Pierre Carrière-Belleuse. La place Pigalle in Paris. 1880.

I’m not frequent visitor of museums, but was recently here in Gallery of Impressionists. And it is interesting how old paintings could be interpreted.

For example, this picture. It clearly looks for me as picture from some pseudo-3D isometric computer game. Really, it has broken perspective close to isometric; it has level of detail—only near people have detail faces; it has sprite-alike layout—carriages and people are moving mainly parallel street edges.

Hmm… my mind is too computer-aligned. Need to go for a walk… :)

Friday, 30 January 2009

Configuring lm_sensors for Asus P5E3 motherboard

Standard configuration of lm_sensors with sensors-detect find right monitoring chip and it was showing all reasonable data except voltage, that was differing by more than 10% of nominal. And it was slightly bothering me.

Finally, after reading lm_sensors Asus article, I was able to craft right voltage sensor formulas for my Asus P5E3 motherboard that give the same values as BIOS.

First, need to decompile description tables (iasl package had to be installed):
# cat /proc/acpi/dsdt > dsdt.bin
# iasl -d dsdt.bin

Deciphering all ACPI magic that is written to dsdt.dsl is not very easy. I was looking for RVLT function that gives the formula for voltage:
Method (RVLT, 1, NotSerialized)
{
    And (Arg0, 0xFFFF, Local0)
    Store (VGET (Local0), Local1)
    Store (DerefOf (Index (DerefOf (Index (VPAR, Local0)), Zero)),
        Local2)
    Store (DerefOf (Index (DerefOf (Index (VPAR, Local0)), One)),
        Local3)
    Store (DerefOf (Index (DerefOf (Index (VPAR, Local0)), 0x02)),
        Local4)
    Multiply (Local1, Add (Local2, Local3), Local5)
    Divide (Local5, Local3, , Local5)
    Add (Local5, Local4, Local5)
    Return (Local5)
} 

Translating to normal language it does approximately the following:
Local1 = VGET(Local0);
Local2 = VPAR[Local0][0];
Local3 = VPAR[Local0][1];
Local4 = VPAR[Local0][2];
return Local1 * (Local2 + Local3) / Local3 + Local4;

To find out Local parameters for each sensors, need to look at VPAR definition:
Name (VPAR, Package (0x04)
{
    Package (0x03)
    {
        Zero,
        One,
        Zero
    },

    Package (0x03)
    {
        0x22,
        0x22,
        Zero
    },

    Package (0x03)
    {
        0x14,
        0x0A,
        Zero
    },

    Package (0x03)
    {
        0x3C,
        0x0A,
        Zero
    }
})

Comparing this to order of data in other places of tables (VCore, +3.3V, +12V, +5V) one can see that right coefficients for +12V is 60/10 and for +5V is 20/10.

Resulting config is here.

Sunday, 11 January 2009

Final GSoC gift

Finally, I’ve received my t-shirt. That was complete surprise for me, as I didn’t get any FedEx tracking number. So, Summer of Code 2008 is officially end for me. 2009 starts! :)

Thursday, 11 September 2008

Ember 0.5.4 packages

I’ve updated ember and ember-media still-waiting-for-review packages to newly released 0.5.4 version. Main change since previous is that all three GSoC projects including mine are merged.

Update: Thanks Spot for reviewing the package! Now it is being build and will be in rawhide soon.