|
Vlatko Kosturjak - Kost | Vlatko Kosturjak - Kost
Hi and welcome to my page. There's still nothing useful here. Maybe it will be useful some day.
|
ASUS EEE - few tricks for beginners ;)
| |
As ASUS EEE is available in Croatia stores now, I'll give few tips (and no tricks) for beginners with ASUS EEE in Croatia.
Probably you noticed that you cannot select Croatian keyboard layout. What you need to do is edit /etc/X11/xorg.conf and find following line:
Option "XkbLayout" "us"
And change it to (for Croatian keyboard):
Option "XkbLayout" "hr"
Optionally, you can change it to (if you want Croatian letters on AltGr):
Option "XkbLayout" "hr(us)"
If you want to change keyboard layout on the fly, open terminal (ctrl+alt+t) and type following (if you need to change to Croatian layout):
setxkbmap hr
Also, if you want Croatian letters on AltGr, you need to type:
setxkbmap hr us
If you want to switch back to US keyboard layout, type following:
setxkbmap us
If you need Croatian spelling checker for OpenOffice.Org, you need to edit /etc/apt/sources.list and add following lines (as administrator/root):
deb http://ftp.linux.hr/asuseee/xandros/ binary/
deb-src http://ftp.linux.hr/asuseee/xandros/ source/
After that, type this in terminal (in order to install packages):
sudo apt-get update
sudo apt-get install myspell-hr
And if you need hyphenation support in OpenOffice.Org, type following:
sudo apt-get install openoffice.org-hyphenation-hr
Now, launch OpenOffice.Org, choose Tools->Options, then Language Settings, and in Languages in section Default language for documents choose Croatian in drop down menu.
You can restart OpenOffice.Org and Spelling checker (as you type) will be enabled by default.
If you want to tweak default ASUS Icewm preferences, copy preferences file from /etc/X11/icewm/ (not /usr/share/icewm!) to .icewm and modify it.
Regarding overclocking and fan control, you can download precompiled module (Note to everyone: this is new version/release - with new and better patch!)
Technorati tags: asus eee hacking linux xandros debian
|
|
Debugging SquashFS and tools
| |
Recently, I was playing with squashfs and with its SquashFS LZMA companion. I hit the segmentatin fault while I was building squashfs from ASUS EEE read only image. I'll try to explain my debug process, so people who are not familiar can follow (and learn something). I run gdb on core dump and discovered that problematic function is write_file_blocks_dup (output of gdb):
Program terminated with signal 11, Segmentation fault.
#0 0x08050b84 in write_file_blocks_dup ()
(gdb) bt
#0 0x08050b84 in write_file_blocks_dup ()
#1 0x080519e9 in write_file ()
#2 0x0805257c in dir_scan2 ()
#3 0x08052502 in dir_scan2 ()
#4 0x08052502 in dir_scan2 ()
#5 0x08052502 in dir_scan2 ()
#6 0x08052502 in dir_scan2 ()
#7 0x08052c60 in dir_scan ()
#8 0x0805506e in main ()
(gdb) print reader_buffer
$1 = 139977672
Seg fault often happens when you try to read/write memory which you don't own (or you freed already). By looking at that function (write_file_blocks_dup), I found interesting piece of code:
Code: | if(read_buffer->c_byte) { |
| read_buffer->block = bytes; |
| bytes += read_buffer->size; |
| file_bytes += read_buffer->size; |
| if(block < thresh) { |
| buffer_list[block].read_buffer = NULL; |
| queue_put(to_writer, read_buffer); |
| } else |
| buffer_list[block].read_buffer = read_buffer; |
| } else { |
| buffer_list[block].read_buffer = NULL; |
| alloc_free(read_buffer); |
| } |
| buffer_list[block].start = read_buffer->block; |
| buffer_list[block].size = read_buffer->size; |
| progress_bar(++cur_uncompressed, estimated_uncompressed,columns); |
If you notice, there is alloc_free function which try to free read_buffer, but immediately after that - there's statements which try to access that memory (which doesn't exist any more). So, I changed it to:
Code: | if(read_buffer->c_byte) { |
| read_buffer->block = bytes; |
| bytes += read_buffer->size; |
| file_bytes += read_buffer->size; |
| if(block < thresh) { |
| buffer_list[block].read_buffer = NULL; |
| queue_put(to_writer, read_buffer); |
| } else |
| buffer_list[block].read_buffer = read_buffer; |
| } else { |
| buffer_list[block].read_buffer = NULL; |
| } |
| buffer_list[block].start = read_buffer->block; |
| buffer_list[block].size = read_buffer->size; |
| progress_bar(++cur_uncompressed, estimated_uncompressed,columns); |
| alloc_free(read_buffer); |
I made patch for it and sent to author via squashfs sourceforge page. That's one bug less...
But! Here it comes again. I hit another problem. My mksquashfs process was stuck at around 60% and progress bar is not moving. So, I connected to PID of mksquashfs process using gdb and discovered that it's waiting in get_fragment function on pthread as illustrated below:
xb7f32c01 in pthread_cond_wait@@GLIBC_2.3.2 () from /lib/tls/libpthread.so.0
(gdb) bt
#0 0xb7f32c01 in pthread_cond_wait@@GLIBC_2.3.2 ()
from /lib/tls/libpthread.so.0
#1 0x0804dcad in get_fragment ()
#2 0x0804e104 in duplicate ()
#3 0x0805155f in write_file_frag_dup ()
#4 0x080516f8 in write_file_frag ()
#5 0x08051a36 in write_file ()
#6 0x0805257c in dir_scan2 ()
#7 0x08052502 in dir_scan2 ()
#8 0x08052502 in dir_scan2 ()
#9 0x08052502 in dir_scan2 ()
#10 0x08052502 in dir_scan2 ()
#11 0x08052502 in dir_scan2 ()
#12 0x08052502 in dir_scan2 ()
#13 0x08052502 in dir_scan2 ()
#14 0x08052c60 in dir_scan ()
#15 0x0805506e in main ()
I tried to see on what file it hangs while building filesystem and it hangs at the following:
mksquashf 32709 root 3u REG 8,3 607996129 1484897 /asus-eee/asus-eee.lza
mksquashf 32709 root 4r REG 8,3 395 277747 /asus-eee/usr/share/games/frozen-bubble/gfx/menu/backgrnd-closedeye-right-green.png
I tried to start it again, and it again hang at the following file:
mksquashf 6544 root 3u REG 8,3 607996129 1101584 /asus-eee/asus-eee.lza
mksquashf 6544 root 4r REG 8,3 395 277747 /asus-eee/usr/share/games/frozen-bubble/gfx/menu/backgrnd-closedeye-right-green.png
It seems that pthread implementation is broken somehow. I tried to look at get_fragment function, and discovered that mksquashfs is waiting at the following piece of code:
Code: | pthread_mutex_lock(&fragment_mutex); |
| while(fragment_table[fragment->index].pending) |
| pthread_cond_wait(&fragment_waiting, &fragment_mutex); |
| pthread_mutex_unlock(&fragment_mutex); |
| disk_fragment = &fragment_table[fragment->index]; |
| size = SQUASHFS_COMPRESSED_SIZE_BLOCK(disk_fragment->size); |
Notice that there's no error checking on pthread functions at all (like in pthread_mutex_lock), so I have to implement error checking in order to see what's wrong around pthread implementation (because it seems like some pthread runaway). But, It's too late and this would take long as I have to put lot of error checkings around every pthread call, so I'm leaving this as exercise for the reader of this blog!
Good luck! :)
Technorati tags: asus eee hacking linux xandros debian squashfs gdb debug
|
|
Compiling kernel modules for Xandros ASUS EEE
| |
As lot of people asked me how I managed to compile kernel modules for Xandros default distribution on ASUS EEE, here's explanation.
First, I copied all files (except /proc, /sys, ...) from ASUS EEE to my laptop. I used tar and netcat for that. After that, I chrooted that ASUS EEE file structure (chroot . bash).
Now, i've done lot of apt-gets to have development enviroment ready (gcc, libc-dev, etc...). For kernel part, I downloaded vanilla kernel source (same version as ASUS EEE) from kernel.org (direct link). In order to make kernel as match as close to original one, I downloaded unionfs (direct link) and applied patch to vanilla tree.
It's good feature that ASUS engineers left the kernel .config file in /boot, so I could use original .config file (it's full pathname is /boot/config-2.6.21.4-eeepc). Just copied that config file to source tree as .config and made:
make oldconfig && make prepare
So, now I have full enviroment ready and I just compile any additional extra module I need. This way you can compile the kernel (not just modules). But it would lack full ASUS EEE hardware support. I used this method to compile kernel modules (like eee.ko).
In the meantime, ASUS released their kernel source (or I just realized that) and you can download it here (choose EEEPC and find it under Source code category).
You need to unrar the downloaded file and install it using dpkg (dpkg -i linux-source-2.6.21.4-eeepc.deb). The linux source is installed in /usr/src/linux-source-2.6.21.4-eeepc.tar.bz2. Untar it, compile it and have fun! :)
It's good, now you have two options: vanilla kernel or original EEE kernel.
Technorati tags: asus eee hacking linux xandros debian squashfs
|
|
Making ASUS EEE more useful
| |
ASUS EEE is becoming more and more popular. As such, there's more and more modifications and support for it. eee.ko module is one of them. eee.ko consists of a kernel module to change the eee's FSB speed, allowing the CPU to run at its full 900Mhz. eee.ko provides nice /proc interface for fan control too.
Because, there's no eee.ko precompiled module for Xandros default distribution, I compiled one and you can download it (together with source patch to work on Xandros if you want to compile it yourself because the module is written for Ubuntu newer kernel originally). There's also nice script for FAN control which you can download (if you don't like /proc interface).
If you are interested only in controlling the fan of your ASUS EEE, then you can download this eee.ko fan module only..
I would recommend reading this topic and this topic to people interested in booting puppy linux on ASUS EEE (as they contain link to kernel modules/drivers for ASUS EEE hardware compiled for puppyLinux). If you're just interested in PET packages for puppylinux having these modules/drivers, you can download them here.
I have also compiled squashfs (3.3) for Xandros default distribution. I made it available on my site so, you can download squashfs kernel module and squashfs tools (in case you want to make squashfs directly on ASUS EEE). Why squashfs? Well, you can compress read only part of 4gb disk with squashfs and save some space on your ASUS EEE.
If you are from Croatia and interested in ASUS EEE tweaking, I would also recommend joining eeepc-zagreb group.
Technorati tags: asus eee hacking linux xandros debian squashfs
|
|
First 24 hours with ASUS EEE
| |
ASUS EEE doesn't have Bluetooth by default, but it has bluetooth packages lying around in default installation. So, I plugged in my Bluetooth USB dongle and changed few parameters. After few minutes, I got my bluetooth connection working with my phone, NXT and Thinkpad.
Because ASUS EEE doesn't have PCMCIA slot, I couldn't use my VIP 3G PCMCICA card to access Internet everywhere. I need that in order to be fully mobile with my ASUS EEE. So, I managed to set up Internet connection using my mobile phone via bluetooth. I just copied the scripts I use with my Thinkpad to reach Internet via mobile phone and it worked! Now, my ASUS EEE become even more mobile :)
If you want to connect your ASUS EEE to Internet via mobile phone, I found nice instructions here. It's typical instructions for connecting to internet via your mobile phone with chat scripts and pppd.
 Happy ASUS EEE users ;)
If you didn't know - ASUS EEE has web camera (with Skype software and Skype video working out of the box). With my knowledge of audio/video streaming I gained from streaming HULK events like this one, I tried to set up basic audio/video streaming using ASUS EEE device, just for fun.
First, I had to enable camera (it's enabled only if you use Skype or webcam software) using this command:
echo 1 > /proc/acpi/asus/camera
After turning on the camera, typical V4L device appears at /dev/video0. Basically, I used gstreamer to grab and recode audio/video and shout2send gstreamer plugin to forward OGG stream to icecast server (I could use oggfwd too, but gstreamer seemed faster solution). With combination of mobile internet, I got extremely mobile streaming solution using open OGG (Theora/Vorbis) format. It's stil not perfect streaming, because it's only 900 Mhz procesor, but it's usable. I guess I have to tune it more. Probably, I'll write step by step guide for EEE user Wiki about that.
After playing with camera, don't forget to turn off your camera in order to save battery :) :
echo 0 > /proc/acpi/asus/camera
Actually, /proc/acpi/asus is just interface for asus_acpi module. Using it, you can turn off (or turn on) some devices in order to save battery life of your ASUS EEE. Here is quick oneliner how you can turn off wireless, camera and card reader:
for i in camera cardr wlan; do (echo 0 > /proc/acpi/asus/$i); done
and to turn it on all again:
for i in camera cardr wlan; do (echo 1 > /proc/acpi/asus/$i); done
If you don't like my quick solutions :), you can see this solution from Avian.
Dobrica told me he has problems with apt-get upgrading his ASUS EEE (Firefox segfaults after upgrade). Anyway, I found the fix on the internet. Solution is actually to remove scim support (it's for Asian languages anyway and we don't use it here). Dobrica said he used another fix: apt-get install eeepc-updatepack-20071126. It seems it's the better one. Anyway, I guess I'm lucky because I didn't had that problem he had.
Technorati tags: asus eee hacking linux xandros debian
|
|
ASUS EEE - first impressions
| |
Yesterday, we bought ASUS EEE. It's cheap and light subnotebook running Linux (specifically, Xandros distribution). It has Firefox, Thunderbird, OpenOffice.Org, Skype, Pidgin/Gaim, Amarok, Smplayer already on his solid state drive.
When we bought it, we spent some time searching for terminal (it's ctrl+alt+t BTW), but after successful search - everything was open for happy afternoon :)
After digging for some time inside ASUS EEE software solution, here's few of my findings:
To get BIOS boot menu of ASUS EEE press Escape. I tried PuppyLinux and different versions of Slax (Slax is my USB distro of choice after Puppy debacle) just after going out of the ASUS EEE Shop. Both distros worked flawlessly.
ASUS EEE version of Xandros uses ASUS Launcher and icewm. I'm old user of icewm, so I tweaked it in a few seconds to suit my need :)
ASUS EEE uses unionfs. Just notice for beginners: that means if you delete some preinstalled software doesn't mean you actually deleted the software and saved some space. You just marked these files as deleted. On the other hand, it easies restoration of ASUS EEE original state if you do something wrong.
Xandros is based on Debian, so apt-get stuff works which makes upgrading and installing additional software easy. I would suggest you to add repositories for ASUS EEE as described here. Openssh-server, nmap, kismet and sshfs is already happily working on my ASUS EEE.
There's no runlevels on ASUS EEE version of Xandros. There's fastinit in /sbin/fastinit which handles the init process. That also means that your scripts in /etc/init.d will not be started by default. More about the boot process, you can read here.
Changing login name(by default it is user) is bit harder because /sbin/fastinit has hard coded value of user when launching startx (su -l user commands hard coded). So, what I come up with is having two different login names with same uid/gid (of course, with my preffered login name first) in authentication files (passwd/shadow). If you are doing that for yourself, you should be aware of implications of that solution.
I would definitevly suggest to read Wiki at www.eeeuser.com because it has lot of tips&tricks regarding tweaking your ASUS EEE.
Technorati tags: asus eee hacking linux xandros debian
|
|
Defcon 15: 1st day of the convention
| |
So, let's start with the talks actually :) Conference day starts usually from 10am and it ends up at 8-9pm. There are 5 parallel tracks each day. Usually there is 10 minutes break between the lectures, so people can change the track if they want to. But there are no breaks for lunch.
 Defcon 15: Everything is ready
I decided to join Joe Grand's (aka Kingpin) presentation about making the defcon 15 badge. He started his lecture with the poem about the badge and later he described the process of making the defcon 15 badge as it is now. Complete source code and schematics can be found on his website. He said he used Freescale. The software development enviroment for the Badge is available for free (max. 16 kb) here (It's frescale's Codewarrior). Also, hardware debugging can be done with Freescale's USB spydero 8 module or p&e micro heso8 multilink usb-ml-12. He officially announced hacking the badge contest and said tools and extension will be provided for free in the vendor area. On the end of the lecture, he was asked about that "GO VOICE" message and geocoordinates. Kingpin explained that "GO VOICE" message is there just for fun. The message is from the old BBS days (when you talked with SysOp and wanted to chat with him over the phone). He commented GPS coordinates as a part of hacking history.
Bruce Schneier was the next lecturer. He's known as Chuck Norris of information security (link) and author of popular security blog called Schneier on Security. He held Q&A session and topics were as expected: recent TSA issues and how he got to the Defcon :) , Hash algorithm contest, privacy and data pollution, aggregate data benefits vs personal data privacy, encryption, ...
 Defcon 15: Bruce Schneier
After Bruce, I switched the track to hear about breaking forensics software. Talk was mostly about Encase potential vulnerabilities and how you can hide data from forensic team who uses Encase. Interesting example is that you can use 26th partition to hide data (Encase only recognizes only first 25 partitions). But it will be fixed in next release of Encase.
There were also lot of talks and comments about static code analysis vs. fuzzing. I don't see why I should choose at all? I use happily both methods: static code analysis and (preferably intelligent) fuzzing.
For this night entertainment, Black ball was organized featuring Regenerator. It was advised to dress your best blacks and that bondage rubber and fetish is encouraged on black ball, so it was interesting how people were dressed up ;)
Another interesting side effect of the convention are ATMs:
 Defcon 15: ATMs are out of order
And if you come closer to ATM you can see big "Out of order" message:
 Defcon 15: ATM is out of order
It's the first day of the Defcon and ATMs are not working. Coincidence? :)
Technorati tags: conference hacking cracking security convention las vegas defcon 15 defcon2007
|
|
Defcon 15: Undercover NBC reporter owned
| |
Hackers take their privacy seriously. For those who don't know, Defcon has a strict policy against media and their filming conference attendees. Media must get permission from any individual that will be filmed (and sweeping the room with TV camera is forbidden). All journalists covering DefCon must sign such an agreement. Some of the journalists didn't take that seriously. Specifically: Dateline NBC associate producer Michelle Madigan. She registered as regular attendee, so she can bypass mentioned legal agreement. It is believed that NBC sent her with a hidden camera to the event to capture hackers admitting to crimes.
On the start of the first day of the convention, we were warned about the undercover reporter. We even knew how she looks like because Defcon goons displayed her photo before the convention even began. She was soon led into a large auditorium and then Dark Tanget announced her presence and her intentions. She immediately started to flee. Of course, she was followed by dozen of reporters and conference attendees. There is also video covering the event, so you can see it for yourself:
On this link you can read the transcript of the video (in case you didn't hear well. You can also read story covering the event and slashdot story with commentaries.
I don't know how come they sent attractive young lady to the hacker's/geek's event in order to have undercover story. Now, I'm wondering how come they succeeded with old stories (like that famous when NBC succeeded to tape men who are allegedly seeking to have sex with minors). I guess it was pure luck. Maybe geeks look sometimes like socially retarded people :), but geeks ain't stupid. She learned that. Hard way :)
Technorati tags: conference hacking cracking security convention las vegas defcon 15 defcon2007
|
|
Tribute to the Defcon 2007 badge
| |
If you are good at spotting the details, then you probably noticed on photos from the last blog post that Defcon badge has batteries. That means you can do some hacking on it :) Unlike last year, this year you can even program it via buttons(easy way, I would dare to say). This is the front side of the the badge:
 Defcon 2007 badge: front side
And this is the back side of the badge:
 Defcon 2007 badge: back side
There's also some funny and challenging stuff written on the badge. I discovered binary code and something that looks like GPS coordinates. I tried to ASCII decode badge binary code 01000111010011110010000001010110010011110100100101000011010 and got GO VOICE message. I tried to enter GPS coordinates that were on the badge (42.34202 -71.069441) and Google Maps says it's somewhere in Boston, MA. I saw Kristine also tried to map it and she discovered that GPS coordinates are pointing to location on Walham Street (anyone knows why is that location on the badge?).
Let's go to the fun part: you can hack the badge. There are buttons for basic customization of the badge, but for those hard core hardware freaks it is welcomed to hack it with the solder. The source code is open and schematics is free. Badge is extensible and hackable, so you can add accelerometer or wireless transceiver on it. There is also contest for the best hack of the badge (if you're solder uhm hardware freak).
I recorded short video of basic badge features, so you can see it for yourself:
It looks somehow weird to see people standing and playing with their own badge :) But can you imagine how weird it will be if everyone would play with accelerometer on Defcon? ;)
I'm not hardware guy at all, so I just tried to play with my plain apartman keys (to short circuit some stuff). The best effect you can get on the badge if you short circuit components just above the batteries. I saw that other people were playing with the badge also (this one or this one, and of course Kristine). Some guys even found vulnerability! LOL
Badge is definitively proof of the creativity in every aspect of the convention organization. But what's most important: it encourages creativity of attenders also.
Technorati tags: conference hacking cracking security convention las vegas defcon 15 defcon2007 badge
|
...read more...
|