Here's the header pinout: http://www.cnx-software.com/2015/09/26/status-of-orange-pi-boards-gpio-support/
Here's the steps: https://linux-sunxi.org/GPIO
So, to up pin 12, a.k.a. PD14 I do:
echo 110 > /sys/class/gpio/export
echo "out" > /sys/class/gpio/gpio110/direction
echo "1" > /sys/class/gpio/gpio110/value
Showing posts with label hardware. Show all posts
Showing posts with label hardware. Show all posts
Friday, July 15, 2016
Friday, June 6, 2014
Rearming KitKat with a frickin' laser (and USB)
The kids returned from a Children's day festival with a bag of more or less worthless trinkets, among them a lovely KitKat promotional ball mouse. Its fatal handicap is the connector - the last time I had a PS/2 in my machine was a decade ago ...
I contemplated building a PS/2-USB interface with an Arduino, but lacked the 3.6V Zeners used in the circuit I found on the intertubes.
Fortunately there was an old USB laser optical mouse lying in my drawer.
I decided to transplant its innards to KitKat.
The scroll-wheel is broken, but since KitKat doesn't have one it's not a problem :-)
The PCB was too large to fit into the enclosure and the switches needed to be repositioned.
Cut, resolder, rewire, fasten with hot glue,
et voilà - a USB KitKat laser mouse!
I contemplated building a PS/2-USB interface with an Arduino, but lacked the 3.6V Zeners used in the circuit I found on the intertubes.
Fortunately there was an old USB laser optical mouse lying in my drawer.
I decided to transplant its innards to KitKat.
The scroll-wheel is broken, but since KitKat doesn't have one it's not a problem :-)
The PCB was too large to fit into the enclosure and the switches needed to be repositioned.
Cut, resolder, rewire, fasten with hot glue,
et voilà - a USB KitKat laser mouse!
Saturday, February 15, 2014
TP-Link TL-WR741ND unbricking
So I was playing with the router, mounted one of the system partitions and after reboot it wouldn't come up.
Fortunately the box comes with serial, although not in very convenient way.
The OpenWRT wiki has photos with locations of the pins.
After some soldering and hot-glueing I had the serial port ready:
To connect it to the PC, I've finally found some use of the Arduino, or rather the FTDI chip that comes with it, as described by ZooBaB:
I've installed a tftp server and copied the firmware to its directory:
root@debian:~# apt-get install tftpd-hpa
Reading package lists... Done
Building dependency tree
Reading state information... Done
Suggested packages:
syslinux-common
The following NEW packages will be installed:
tftpd-hpa
0 upgraded, 1 newly installed, 0 to remove and 4 not upgraded.
Need to get 47.6 kB of archives.
After this operation, 91.1 kB of additional disk space will be used.
Get:1 http://ftp.cz.debian.org/debian/ wheezy/main tftpd-hpa amd64 5.2-4 [47.6 kB]
Fetched 47.6 kB in 0s (196 kB/s)
Preconfiguring packages ...
Selecting previously unselected package tftpd-hpa.
(Reading database ... 108212 files and directories currently installed.)
Unpacking tftpd-hpa (from .../tftpd-hpa_5.2-4_amd64.deb) ...
Processing triggers for man-db ...
Setting up tftpd-hpa (5.2-4) ...
[ ok ] Starting HPA's tftpd: in.tftpd.
root@debian:~# cp /home/hajma/openwrt/openwrt/bin/ar71xx/openwrt-ar71xx-generic-tl-wr741nd-v2-squashfs-sysupgrade.bin /srv/tftp/
root@debian:~#
Then I set the PC's IP to 192.168.1.3 and connected it to the first Ethernet port of the router.
Then I connected to the serial link:
$ screen /dev/ttyUSB1 115200,cs8,-parenb,-cstopb
And this is what I saw:
U-Boot 1.1.4 (Sep 3 2010 - 12:28:13)
AP91 (ar7240) U-boot
DRAM:
sri
#### TAP VALUE 1 = a, 2 = b
32 MB
id read 0x100000ff
flash size 4194304, sector count = 64
Flash: 4 MB
Using default environment
In: serial
Out: serial
Err: serial
Net: ag7240_enet_initialize...
No valid address in Flash. Using fixed address
: cfg1 0xf cfg2 0x7014
eth0: 00:03:7f:09:0b:ad
eth0 up
No valid address in Flash. Using fixed address
: cfg1 0xf cfg2 0x7214
eth1: 00:03:7f:09:0b:ad
eth0 up
No valid address in Flash. Using fixed address
: cfg1 0xf cfg2 0x7214
eth1: 00:03:7f:09:0b:ad
ATHRS26: resetting s26
ATHRS26: s26 reset done
eth1 up
eth0, eth1
Autobooting in 1 seconds
## Booting image at 9f020000 ...
Uncompressing Kernel Image ... Error: Bad gzipped data
GUNZIP ERROR - must RESET board to recover
Resetting...
... stuck in a boot loop due to corrupted firmware.
Following the steps at the OpenWRT wiki to tftp the image:
Type 'tpl' to break to boot loop. Then
Fortunately the box comes with serial, although not in very convenient way.
The OpenWRT wiki has photos with locations of the pins.
After some soldering and hot-glueing I had the serial port ready:
To connect it to the PC, I've finally found some use of the Arduino, or rather the FTDI chip that comes with it, as described by ZooBaB:
I've installed a tftp server and copied the firmware to its directory:
root@debian:~# apt-get install tftpd-hpa
Reading package lists... Done
Building dependency tree
Reading state information... Done
Suggested packages:
syslinux-common
The following NEW packages will be installed:
tftpd-hpa
0 upgraded, 1 newly installed, 0 to remove and 4 not upgraded.
Need to get 47.6 kB of archives.
After this operation, 91.1 kB of additional disk space will be used.
Get:1 http://ftp.cz.debian.org/debian/ wheezy/main tftpd-hpa amd64 5.2-4 [47.6 kB]
Fetched 47.6 kB in 0s (196 kB/s)
Preconfiguring packages ...
Selecting previously unselected package tftpd-hpa.
(Reading database ... 108212 files and directories currently installed.)
Unpacking tftpd-hpa (from .../tftpd-hpa_5.2-4_amd64.deb) ...
Processing triggers for man-db ...
Setting up tftpd-hpa (5.2-4) ...
[ ok ] Starting HPA's tftpd: in.tftpd.
root@debian:~# cp /home/hajma/openwrt/openwrt/bin/ar71xx/openwrt-ar71xx-generic-tl-wr741nd-v2-squashfs-sysupgrade.bin /srv/tftp/
root@debian:~#
Then I set the PC's IP to 192.168.1.3 and connected it to the first Ethernet port of the router.
Then I connected to the serial link:
$ screen /dev/ttyUSB1 115200,cs8,-parenb,-cstopb
And this is what I saw:
U-Boot 1.1.4 (Sep 3 2010 - 12:28:13)
AP91 (ar7240) U-boot
DRAM:
sri
#### TAP VALUE 1 = a, 2 = b
32 MB
id read 0x100000ff
flash size 4194304, sector count = 64
Flash: 4 MB
Using default environment
In: serial
Out: serial
Err: serial
Net: ag7240_enet_initialize...
No valid address in Flash. Using fixed address
: cfg1 0xf cfg2 0x7014
eth0: 00:03:7f:09:0b:ad
eth0 up
No valid address in Flash. Using fixed address
: cfg1 0xf cfg2 0x7214
eth1: 00:03:7f:09:0b:ad
eth0 up
No valid address in Flash. Using fixed address
: cfg1 0xf cfg2 0x7214
eth1: 00:03:7f:09:0b:ad
ATHRS26: resetting s26
ATHRS26: s26 reset done
eth1 up
eth0, eth1
Autobooting in 1 seconds
## Booting image at 9f020000 ...
Uncompressing Kernel Image ... Error: Bad gzipped data
GUNZIP ERROR - must RESET board to recover
Resetting...
... stuck in a boot loop due to corrupted firmware.
Following the steps at the OpenWRT wiki to tftp the image:
Type 'tpl' to break to boot loop. Then
ar7240> setenv ipaddr 192.168.1.100
ar7240> setenv serverip 192.168.1.3
ar7240> tftpboot 0x80000000 openwrt-ar71xx-generic-tl-wr741nd-v2-squashfs-sysupgrade.bin
eth1 link down
eth0 link down
Using eth1 device
TFTP from server 192.168.1.3; our IP address is 192.168.1.100
Filename 'openwrt-ar71xx-generic-tl-wr741nd-v2-squashfs-sysupgrade.bin'.
Load address: 0x80000000
Loading: T T T T T T T T T T
Retry count exceeded; starting again
eth0 link down
eth1 link down
Using eth0 device... TFTP from server 192.168.1.3; our IP address is 192.168.1.100
Filename 'openwrt-ar71xx-generic-tl-wr741nd-v2-squashfs-sysupgrade.bin'.
Load address: 0x80000000
Loading: #################################################################
#################################################################
#################################################################
#################################################################
#################################################################
#################################################################
#################################################################
#################################################################
#################################################################
#################################################################
#################################################################
##
done
Bytes transferred = 3670020 (380004 hex)ar7240> erase 0x9f020000 +0x380004
First 0x2 last 0x3a sector size 0x10000 58
Erased 57 sectors
ar7240> cp.b 0x80000000 0x9f020000 0x380004
Copy to Flash... write addr: 9f020000
donear7240> bootm 0x9f020000
## Booting image at 9f020000 ...
Uncompressing Kernel Image ... OK
Starting kernel ...
OpenWrt kernel loader for AR7XXX/AR9XXX
Copyright (C) 2011 Gabor Juhos
Looking for OpenWrt image... found at 0xbf022000
Decompressing kernel... done!
Starting kernel at 80060000...
[ 0.000000] Linux version 3.10.28 (hajma@debian) (gcc version 4.6.4 (OpenWrt/Linaro GCC 4.6-2013.05 r39457) ) #4 Fri Feb 14 00:04:39 CET 2014
[ 0.000000] bootconsole [early0] enabled
[ 0.000000] CPU revision is: 00019374 (MIPS 24Kc)
[ 0.000000] SoC: Atheros AR7240 rev 2
[ 0.000000] Clocks: CPU:350.000MHz, DDR:350.000MHz, AHB:175.000MHz, Ref:5.000
MHz
[ 0.000000] Determined physical RAM map:
[ 0.000000] memory: 02000000 @ 00000000 (usable)
[ 0.000000] Initrd not found or empty - disabling initrd
[ 0.000000] Zone ranges:
[ 0.000000] Normal [mem 0x00000000-0x01ffffff]
[ 0.000000] Movable zone start for each node
[ 0.000000] Early memory node ranges
[ 0.000000] node 0: [mem 0x00000000-0x01ffffff]
[ 0.000000] Primary instruction cache 64kB, VIPT, 4-way, linesize 32 bytes.
[ 0.000000] Primary data cache 32kB, 4-way, VIPT, cache aliases, linesize 32 bytes
[ 0.000000] Built 1 zonelists in Zone order, mobility grouping on. Total pages: 8128
[ 0.000000] Kernel command line: board=TL-WR741ND console=ttyS0,115200 rootfstype=squashfs,jffs2 noinitrd
[ 0.000000] PID hash table entries: 128 (order: -3, 512 bytes)
[ 0.000000] Dentry cache hash table entries: 4096 (order: 2, 16384 bytes)
[ 0.000000] Inode-cache hash table entries: 2048 (order: 1, 8192 bytes)
[ 0.000000] Writing ErrCtl register=00000000
[ 0.000000] Readback ErrCtl register=00000000
[ 0.000000] Memory: 29168k/32768k available (2062k kernel code, 3600k reserved, 354k data, 268k init, 0k highmem)
[ 0.000000] SLUB: HWalign=32, Order=0-3, MinObjects=0, CPUs=1, Nodes=1
[ 0.000000] NR_IRQS:51[ 0.000000] Calibrating delay loop... 232.24 BogoMIPS (lpj=1161216)
[ 0.080000] pid_max: default: 32768 minimum: 301
[ 0.080000] Mount-cache hash table entries: 512
[ 0.090000] NET: Registered protocol family 16
[ 0.100000] MIPS: machine is TP-LINK TL-WR741ND
[ 0.500000] registering PCI controller with io_map_base unset
[ 0.510000] bio: create slab at 0
[ 0.520000] PCI host bridge to bus 0000:00
[ 0.520000] pci_bus 0000:00: root bus resource [mem 0x10000000-0x13ffffff]
[ 0.530000] pci_bus 0000:00: root bus resource [io 0x0000]
[ 0.530000] pci_bus 0000:00: No busn resource found for root bus, will use [bus 00-ff]
[ 0.540000] pci 0000:00:00.0: fixup device configuration
[ 0.540000] pci 0000:00:00.0: BAR 0: assigned [mem 0x10000000-0x1000ffff 64bit]
[ 0.550000] pci 0000:00:00.0: using irq 40 for pin 1
[ 0.550000] Switching to clocksource MIPS
[ 0.560000] NET: Registered protocol family 2
[ 0.560000] TCP established hash table entries: 512 (order: 0, 4096 bytes)
[ 0.570000] TCP bind hash table entries: 512 (order: -1, 2048 bytes)
[ 0.580000] TCP: Hash tables configured (established 512 bind 512)
[ 0.580000] TCP: reno registered
[ 0.590000] UDP hash table entries: 256 (order: 0, 4096 bytes)
[ 0.590000] UDP-Lite hash table entries: 256 (order: 0, 4096 bytes)
[ 0.600000] NET: Registered protocol family 1
[ 0.620000] squashfs: version 4.0 (2009/01/31) Phillip Lougher [ 0.630000] jffs2: version 2.2 (NAND) (SUMMARY) (LZMA) (RTIME) (CMODE_PRIORITY) (c) 2001-2006 Red Hat, Inc.
[ 0.640000] msgmni has been set to 56
[ 0.650000] io scheduler noop registered
[ 0.650000] io scheduler deadline registered (default)
[ 0.660000] Serial: 8250/16550 driver, 1 ports, IRQ sharing disabled
[ 0.680000] serial8250.0: ttyS0 at MMIO 0x18020000 (irq = 11) is a 16550A
[ 0.690000] console [ttyS0] enabled, bootconsole disabled
[ 0.690000] console [ttyS0] enabled, bootconsole disabled
[ 0.700000] ath79-spi ath79-spi: master is unqueued, this is deprecated
[ 0.710000] m25p80 spi0.0: found s25sl032p, expected m25p80
[ 0.720000] m25p80 spi0.0: s25sl032p (4096 Kbytes)
[ 0.720000] 5 tp-link partitions found on MTD device spi0.0
[ 0.730000] Creating 5 MTD partitions on "spi0.0":
[ 0.730000] 0x000000000000-0x000000020000 : "u-boot"
[ 0.740000] 0x000000020000-0x0000000f8200 : "kernel"
[ 0.750000] mtd: partition "kernel" must either start or end on erase block boundary or be smaller than an erase block -- forcing read-only
[ 0.760000] 0x0000000f8200-0x0000003f0000 : "rootfs"
[ 0.770000] mtd: partition "rootfs" must either start or end on erase block boundary or be smaller than an erase block -- forcing read-only
[ 0.780000] mtd: device 2 (rootfs) set to be root filesystem
[ 0.790000] 1 squashfs-split partitions found on MTD device rootfs
[ 0.790000] 0x0000003a0000-0x0000003f0000 : "rootfs_data"
[ 0.800000] 0x0000003f0000-0x000000400000 : "art"
[ 0.810000] 0x000000020000-0x0000003f0000 : "firmware"[ 0.920000] libphy: ag71xx_mdio: probed
[ 1.480000] ag71xx-mdio.0: Found an AR7240/AR9330 built-in switch
[ 2.510000] eth0: Atheros AG71xx at 0xba000000, irq 5, mode:GMII
[ 3.080000] ag71xx ag71xx.0: connected to PHY at ag71xx-mdio.0:04 [uid=004dd041, driver=Generic PHY]
[ 3.090000] eth1: Atheros AG71xx at 0xb9000000, irq 4, mode:MII
[ 3.090000] TCP: cubic registered
[ 3.100000] NET: Registered protocol family 17
[ 3.100000] 8021q: 802.1Q VLAN Support v1.8
[ 3.120000] VFS: Mounted root (squashfs filesystem) readonly on device 31:2.
[ 3.130000] Freeing unused kernel memory: 268K (802bd000 - 80300000)
procd: Console is alive
procd: - watchdog -
procd: - preinit -
Press the [f] key and hit [enter] to enter failsafe mode
Press the [1], [2], [3] or [4] key and hit [enter] to select the debug level
[ 8.090000] eth0: link up (1000Mbps/Full duplex)
kmod: ran 1 iterations
mount_root: jffs2 is not ready - EOF marker found
[ 10.470000] eth0: link down
procd: - early -
procd: - watchdog -
procd: - ubus -
procd: - init -
Please press Enter to activate this console.
Yay!
Tuesday, September 21, 2010
Printformer
Were you wondering what happened to the non-reusable parts of the deceased Epson Stylus Color 580 printer?
They were reused. Sort of.
Behold, the printformer!
(the half-functional LED torch wasn't part of the printer, we found it on the sidewalk one day)
They were reused. Sort of.
Behold, the printformer!
(the half-functional LED torch wasn't part of the printer, we found it on the sidewalk one day)
Saturday, July 10, 2010
Epson Stylus Color 580
Would you expect an inkjet printer that spent 8 years unplugged in a shelf to just work?
Yeah, correct, no way.
I seemed to work correctly, with the minor detail that there was nothing printed on the paper. I put in a replacement black ink cartridge, but there was change, even after running several head cleaning routines. Suspecting clogged nozzles, I followed the guide at http://www.mk-stuff.de/artikel/epson_printhead_repair,
and even blown air through the ink needles,
but it did not help either.
Finally, in the hope Epson keeps some secrets for their repairmen, I downloaded the Epson Service Manual
and, after getting used to previously unseen levels of English, went through the Troubleshooting section. I verified the nozzles aren't clogged, there are no airlocks, and ink is passing just fine.
So there remains a bug in the print head itself or the motherboard. For both cases the Manual suggests replacing them with spare parts :-(
I'll disassemble the printer and scavenge reusable parts, like the stepper motors and PSU.
So long, Epson, and thanks for all the fish!
Yeah, correct, no way.
I seemed to work correctly, with the minor detail that there was nothing printed on the paper. I put in a replacement black ink cartridge, but there was change, even after running several head cleaning routines. Suspecting clogged nozzles, I followed the guide at http://www.mk-stuff.de/artikel/epson_printhead_repair,
and even blown air through the ink needles,
but it did not help either.
Finally, in the hope Epson keeps some secrets for their repairmen, I downloaded the Epson Service Manual
and, after getting used to previously unseen levels of English, went through the Troubleshooting section. I verified the nozzles aren't clogged, there are no airlocks, and ink is passing just fine.
So there remains a bug in the print head itself or the motherboard. For both cases the Manual suggests replacing them with spare parts :-(
I'll disassemble the printer and scavenge reusable parts, like the stepper motors and PSU.
So long, Epson, and thanks for all the fish!
Monday, June 29, 2009
Hackovani Canon Powershot A590IS
Jak jste zajisté z titulku poznali, nechal jsem se nedávno přesvědčit ke koupi Canonu A590. Jedním z jeho pozitiv je i hackovatelnost pomocí CHDK.
Na foťáku mi celkem dost vadilo, že si (a to ani v manuálním režimu) nepamatuje nastavení makra a já přitom makro používám celkem dost.
Zatím jsem se nedostal k pokusu ukládat tohle nastavení, ale už mám řešení, které mi v 95% případů vyhovuje. Následující skript je nastaven na spuštění při startu. Pokud zjistí, že je ovládací kolečko nastaveno na P a zároveň je foťák ve fotícím režimu, zmáčkne 2x dolů, čímž nastaví makro režim.
Na foťáku mi celkem dost vadilo, že si (a to ani v manuálním režimu) nepamatuje nastavení makra a já přitom makro používám celkem dost.
Zatím jsem se nedostal k pokusu ukládat tohle nastavení, ale už mám řešení, které mi v 95% případů vyhovuje. Následující skript je nastaven na spuštění při startu. Pokud zjistí, že je ovládací kolečko nastaveno na P a zároveň je foťák ve fotícím režimu, zmáčkne 2x dolů, čímž nastaví makro režim.
--[[
@title Default Script
@param a Dial position
@default a 0
--]]
modestrings={
'AUTO',
'P',
'TV',
'AV',
'M',
'PORTRAIT',
'NIGHT',
'LANDSCAPE',
'VIDEO_STD',
'VIDEO_SPEED',
'VIDEO_COMPACT',
'VIDEO_MY_COLORS',
'VIDEO_COLOR_ACCENT',
'VIDEO_COLOR_SWAP',
'STITCH',
'MY_COLORS',
'SCN_WATER',
'SCN_NIGHT',
'SCN_CHILD',
'SCN_PARTY',
'SCN_GRASS',
'SCN_SNOW',
'SCN_BEACH',
'SCN_FIREWORK',
'SCN_COLOR_ACCENT',
'SCN_COLOR_SWAP',
'VIDEO_HIRES',
'SCN_AQUARIUM',
'COLOR_ACCENT',
'SCN_NIGHT1',
'SCN_ISO_3200',
'SCN_SPORT',
'SCN_KIDS_PETS',
'INDOOR',
'KIDS_PETS',
'NIGHT_SNAPSHOT',
'DIGITAL_MACRO',
'SCN_FOLIAGE',
'VIDEO_TIME_LAPSE',
'SCN_INDOOR',
'SCN_PORTRAIT',
'SUPER_MACRO',
'VIDEO_PORTRAIT',
'VIDEO_NIGHT',
'VIDEO_INDOOR',
'VIDEO_FOLIAGE',
'VIDEO_SNOW',
'VIDEO_BEACH',
'VIDEO_AQUARIUM',
'VIDEO_SUPER_MACRO',
'VIDEO_STITCH',
'VIDEO_MANUAL',
'SPORTS',
}
sleep( 500 )
is_record,is_video,mode=get_mode()
if (tostring(modestrings[bitand(mode,0xFF)])=="P" and is_record) then
click("down")
sleep( 40 )
click("down")
sleep( 40 )
end
exit_alt()
Saturday, August 30, 2008
iDuino - mám je
Jak jsem psal, objednal jsem si 5. srpna od Fundamental Logic 5ks iDuino.
Potvrzení mi přišlo hned, za dva dny pak že se čeká na sestavení. A potom dlouho nic. Na webu sice mají napsáno, že sestavení může trvat až pět pracovních dní, ale 14. srpna už mi to přišlo poněkud moc, tak jsem se připomněl decentním mailem. Druhý den mi odpověděl Kevin Bralten, že jim akorát dorazily od dodavatele a testují je. Zpoždění prý měl na svědomí dodavatel. 21. srpna mi pak dorazily dva maily - jeden od PayPalu a druhý od FL, informující o tom, že balíček veze Canada Post.
Balíček, jedna bublinková obálka v druhé, jsem měl ve schránce přesně tři týdny po objednání - v úterý, ale až teď jsem se dostal k tomu je vyzkoušet - byla to opravdu hračka - z menu vybrat 'Examples-Digital-Blink' na blikání LED, v 'Tools-Serial Port' vybrat /dev/ttyUSB0 a pak jen 'Upload to I/O Board'. Abych měl jistotu, zkusil jsem ještě komunikaci s PC - 'Examples-Communication-ASCIITable' posílá do počítače ASCII tabulku.
Nakonec jsem neplatil žádné clo ani DPH, takže mě jeden kus vyšel na 388,20 Kč. Jeden už je zamluvený, takže 1-2 mohu někomu odprodat.
Potvrzení mi přišlo hned, za dva dny pak že se čeká na sestavení. A potom dlouho nic. Na webu sice mají napsáno, že sestavení může trvat až pět pracovních dní, ale 14. srpna už mi to přišlo poněkud moc, tak jsem se připomněl decentním mailem. Druhý den mi odpověděl Kevin Bralten, že jim akorát dorazily od dodavatele a testují je. Zpoždění prý měl na svědomí dodavatel. 21. srpna mi pak dorazily dva maily - jeden od PayPalu a druhý od FL, informující o tom, že balíček veze Canada Post.
Balíček, jedna bublinková obálka v druhé, jsem měl ve schránce přesně tři týdny po objednání - v úterý, ale až teď jsem se dostal k tomu je vyzkoušet - byla to opravdu hračka - z menu vybrat 'Examples-Digital-Blink' na blikání LED, v 'Tools-Serial Port' vybrat /dev/ttyUSB0 a pak jen 'Upload to I/O Board'. Abych měl jistotu, zkusil jsem ještě komunikaci s PC - 'Examples-Communication-ASCIITable' posílá do počítače ASCII tabulku.
Nakonec jsem neplatil žádné clo ani DPH, takže mě jeden kus vyšel na 388,20 Kč. Jeden už je zamluvený, takže 1-2 mohu někomu odprodat.
Tuesday, August 5, 2008
iDuino
Na svém oblíbeném hackaday.com jsem po vlně různých hacků s platformou Arduino (Vývojová sada s procesorem ATmega168, opensource je hardware i software, soft je multiplatformní) narazil na zprávičku o stickDuino, forku Arduina, který lze zasunout přímo do USB portu. To mě, spolu s informací, že to prodávají za 20 USD, navnadilo. Dolar je dneska za ~15 Kč a to už vychází o něco líp než 770 Kč za echt Arduino Diecimila v českém shopu. Nakonec jsem se ale rozhodl pro iDuino.
iDuino se k PC připojuje pomocí USB s Mini-B konektorem (to je ten malej k digitálním foťákům apod.). Jeho velkou výhodou je maximální kombinovatelnost s nepájivými kontaktními poli.
V procesoru, který je na desce, zabírá 2kB z 16kB bootloader, díky kterému je nahrávání programů jednoduché. Ale pomocí jednoduchých triků se dá deska použít i k programování čistých procesorů, a to i Mega8, Tiny2313 a Tiny13.
Minimální objednávka už hotové desky byla 5ks. 2-3 kusy určitě využiju, ale zbylé dva klidně prodám za náklady (cca 390 Kč, ale asi k tomu přijde i DPH a clo, nechám se překvapit). Takže pokud máte někdo zájem, tak se ozvěte.
Jo a taky díky tomu jsem si dneska konečně aktivoval účet na PayPalu.
Nejdřív jsem musel zavolat na linku Servis24 spořky a nastavit "limity pro transakce bez fyzické přítomnosti karty" (přes web to nejde a hodinu na pobočce se mi trávit nechtělo). Nejdřív mi slečna řekla, že to bude aktivovaný až ve středu, že jim to tak prostě v systému chodí, ale když jsem vyjádřil rozčarování, tak z ní vylezlo, že za 50 Kč to můžu mít expres za 30 minut. No tak jo. Asi za hodinu jsem to zkusil, v internetbankingu sice ještě změna nebyla, ale PayPal už mi kartu ověřil.
Tuesday, June 17, 2008
Customizing Asus AM200g - III. jabberd and vim
It took me some time to actually make the jabber server working, few people seem to really care about cross-compiling their stuff, but I succeeded and here's the howto:
0. Errata
First of all, during the testing I found out I have to modify the environment settings - the static build of jabber did not work at all. I also added the location of newly compiled libs and headers so that they can be used by programs that depend on them. Some programs were in C++, so the CXX variable had to be set as well. Here's the final environment (P.S. in the end it seems some additions like CPPFLAGS would be needed for perfection, but I'm not in the mood of retrying):
$ cat environment
TOOLCHAINS_HOME=/opt/toolchains/uclibc-crosstools
export LIBS="-L${TOOLCHAINS_HOME}/lib/gcc/mips-linux/3.4.2 \
-L/var/usb/usb_1/lib \
"
export INCLUDES="-I${TOOLCHAINS_HOME}/include/c++/3.4.2 \
-I${TOOLCHAINS_HOME}/mips-linux/sys-include \
-I/var/usb/usb_1/include \
-I/home/hajma/Documents/GPL_AM604G_ForRussia/GENERIC_6348_WLAN_A34_3-06-02-01/kernel/linux/include \
-I/var/usb/usb_1/include/ncurses \
"
#export CFLAGS="${INCLUDES} ${LIBS} -static"
#export LDFLAGS="-static"
export CFLAGS="${INCLUDES} ${LIBS}"
export LDFLAGS=""
export CC="${TOOLCHAINS_HOME}/bin/mipsel-uclibc-gcc"
export CXX="${TOOLCHAINS_HOME}/bin/mipsel-uclibc-g++"
export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:${TOOLCHAINS_HOME}/lib
export PATH="${TOOLCHAINS_HOME}/bin:${PATH}"
Let's use it:
. environment
Also the symlinking of the uclibc toolchain needed to be further enhanced for some package to get built:
# cd /opt/toolchains/uclibc-crosstools/bin
# for A in mips-linux-uclibc-* ; do
> ln -s ${A} mipsel-linux-${A#mips-linux-uclibc-}
> done
1a. jabberd
$ cd GENERIC_6348_WLAN_A34_3-06-02-01/userapps/opensource $ wget http://download.jabberd.org/jabberd14/jabberd14-1.6.1.1.tar.gz $ tar xvf jabberd14-1.6.1.1.tar.gz $ cd jabberd14-1.6.1.1 $./configure --build=i686-pc-linux-gnu --host=mipsel-linux --target=mipsel-linux --prefix=/var/usb/usb_1
This ends badly:
... checking for libpopt... configure: error: no
Apparently the library for parsing command line parameters is needed. This was reported a year ago ...
2. popt
$ cd GENERIC_6348_WLAN_A34_3-06-02-01/userapps/opensource $ wget http://freshmeat.net/redir/popt/72854/url_tgz/popt-1.14.tar.gz $ tar xvf popt-1.14.tar.gz $ cd popt-1.14 $ ./configure --build=i686-pc-linux-gnu --host=mipsel-linux --target=mipsel-linux --prefix=/var/usb/usb_1 ... checking for va_copy() function... configure: error: cannot run test program while cross compiling See `config.log' for more details.
WTF! There's bug 25 about it that the developers closed, saying "va_copy is no longer needed or used in popt-1.14.". Hell, when it's not needed, why did you keep the check ... :-(
I added a comment to the bug and sucessfully run:
$ ./configure --build=i686-pc-linux-gnu --host=mipsel-linux --target=mipsel-linux --prefix=/var/usb/usb_1 ac_cv_va_copy=no $ make $ make install
1b. jabberd
Retry:
$ cd ../jabberd14-1.6.1.1 $ ./configure --build=i686-pc-linux-gnu --host=mipsel-linux --target=mipsel-linux --prefix=/var/usb/usb_1 ... checking for libpopt... configure: error: no
The previous step did not help much ... The configure script does not search for the popt.h in the provided directories - again something reported a year ago. It forced me to rise bug 93.
Retry:
$ CPPFLAGS="-I/var/usb/usb_1/include" ./configure --build=i686-pc-linux-gnu --host=mipsel-linux --target=mipsel-linux --prefix=/var/usb/usb_1 ... checking for GNUTLS... no No package 'gnutls' found configure: error: Couldn't find required GnuTLS installation
Fine, let's get GnuTLS working first. Furthermore,
./configure --help reveals that some more libraries are needed by jabberd:--with-libidn=DIR Where to find libidn (required) --with-libpth=DIR Where to find libpth (required) --with-expat=DIR Where to find libexpat (required)
In addition GnuTLS requires some other libraries, libtasn1 and libgcrypt, so let's get them all first.
3. GNU Portable Threads
$ cd .. $ wget ftp://ftp.gnu.org/gnu/pth/pth-2.0.7.tar.gz $ tar xvf pth-2.0.7.tar.gz $ cd pth-2.0.7 $ ./configure --build=i686-pc-linux-gnu --host=mipsel-linux --target=mipsel-linux --prefix=/var/usb/usb_1 $ make $ make install
4. Expat XML Parser
$ cd .. $ wget http://downloads.sourceforge.net/expat/expat-2.0.1.tar.gz?modtime=1181083143&big_mirror=0 $ tar xvf expat-2.0.1.tar.gz $ cd expat-2.0.1 $ ./configure --build=i686-pc-linux-gnu --host=mipsel-linux --target=mipsel-linux --prefix=/var/usb/usb_1 $ make $ make install
5. GNU IDN Library - Libidn
$ cd .. $ wget ftp://alpha.gnu.org/pub/gnu/libidn/libidn-1.8.tar.gz $ tar xvf libidn-1.8.tar.gz $ cd libidn-1.8 $ ./configure --build=i686-pc-linux-gnu --host=mipsel-linux --target=mipsel-linux --prefix=/var/usb/usb_1 $ make $ make install
6. Tiny ASN.1 library - Libtasn1
$ cd .. $ wget http://josefsson.org/gnutls/releases/libtasn1/libtasn1-1.4.tar.gz $ tar xvf libtasn1-1.4.tar.gz $ cd libtasn1-1.4 $ ./configure --build=i686-pc-linux-gnu --host=mipsel-linux --target=mipsel-linux --prefix=/var/usb/usb_1 $ make $ make install
To save me from
checking for gpg-error-config... no checking for GPG Error - version >= 1.4... no configure: error: libgpg-error is needed. See ftp://ftp.gnupg.org/gcrypt/libgpg-error/ .
when configuring libgcrypt, libgpg-error has to be done in advance.
7. libgpg-error
$ cd .. $ wget ftp://ftp.gnupg.org/gcrypt/libgpg-error/libgpg-error-1.6.tar.bz2 $ tar xvf libgpg-error-1.6.tar.bz2 $ cd libgpg-error-1.6 $ ./configure --build=i686-pc-linux-gnu --host=mipsel-linux --target=mipsel-linux --prefix=/var/usb/usb_1 $ make $ make install
8. libgcrypt
$ cd .. $ wget ftp://ftp.gnupg.org/gcrypt/libgcrypt/libgcrypt-1.4.1.tar.gz $ tar xvf libgcrypt-1.4.1.tar.gz $ cd libgcrypt-1.4.1
The path to libggpg-error has to be specified explicitly:
$ ./configure --build=i686-pc-linux-gnu --host=mipsel-linux --target=mipsel-linux --prefix=/var/usb/usb_1 --with-gpg-error-prefix=/var/usb/usb_1 --with-pth-prefix=/var/usb/usb_1
But it still does not help!:
$ make ... /opt/toolchains/uclibc-crosstools/bin/mipsel-uclibc-gcc -I/var/usb/usb_1/include -I/opt/toolchains/uclibc-crosstools/include/c++/3.4.2 -I/opt/toolchains/uclibc-crosstools/mips-linux/sys-include -I/var/usb/usb_1/include -I/home/hajma/Documents/GPL_AM604G_ForRussia/GENERIC_6348_WLAN_A34_3-06-02-01/kernel/linux/include -I/var/usb/usb_1/include/ncurses -Wall -Wpointer-arith -o .libs/version version.o -L/opt/toolchains/uclibc-crosstools/lib/gcc/mips-linux/3.4.2 -L/var/usb/usb_1/lib ../src/.libs/libgcrypt.so -Wl,--rpath -Wl,/var/usb/usb_1/lib /opt/toolchains/uclibc-crosstools_gcc-3.4.2_uclibc-20050502/bin/../lib/gcc/mips-linux-uclibc/3.4.2/../../../../mips-linux-uclibc/bin/ld: warning: libgpg-error.so.0, needed by ../src/.libs/libgcrypt.so, not found (try using -rpath or -rpath-link) ../src/.libs/libgcrypt.so: undefined reference to `gpg_err_code_from_syserror' ../src/.libs/libgcrypt.so: undefined reference to `gpg_err_code_from_errno' ../src/.libs/libgcrypt.so: undefined reference to `gpg_strerror' ../src/.libs/libgcrypt.so: undefined reference to `gpg_strsource' collect2: ld returned 1 exit status make[2]: *** [version] Error 1 make[2]: Leaving directory `/home/hajma/Dokumenty/GPL_AM604G_ForRussia/GENERIC_6348_WLAN_A34_3-06-02-01/userapps/opensource/libgcrypt-1.4.1/tests' make[1]: *** [all-recursive] Error 1 make[1]: Leaving directory `/home/hajma/Dokumenty/GPL_AM604G_ForRussia/GENERIC_6348_WLAN_A34_3-06-02-01/userapps/opensource/libgcrypt-1.4.1' make: *** [all] Error 2 $
I found out the guys at OpenWRT had the same problem and have a patch available.
I wanted to file a bug to the GnuPG bug tracker, but did not receive the confirmation mail when registering...
Actually this was told to the author two years ago and he does not care at all.
So here goes the needed modification:
$ diff -u tests/Makefile.in.old tests/Makefile.in --- tests/Makefile.in.old 2008-06-12 00:01:05.000000000 +0200 +++ tests/Makefile.in 2008-06-12 00:01:11.000000000 +0200 @@ -313,7 +313,7 @@ # a built header. AM_CPPFLAGS = -I../src -I$(top_srcdir)/src AM_CFLAGS = $(GPG_ERROR_CFLAGS) -LDADD = ../src/libgcrypt.la +LDADD = ../src/libgcrypt.la @LTLIBOBJS@ @GPG_ERROR_LIBS@ # pkbench uses mmap for no good reason. Needs to be fixed. Code for # this can be found in libksba/tests.
and try again:
$ make clean $ ./configure --build=i686-pc-linux-gnu --host=mipsel-linux --target=mipsel-linux --prefix=/var/usb/usb_1 --with-gpg-error-prefix=/var/usb/usb_1 --with-pth-prefix=/var/usb/usb_1 $ make $ make install
9. The GNU Transport Layer Security Library
$ cd .. $ wget ftp://ftp.gnutls.org/pub/gnutls/gnutls-2.2.5.tar.bz2 $ tar xvf gnutls-2.2.5.tar.bz2 $ cd gnutls-2.2.5
To prevent a configure error
checking for libgcrypt-config... no checking for LIBGCRYPT - version >= 1.2.4... no configure: error: *** *** libgcrypt was not found. You may want to get it from *** ftp://ftp.gnupg.org/gcrypt/libgcrypt/ ***
the prefix to libgcrypt has to be specified (and libtasn1 too, to avoid using the built-in one):
$ ./configure --build=i686-pc-linux-gnu --host=mipsel-linux --target=mipsel-linux --prefix=/var/usb/usb_1 --with-libgcrypt-prefix=/var/usb/usb_1 --with-libtasn1-prefix=/var/usb/usb_1
but it still does not work:
$ make ... /opt/toolchains/uclibc-crosstools/bin/mipsel-uclibc-gcc -std=gnu99 -I/opt/toolchains/uclibc-crosstools/include/c++/3.4.2 -I/opt/toolchains/uclibc-crosstools/mips-linux/sys-include -I/var/usb/usb_1/include -I/home/hajma/Documents/GPL_AM604G_ForRussia/GENERIC_6348_WLAN_A34_3-06-02-01/kernel/linux/include -I/var/usb/usb_1/include/ncurses -D_REENTRANT -D_THREAD_SAFE -pipe -I/var/usb/usb_1/include -I/opt/toolchains/uclibc-crosstools/include/c++/3.4.2 -I/opt/toolchains/uclibc-crosstools/mips-linux/sys-include -I/var/usb/usb_1/include -I/home/hajma/Documents/GPL_AM604G_ForRussia/GENERIC_6348_WLAN_A34_3-06-02-01/kernel/linux/include -I/var/usb/usb_1/include/ncurses -D_REENTRANT -D_THREAD_SAFE -o ex-cert-select ex-cert-select.o -L/opt/toolchains/uclibc-crosstools/lib/gcc/mips-linux/3.4.2 -L/var/usb/usb_1/lib ./.libs/libexamples.a ../../gl/.libs/libgnu.a /var/usb/usb_1/lib/libgcrypt.so /var/usb/usb_1/lib/libgpg-error.so ../../lib/.libs/libgnutls.so ../../libextra/.libs/libgnutls-extra.so -Wl,--rpath -Wl,/var/usb/usb_1/lib -Wl,--rpath -Wl,/home/hajma/Dokumenty/GPL_AM604G_ForRussia/GENERIC_6348_WLAN_A34_3-06-02-01/userapps/opensource/gnutls-2.2.5/lib/.libs -Wl,--rpath -Wl,/home/hajma/Dokumenty/GPL_AM604G_ForRussia/GENERIC_6348_WLAN_A34_3-06-02-01/userapps/opensource/gnutls-2.2.5/libextra/.libs -Wl,--rpath -Wl,/var/usb/usb_1/lib /opt/toolchains/uclibc-crosstools_gcc-3.4.2_uclibc-20050502/bin/../lib/gcc/mips-linux-uclibc/3.4.2/../../../../mips-linux-uclibc/bin/ld: warning: libtasn1.so.3, needed by ../../lib/.libs/libgnutls.so, not found (try using -rpath or -rpath-link) ../../lib/.libs/libgnutls.so: undefined reference to `asn1_write_value@LIBTASN1_0_3' ../../lib/.libs/libgnutls.so: undefined reference to `asn1_delete_structure@LIBTASN1_0_3' ../../lib/.libs/libgnutls.so: undefined reference to `asn1_get_length_der@LIBTASN1_0_3' ../../lib/.libs/libgnutls.so: undefined reference to `asn1_get_tag_der@LIBTASN1_0_3' ../../lib/.libs/libgnutls.so: undefined reference to `asn1_der_decoding_startEnd@LIBTASN1_0_3' ../../lib/.libs/libgnutls.so: undefined reference to `asn1_der_decoding@LIBTASN1_0_3' ../../lib/.libs/libgnutls.so: undefined reference to `asn1_create_element@LIBTASN1_0_3' ../../lib/.libs/libgnutls.so: undefined reference to `asn1_copy_node@LIBTASN1_0_3' ../../lib/.libs/libgnutls.so: undefined reference to `asn1_read_value@LIBTASN1_0_3' ../../lib/.libs/libgnutls.so: undefined reference to `asn1_number_of_elements@LIBTASN1_0_3' ../../lib/.libs/libgnutls.so: undefined reference to `asn1_array2tree@LIBTASN1_0_3' ../../lib/.libs/libgnutls.so: undefined reference to `asn1_check_version@LIBTASN1_0_3' ../../lib/.libs/libgnutls.so: undefined reference to `asn1_find_node@LIBTASN1_0_3' ../../lib/.libs/libgnutls.so: undefined reference to `asn1_find_structure_from_oid@LIBTASN1_0_3' ../../lib/.libs/libgnutls.so: undefined reference to `asn1_der_coding@LIBTASN1_0_3' collect2: ld returned 1 exit status make[4]: *** [ex-cert-select] Error 1 make[4]: Leaving directory `/home/hajma/Dokumenty/GPL_AM604G_ForRussia/GENERIC_6348_WLAN_A34_3-06-02-01/userapps/opensource/gnutls-2.2.5/doc/examples' make[3]: *** [all-recursive] Error 1 make[3]: Leaving directory `/home/hajma/Dokumenty/GPL_AM604G_ForRussia/GENERIC_6348_WLAN_A34_3-06-02-01/userapps/opensource/gnutls-2.2.5/doc' make[2]: *** [all] Error 2 make[2]: Leaving directory `/home/hajma/Dokumenty/GPL_AM604G_ForRussia/GENERIC_6348_WLAN_A34_3-06-02-01/userapps/opensource/gnutls-2.2.5/doc' make[1]: *** [all-recursive] Error 1 make[1]: Leaving directory `/home/hajma/Dokumenty/GPL_AM604G_ForRussia/GENERIC_6348_WLAN_A34_3-06-02-01/userapps/opensource/gnutls-2.2.5' make: *** [all] Error 2
After some experimentation (I told you I am no programmer) I found the following to work:
$ LIBS="-ltasn1 $LIBS" ./configure --build=i686-pc-linux-gnu --host=mipsel-linux --target=mipsel-linux --prefix=/var/usb/usb_1 --with-libgcrypt-prefix=/var/usb/usb_1 --with-libtasn1-prefix=/var/usb/usb_1 $ make $ make install
Also I found that the two official mirrors have both different directory structure, so I was missing the devel branch of GnuTLS. The above works with http://www.gnu.org/software/gnutls/releases/gnutls-2.3.14.tar.bz2 (and breaks with 2.2.5).
1c. jabberd
Let's not try to find more bugs and specify the needed components to the
configure script now:$ cd ../jabberd14-1.6.1.1 $ CPPFLAGS="-I/var/usb/usb_1/include" ./configure --build=i686-pc-linux-gnu --host=mipsel-linux --target=mipsel-linux --prefix=/var/usb/usb_1 --with-libidn=/var/usb/usb_1 --with-libpth=/var/usb/usb_1 --with-expat=/var/usb/usb_1
but still bad luck:
checking for GnuTLS... checking for mipsel-linux-pkg-config... no checking for pkg-config... /usr/bin/pkg-config configure: WARNING: In the future, Autoconf will not detect cross-tools whose name does not start with the host triplet. If you think this configuration is useful to you, please write to autoconf@gnu.org. checking pkg-config is at least version 0.9.0... yes checking for GNUTLS... no No package 'gnutls' found configure: error: Couldn't find required GnuTLS installation
And again, reported a year ago.
We can fix that, but the show is still not at the end:
$ PKG_CONFIG_PATH=/var/usb/usb_1/lib/pkgconfig CPPFLAGS="-I/var/usb/usb_1/include" ./configure --build=i686-pc-linux-gnu --host=mipsel-linux --target=mipsel-linux --prefix=/var/usb/usb_1 --with-libidn=/var/usb/usb_1 --with-libpth=/var/usb/usb_1 --with-expat=/var/usb/usb_1 ... checking for GnuTLS... checking for mipsel-linux-pkg-config... no checking for pkg-config... /usr/bin/pkg-config configure: WARNING: In the future, Autoconf will not detect cross-tools whose name does not start with the host triplet. If you think this configuration is useful to you, please write to autoconf@gnu.org. checking pkg-config is at least version 0.9.0... yes checking for GNUTLS... yes checking for TLS 1.2 support in GnuTLS... yes checking for GNUTLSEXTRA... yes checking idna.h usability... yes checking idna.h presence... yes checking for idna.h... yes checking for stringprep_check_version in -lidn... no configure: error: Couldn't find required libidn installation
Quick look into
config.log reveals something familiar:/opt/toolchains/uclibc-crosstools_gcc-3.4.2_uclibc-20050502/bin/../lib/gcc/mips-linux-uclibc/3.4.2/../../../../mips-linux-uclibc/bin/ld: warning: libtasn1.so.3, needed by /var/usb/usb_1/lib/libgnutls-extra.so, not found (try using -rpath or -rpath-link) /var/usb/usb_1/lib/libgnutls.so: undefined reference to `asn1_write_value@LIBTASN1_0_3' /var/usb/usb_1/lib/libgnutls.so: undefined reference to `gcry_sexp_release@GCRYPT_1.2' ...
Let's see if the GnuTLS fix works here as well:
LIBS="-ltasn1 $LIBS" PKG_CONFIG_PATH=/var/usb/usb_1/lib/pkgconfig CPPFLAGS="-I/var/usb/usb_1/include" ./configure --build=i686-pc-linux-gnu --host=mipsel-linux --target=mipsel-linux --prefix=/var/usb/usb_1 --with-libidn=/var/usb/usb_1 --with-libpth=/var/usb/usb_1 --with-expat=/var/usb/usb_1 ... checking for stringprep_check_version in -lidn... no
No, it doesn't :-(, but config.log reveals we got one step further:
... /opt/toolchains/uclibc-crosstools/bin/mipsel-uclibc-g++ -o conftest -g -O2 -I/va r/usb/usb_1/include -I/var/usb/usb_1/include -I/var/usb/usb_1/include -I/var/usb /usb_1/include conftest.cpp -L/var/usb/usb_1/lib /var/usb/usb_1/lib/libgnutls-e xtra.so /var/usb/usb_1/lib/libgnutls.so /var/usb/usb_1/lib/libidn.so -lresolv /v ar/usb/usb_1/lib/libtasn1.so -L/opt/toolchains/uclibc-crosstools/lib/gcc/mips-li nux/3.4.2 -ldl -Wl,--rpath -Wl,/var/usb/usb_1/lib -Wl,--rpath -Wl,/var/usb/usb_1 /lib /opt/toolchains/uclibc-crosstools_gcc-3.4.2_uclibc-20050502/bin/../lib/gcc/mips- linux-uclibc/3.4.2/../../../../mips-linux-uclibc/bin/ld: warning: libgcrypt.so.1 1, needed by /var/usb/usb_1/lib/libgnutls-extra.so, not found (try using -rpath or -rpath-link) ...
Finally, this works:
LIBS="-ltasn1 -lgpg-error -lgcrypt $LIBS" PKG_CONFIG_PATH=/var/usb/usb_1/lib/pkgconfig CPPFLAGS="-I/var/usb/usb_1/include" ./configure --build=i686-pc-linux-gnu --host=mipsel-linux --target=mipsel-linux --prefix=/var/usb/usb_1 --with-libidn=/var/usb/usb_1 --with-libpth=/var/usb/usb_1 --with-expat=/var/usb/usb_1
but make fails:
$ make ... /var/usb/usb_1/include/gnutls/openpgp.h: In function `void mio_tls_process_credentials(xmlnode_t*, const std::list<std::string, std::allocator<std::string> >&, const std::list<std::string, std::allocator<std::string> >&, gnutls_dh_params_int*, const std::list<std::string, std::allocator<std::string> >&, const std::list<std::string, std::allocator<std::string> >&)': /var/usb/usb_1/include/gnutls/openpgp.h:247: error: too few arguments to function `int gnutls_certificate_set_openpgp_key_file(gnutls_certificate_credentials_st*, const char*, const char*, gnutls_openpgp_crt_fmt_t)' mio_tls.cc:615: error: at this point in file /var/usb/usb_1/include/gnutls/openpgp.h:271: error: too few arguments to function `int gnutls_certificate_set_openpgp_keyring_file(gnutls_certificate_credentials_st*, const char*, gnutls_openpgp_crt_fmt_t)' mio_tls.cc:634: error: at this point in file mio_tls.cc:653: error: `gnutls_certificate_set_openpgp_trustdb' undeclared (first use this function) mio_tls.cc:653: error: (Each undeclared identifier is reported only once for each function it appears in.) make[3]: *** [mio_tls.lo] Error 1 make[3]: Leaving directory `/home/hajma/Dokumenty/GPL_AM604G_ForRussia/GENERIC_6348_WLAN_A34_3-06-02-01/userapps/opensource/jabberd14-1.6.1.1/jabberd' make[2]: *** [all-recursive] Error 1 make[2]: Leaving directory `/home/hajma/Dokumenty/GPL_AM604G_ForRussia/GENERIC_6348_WLAN_A34_3-06-02-01/userapps/opensource/jabberd14-1.6.1.1/jabberd' make[1]: *** [all-recursive] Error 1 make[1]: Leaving directory `/home/hajma/Dokumenty/GPL_AM604G_ForRussia/GENERIC_6348_WLAN_A34_3-06-02-01/userapps/opensource/jabberd14-1.6.1.1' make: *** [all] Error 2
This turned out to be easy, the Gentoo folks found and patched it couple of months ago (and it looks it is in the jabberd cvs now) and after applying it, the journey ends:
$ make $ make install
Wow, congratulations!!
Let's get an editor so that we can modify the config files in place:
10a. vim
$ cd .. $ wget ftp://ftp.vim.org/pub/vim/unix/vim-7.1.tar.bz2 $ tar xvf vim-7.1.tar.bz2 $ cd vim71 $ ./configure --build=i686-pc-linux-gnu --host=mipsel-linux --target=mipsel-linux --prefix=/var/usb/usb_1 --with-features=tiny ... checking for strip... strip configure: error: cannot compile a simple program, check CC and CFLAGS (cross compiling doesn't work)
Would you expect an opensource app as big and widespread as Vim to be so broken? I would now. Fortunately the OpenWRT and FreeWRT people come to help again.
$ wget --no-check-certificate https://dev.openwrt.org/browser/packages/utils/vim/patches/001-cross_compile.patch?format=txt $ patch -p1 <001-cross_compile.patch\?format\=txt $ ./configure --build=i686-pc-linux-gnu --host=mipsel-linux --target=mipsel-linux --prefix=/var/usb/usb_1 --with-features=tiny ... checking --with-tlib argument... empty: automatic terminal library selection checking for tgetent in -lncurses... no checking for tgetent in -ltermlib... no checking for tgetent in -ltermcap... no checking for tgetent in -lcurses... no no terminal library found checking for tgetent()... configure: error: NOT FOUND! You need to install a terminal library; for example ncurses. Or specify the name of the library with --with-tlib.
Seems some terminal library is needed ...
11. The Ncurses (new curses) library
$ cd .. $ wget http://ftp.gnu.org/pub/gnu/ncurses/ncurses-5.6.tar.gz $ tar xvf ncurses-5.6.tar.gz $ cd ncurses-5.6 $ ./configure --build=i686-pc-linux-gnu --host=mipsel-linux --target=mipsel-linux --prefix=/var/usb/usb_1 $ make $ make install
10b. vim
$ cd ../vim71 $ ./configure --build=i686-pc-linux-gnu --host=mipsel-linux --target=mipsel-linux --prefix=/var/usb/usb_1 --with-features=tiny ... checking for tgetent in -lncurses... yes ncurses library is not usable checking for tgetent in -ltermlib... no checking for tgetent in -ltermcap... no checking for tgetent in -lcurses... no no terminal library found checking for tgetent()... configure: error: NOT FOUND! You need to install a terminal library; for example ncurses. Or specify the name of the library with --with-tlib.
seems we have to force it:
$ ./configure --build=i686-pc-linux-gnu --host=mipsel-linux --target=mipsel-linux --prefix=/var/usb/usb_1 --with-features=tiny --with-tlib=ncurses $ make ... Starting make in the src directory. If there are problems, cd to the src directory and run make there cd src && make first make[1]: Entering directory `/home/hajma/Dokumenty/GPL_AM604G_ForRussia/GENERIC_6348_WLAN_A34_3-06-02-01/userapps/opensource/vim71/src' CC="/opt/toolchains/uclibc-crosstools/bin/mipsel-uclibc-gcc -Iproto -DHAVE_CONFIG_H -I/var/usb/usb_1 " srcdir=. sh ./osdef.sh osdef0.c:10:44: termcap.h: No such file or directory ... In file included from term.c:33: /var/usb/usb_1/include/ncurses/termcap.h:64: error: conflicting types for 'tgoto' ...
hmm, I guess I really need to use the CPPFLAGS, shouldn't I modify the
environment file? Perhaps, but now it's too late, it's finished:$ make distclean $ CPPFLAGS="-I/var/usb/usb_1/include/ncurses" ./configure --build=i686-pc-linux-gnu --host=mipsel-linux --target=mipsel-linux --prefix=/var/usb/usb_1 --with-features=tiny --with-tlib=ncurses --disable-gui --disable-gtktest --disable-xim --without-x --disable-multibyte --disable-netbeans --disable-cscope --disable-gpm $ make $ make install ... strip /var/usb/usb_1/bin/vim strip: Unable to recognise the format of the input file `/var/usb/usb_1/bin/vim' make[1]: *** [installvimbin] Error 1 make[1]: Leaving directory `/home/hajma/Dokumenty/GPL_AM604G_ForRussia/GENERIC_6348_WLAN_A34_3-06-02-01/userapps/opensource/vim71/src' make: *** [install] Error 2
No, it's not finished... Let's just hack it:
$ diff -u src/Makefile.old src/Makefile
--- src/Makefile.old 2008-06-17 02:16:32.000000000 +0200
+++ src/Makefile 2008-06-17 02:16:47.000000000 +0200
@@ -999,7 +999,7 @@
INSTALL_DATA_R = cp -r
### Program to run on installed binary
-#STRIP = strip
+STRIP = echo
### Permissions for binaries {{{1
BINMOD = 755
$ make install
I was quite surprised with the size of some files. Performing
/opt/toolchains/uclibc-crosstools/bin/mipsel-linux-sstrip
on bin/ and lib/ helped a bit, but 1MB of vim suggests there's still place for optimizations.Final creation and writing of the squashfs image:
# /home/hajma/Dokumenty/asus/squashfs2.0r2/squashfs-tools/mksquashfs /var/usb/usb_1 /tmp/new.sqsh -be -noI -noD -noF # dd if=/tmp/new.sqsh of=/dev/sda1
In the next part I'll try to correctly configure jabberd and make it start at router boot.
Customizing Asus AM200g - V. firmware modification
Customizing Asus AM200g - IV. jabberd configuration
Customizing Asus AM200g - II. Preparing the environment
Customizing Asus AM200g - I. PREPARATION
Monday, June 2, 2008
Customizing Asus AM200g - II. Preparing the environment
I know I promised you a jabber server, but in the end it was not so easy and the entry would be perhaps too long, so let's start with simple stuff :-)
Note I am not a programmer, have no C skills, so there can be a glitch here and there, but in the end all steps below led me to something that worked. If you find something really nasty, please let me know.
I took most of the inspiration at Daniel Fišer's page on Asus WL-600g hacking and just tweaked it to suit my setup.
1. On a fresh Mandriva 2008.1 installation some of the necessary tools are missing. Install them as root:
2. Since Asus still did not release the sources for AM200g, I used the GPL setup provided for AM604g, which uses the same chipset and seems to be almost identical (it even comes in the same box, except for missing USB port and second antenna). Follow these steps to install it:
3. Not surprisingly, the AM604g source is just as broken as the AM600g one, so the same steps as described by Daniel need to be done:
4. Now you can try to build the firmware, just for fun:
The firmware is created in the
5. To prepare the environment, create a file containing:
and set the environment before doing anything else:
(yes, this is "dot space dot ...")
6. Let's proceed to the helloworld example. Create it's own folder:
and follow the steps described in the automake manual:
Customizing Asus AM200g - V. firmware modification Customizing Asus AM200g - IV. jabberd configuration Customizing Asus AM200g - III. jabberd and vim Customizing Asus AM200g - I. PREPARATION
Note I am not a programmer, have no C skills, so there can be a glitch here and there, but in the end all steps below led me to something that worked. If you find something really nasty, please let me know.
I took most of the inspiration at Daniel Fišer's page on Asus WL-600g hacking and just tweaked it to suit my setup.
1. On a fresh Mandriva 2008.1 installation some of the necessary tools are missing. Install them as root:
# urpmi make gcc autoconf automake
2. Since Asus still did not release the sources for AM200g, I used the GPL setup provided for AM604g, which uses the same chipset and seems to be almost identical (it even comes in the same box, except for missing USB port and second antenna). Follow these steps to install it:
$ wget http://dlsvr02.asus.com/pub/ASUS/Broadband/xDSL/GPL_AM604G_ForRussia.zip $ unzip GPL_AM604G_ForRussia.zip $ cd GPL_AM604G_ForRussia $ tar xvf GENERIC_6348_WLAN_A34_3-06-02-01_GPL.tar.gz $ su # ./consumer_install
3. Not surprisingly, the AM604g source is just as broken as the AM600g one, so the same steps as described by Daniel need to be done:
# cd /opt/toolchains/uclibc-crosstools/bin
# for A in mips-linux-uclibc-* ; do
> ln -s ${A} mipsel-uclibc-${A#mips-linux-uclibc-}
> done
# cd /home/hajma/Documents/GPL_AM604G_ForRussia/GENERIC_6348_WLAN_A34_3-06-02-01
# wget http://daniel.fiser.cz/IT/asus_WL-600g/cur_menu.patch
# patch -p0 <cur_menu.patch
4. Now you can try to build the firmware, just for fun:
# make PROFILE=GENERIC_6348_WLAN_A34
The firmware is created in the
images directory. Since I have no replacement for the router, I'm not going to try it, although it might actually work.5. To prepare the environment, create a file containing:
$ cat environment
TOOLCHAINS_HOME=/opt/toolchains/uclibc-crosstools
export LIBS="-L${TOOLCHAINS_HOME}/lib/gcc/mips-linux/3.4.2"
export INCLUDES="-I${TOOLCHAINS_HOME}/include/c++/3.4.2 \
-I${TOOLCHAINS_HOME}/mips-linux/sys-include \
-I/home/hajma/Documents/GPL_AM604G_ForRussia/GENERIC_6348_WLAN_A34_3-06-02-01/kernel/linux/include"
export CFLAGS="${INCLUDES} ${LIBS} -static"
export LDFLAGS="-static"
export CC="${TOOLCHAINS_HOME}/bin/mipsel-uclibc-gcc"
export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:${TOOLCHAINS_HOME}/lib
export PATH="${PATH}:${TOOLCHAINS_HOME}/bin"
and set the environment before doing anything else:
# . ./environment
(yes, this is "dot space dot ...")
6. Let's proceed to the helloworld example. Create it's own folder:
mkdir /home/hajma/Documents/GPL_AM604G_ForRussia/GENERIC_6348_WLAN_A34_3-06-02-01/userapps/opensource/helloworld
and follow the steps described in the automake manual:
In addition to the manual's instructions, the details of host architecture must be provided when compiling for another platform. Also I set the prefix as the flash drive gets mounted as
Create the following files in an empty directory.
Once you have these five files, it is time to run the Autotools to instantiate the build system. Do this using the
src/main.cis the source file for thehelloprogram. We
store it in thesrc/subdirectory, because later, when the package
evolves, it will ease the addition of aman/directory for man
pages, adata/directory for data files, etc.
~/amhello % cat src/main.c #include <config.h> #include <stdio.h> int main (void) { puts ("Hello World!"); puts ("This is " PACKAGE_STRING "."); return 0; }
READMEcontains some very limited documentation for our little
package.
~/amhello % cat README This is a demonstration package for GNU Automake. Type `info Automake' to read the Automake manual.
Makefile.amandsrc/Makefile.amcontain Automake
instructions for these two directories.
~/amhello % cat src/Makefile.am bin_PROGRAMS = hello hello_SOURCES = main.c ~/amhello % cat Makefile.am SUBDIRS = src dist_doc_DATA = README
- Finally,
configure.accontains Autoconf instructions to
create theconfigurescript.
~/amhello % cat configure.ac AC_INIT([amhello], [1.0], [bug-automake@gnu.org]) AM_INIT_AUTOMAKE([-Wall -Werror foreign]) AC_PROG_CC AC_CONFIG_HEADERS([config.h]) AC_CONFIG_FILES([ Makefile src/Makefile ]) AC_OUTPUT
autoreconfcommand as follows:
~/amhello % autoreconf --install configure.ac: installing `./install-sh' configure.ac: installing `./missing' src/Makefile.am: installing `./depcomp'At this point the build system is complete.
In addition to the three scripts mentioned in its output, you can see thatautoreconfcreated four other files:configure,config.h.in,Makefile.in, andsrc/Makefile.in. The latter three files are templates that will be adapted to the system byconfigureunder the namesconfig.h,Makefile, andsrc/Makefile. Let's do this:
/var/usb/usb_1: # ./configure --build=i686-pc-linux-gnu --host=mipsel-linux --target=mipsel-linux --prefix=/var/usb/usb_1/hello # make # make install7. Optionally you can strip (remove all unnecessary bits) the binary:
# cd /var/usb/usb_1/hello/bin # /opt/toolchains/uclibc-crosstools/bin/mipsel-uclibc-strip -o hellostripped hello8. Copy the files to the flash:
# /home/hajma/Documents/squashfs2.0r2/squashfs-tools/mksquashfs /var/usb/usb_1 /tmp/dir.sqsh -be -noI -noD -noF # dd if=/tmp/dir.sqsh of=/dev/sdb19. Plug the flash drive to the router and verify all runs fine:
$ telnet 192.168.1.1 Trying 192.168.1.1... Connected to 192.168.1.1 (192.168.1.1). Escape character is '^]'. BCM96348 ADSL Router Login: admin Password: > sh BusyBox v1.00 (2005.04.12-18:11+0000) Built-in shell (msh) Enter 'help' for a list of built-in commands. # cd /var/usb/usb_1/hello/bin # ./hello Hello World! This is amhello 1.0. # ./hellostripped Hello World! This is amhello 1.0.Final note: if you get "hello: applet not found" instead, it means you somehow did not compile the program for correct platform and BusyBox was not able to execute it.
Customizing Asus AM200g - V. firmware modification Customizing Asus AM200g - IV. jabberd configuration Customizing Asus AM200g - III. jabberd and vim Customizing Asus AM200g - I. PREPARATION
Tuesday, May 20, 2008
Customizing Asus AM200g - I. PREPARATION
As a fresh ADSL subscriber I became the owner of Asus AM200g ADSL modem/wireless router. The box is quite powerful - it is run by a 256 MHz processor, has 16 MB of RAM and is running Linux, so I'd like to use it for some other useful tasks. Since Asus has not yet released the source code it's not going to be that easy.
I want to touch the original firmware the least possible, so I'm going to add everything to an attached flash drive.
But the firmware only supports vfat and squashfs! Because of vfat filesystem limitations I decided to use a squashfs partition to store program files and a vfat one to store data that need to be modified, let's see how it works out. Note that all is done using Mandriva Linux 2008.1.
# urpmi squashfs-tools $ mksquashfs /tmp/directory /tmp/dir.sqsh Parallel mksquashfs: Using 1 processor Creating little endian 3.1 filesystem on /tmp/dir.sqsh, block size 131072. [==============================================================] 6136/6136 100% Exportable Little endian filesystem, data block size 131072, compressed data, compressed metadata, compressed fragments, duplicates are removed Filesystem size 4586.44 Kbytes (4.48 Mbytes) 8.61% of uncompressed filesystem size (53255.07 Kbytes) Inode table size 53222 bytes (51.97 Kbytes) 23.13% of uncompressed inode table size (230058 bytes) Directory table size 73178 bytes (71.46 Kbytes) 31.71% of uncompressed directory table size (230774 bytes) Number of duplicate files found 3581 Number of inodes 7327 Number of files 6092 Number of fragments 224 Number of symbolic links 0 Number of device nodes 0 Number of fifo nodes 0 Number of socket nodes 0 Number of directories 1235 Number of uids 1 hajma (500) Number of gids 0
Now I wrote the created image to the flash drive's first partition:
# dd if=/tmp/dir.sqsh of=/dev/sdb1
Rather surprisingly, the firmware only supports squashfs v2.0, so after plugging the flash to the router, it shows in the logs
kernel: SQUASHFS error: Major/Minor mismatch, filesystem is (3:1), I support (1 : x) or (2 : <= 0)and in addition squashfs v3 does not support creating v2 images. Oh fsck. So I downloaded squashfs2.0-r2.tar.gz and
# urpmi make # urpmi zlib1-devel $ tar -xvf squashfs2.0-r2.tar.gz # note that tar now automatically gunzips the file too! $ cd squashfs2.0-r2/squashfs-tools/ $ make cc -I. -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -O2 -c -o mksquashfs.o mksquashfs.c mksquashfs.c: In function ‘create_inode’: mksquashfs.c:476: warning: integer constant is too large for ‘long’ type mksquashfs.c:489: error: lvalue required as left operand of assignment mksquashfs.c:541: warning: integer constant is too large for ‘long’ type mksquashfs.c:546: warning: integer constant is too large for ‘long’ type mksquashfs.c:549: error: lvalue required as left operand of assignment mksquashfs.c:568: warning: integer constant is too large for ‘long’ type mksquashfs.c: In function ‘write_file’: mksquashfs.c:1030: warning: integer constant is too large for ‘long’ type mksquashfs.c:1096: warning: integer constant is too large for ‘long’ type mksquashfs.c: In function ‘dir_scan’: mksquashfs.c:1275: warning: integer constant is too large for ‘long’ type mksquashfs.c:1352: warning: integer constant is too large for ‘long’ type make: *** [mksquashfs.o] Error 1 $hmm, okay, the old crap does not want to be compiled with gcc 4 ...
# urpmi gcc3.3 $ CC=gcc-3.3.6 make $ ./mksquashfs /tmp/directory /tmp/dir.sqsh # dd if=/tmp/dir.sqsh of=/dev/sdb1After plugging it into the router,
kernel: SQUASHFS: Mounting a different endian SQUASHFS filesystem on sda1shows up in the logs. Okay, time to try
$ ./mksquashfs /tmp/directory /tmp/dir.sqsh -be # dd if=/tmp/dir.sqsh of=/dev/sdb1and I am getting one error message less! But I still see an ugly
kernel: SQUASHFS error: lzma_fs error while decompressing! kernel: SQUASHFS error: Unable to read cache block [4bea97:7ae] kernel: SQUASHFS error: Unable to read inode [4bea97:7ae] kernel: SQUASHFS error: Root inode create failed" and it does not get mounted.Googling reveals three links that do not help much. But since decompression is mentioned ... let's try to turn off compression ... :
$ ./mksquashfs /tmp/opends/src /tmp/dir.sqsh -be -noI -noD -noF # dd if=/tmp/dir.sqsh of=/dev/sdb1and voila, it gets mounted!
kernel: usb 1-1: new high speed USB device using address 7 kernel: scsi5 : SCSI emulation for USB Mass Storage devices kernel: Vendor: USB 2.0 Model: Flash Disk Rev: 0.00 kernel: Type: Direct-Access ANSI SCSI revision: 02 kernel: SCSI device sda: 2047999 512-byte hdwr sectors (1049 MB) kernel: sda: assuming Write Enabled kernel: sda: assuming drive cache: write through kernel: sda1 sda2 kernel: Attached scsi removable disk sda at scsi5, channel 0, id 0, lun 0 kernel: Attached scsi generic sg0 at scsi5, channel 0, id 0, lun 0, type 0 kernel: USB Mass Storage device found at 7 syslog: mkdir -p /var/usb/usb_1 syslog: mount /dev/sda1 /var/usb/usb_1Next time I'll try to get a jabber server running, time to go sleep now. Customizing Asus AM200g - V. firmware modification Customizing Asus AM200g - IV. jabberd configuration Customizing Asus AM200g - III. jabberd and vim Customizing Asus AM200g - II. Preparing the environment
Monday, August 6, 2007
Tak už i já
Ano, je to tak, už i já si chci koupit notebook. Moje zásadní požadavky jsou váha (pokud možno výrazně) < 2.5 kg, rozlišení >(=) 1024x768, RAM >=512MB, menší rozměry a solidní výdrž na baterky. Nejdřív jsem chtěl koupit z druhý ruky, koneckonců jsem si říkal, že by to byl stejně jenom takovej sekundární stroj v domácnosti.
Moji favoriti na stránkách aukro.cz a eurotech.cz byly notesy Dell Latitude D400, D410, D610 a Prestigio Visconte 1200, 130.
Jenomže nakonec jsem došel k názoru, že se to vůbec nevyplatí. Prostě zaplatit 50 % ceny novýho za stroj bez záruky, s polovičním výkonem a slabší baterkou, to není dobrej kauf. A ceny který nadhazujou obyčejní smrtelníci na annonce.cz či pc.bazar.cz už jsou úplně mimo realitu.
Takže jsem se už skoro rozhodl pořídit Prestigio Visconte 1220, a to buď jako celeron nebo dual core pentium. Za 14 resp 16 000 Kč to nabízí docela dost, i když jsem si vědom, že kvalit IBM nebo Dellu to dosahovat nebude. Trochu mě mrzí absence COM portu a zámku displaye, ale což. Taky DVD prej stojí za houby, ale já pro ni stejně nemám využití. No nechám si to ještě projít hlavou.
Moji favoriti na stránkách aukro.cz a eurotech.cz byly notesy Dell Latitude D400, D410, D610 a Prestigio Visconte 1200, 130.
Jenomže nakonec jsem došel k názoru, že se to vůbec nevyplatí. Prostě zaplatit 50 % ceny novýho za stroj bez záruky, s polovičním výkonem a slabší baterkou, to není dobrej kauf. A ceny který nadhazujou obyčejní smrtelníci na annonce.cz či pc.bazar.cz už jsou úplně mimo realitu.
Takže jsem se už skoro rozhodl pořídit Prestigio Visconte 1220, a to buď jako celeron nebo dual core pentium. Za 14 resp 16 000 Kč to nabízí docela dost, i když jsem si vědom, že kvalit IBM nebo Dellu to dosahovat nebude. Trochu mě mrzí absence COM portu a zámku displaye, ale což. Taky DVD prej stojí za houby, ale já pro ni stejně nemám využití. No nechám si to ještě projít hlavou.
Tuesday, February 6, 2007
renouveau
Už několikrát se ve zprávičkách objevila zmínka o projektu nouveau - open source ovladači grafických karet nvidia s podporou 3D akcelerace. Jednou z možností jak pomoci jeho autorům je použít renouveau - program, který provádí jednoduché opengl testy a sleduje, jak se jejich provádění projevuje ve změnách registrů karty. Před pár dny se mi ho podařilo prosadit do Mandrivy. Uživatelé verze 2007.0 ho najdou v médiu contrib/backports, v cookeru je již přímo v contribu. Jak se s ním pracuje?
Je potřeba mít kartu od nvidie a mít nainstalované jejich proprietární ovladače. Někde si vytvořte adresář a jako normální uživatel v něm spusťte příkaz "renouveau". Objeví se okno, ve kterém několik minut probíhají testy - nepřejíždějte přes něj myší, neposunujte jej, nesmí se spustit spořič obrazovky. Až to skončí, bude adresář plný souborů. Zkomprimujte je a pošlete na renouveau (tečka) dumps (åt) gmail.com
pro přidání contrib/backports napište jako root (na jednom řádku):
urpmi.addmedia contrib_backports ftp://ftp.mandrivauser.cz/Mandrivalinux/official/2007.0/i586/media/contrib/backports with media_info/synthesis.hdlist.cz
Je potřeba mít kartu od nvidie a mít nainstalované jejich proprietární ovladače. Někde si vytvořte adresář a jako normální uživatel v něm spusťte příkaz "renouveau". Objeví se okno, ve kterém několik minut probíhají testy - nepřejíždějte přes něj myší, neposunujte jej, nesmí se spustit spořič obrazovky. Až to skončí, bude adresář plný souborů. Zkomprimujte je a pošlete na renouveau (tečka) dumps (åt) gmail.com
pro přidání contrib/backports napište jako root (na jednom řádku):
urpmi.addmedia contrib_backports ftp://ftp.mandrivauser.cz/Mandrivalinux/official/2007.0/i586/media/contrib/backports with media_info/synthesis.hdlist.cz
Friday, January 5, 2007
mix No. 3
Dva kiksy a jedno pozitivum:
Napsat do /etc/ssh/sshd_config
je kravina:
For instance, if you denied logins to all accounts beginning with the letter "j" (ie. the pattern "j*"), yet had an AllowUsers statement for the user "jim", you might be tempted to think that jim would be accessible because it is the more specific pattern. This is not the case; logins are allowed only if there are no restrictions against the username. In this case, the restriction is against "j*" and thus jim would be denied.
Taky se mi dneska nějak popletly mnemotechnický pomůcky. V
A pozitivní zpráva. Zašel jsem do CZC koupit flasku a byl jsem příjemně překvapen uvedením Linuxu na jejím obalu.
Napsat do /etc/ssh/sshd_config
DenyUsers All AllowUsers hajma
je kravina:
For instance, if you denied logins to all accounts beginning with the letter "j" (ie. the pattern "j*"), yet had an AllowUsers statement for the user "jim", you might be tempted to think that jim would be accessible because it is the more specific pattern. This is not the case; logins are allowed only if there are no restrictions against the username. In this case, the restriction is against "j*" and thus jim would be denied.
Taky se mi dneska nějak popletly mnemotechnický pomůcky. V
/var/log/security jsem si přečetl hlášení msecu o world writable souborech v mém $HOME a rozhodl se s tím něco dělat. Nějak jsem si ale vsugeroval, že pořadí není user, group, others anébrž owner, group, all a z toho odpovídající zkratky oga místo ugo. Takže jsem v $HOME s klidem spustil chmod -R a-w ./ ... a pak jsem se divil, že kmail nechce startovat ...A pozitivní zpráva. Zašel jsem do CZC koupit flasku a byl jsem příjemně překvapen uvedením Linuxu na jejím obalu.
Saturday, June 17, 2006
čištění displeje a dva obrázky z přírody
Můj Alcatel OT 535 je už dva měsíce po záruce, tak jsem si řekl, že se nic nestane, když ho rozeberu. Postupoval jsem podle návodu na mobilmanii a vyčistil jsem display od prachu.

Taknějak jsem doufal, že až ho dám zase dohromady, tak se spraví jedna věc, co mě štve. Asi před tejdnem jsem promazával smsky a asi mi během toho promazávání nějaká zase přišla a telefon se s tím nevyrovnal. Od té doby ukazuje ikonku nepřečtené zprávy furt. Vzhledem k tomu, že po zběžným pohledání na netu jsou všechny návody, manuály atd. za prachy, tak mi asi nezbude, než s ním někam zajít, aby mi ho zresetovali.
Telefon je to jinak relativně dobrej, i když mi přijde dost línej v lezení v menu. 1-2 vteřiny na zobrazení telefonního seznamu mi přijde dost. Hry stojej za houby a další jsou jen za $$. Javu to nemá, jenom nějakej brutálně proprietární systém, kterej není dostupnej ani developerům her. Ti maj k dispozici jenom soft.emulátor. Na druhou stranu přežil pád ze 3 metrů na dlažky. Ale stejně bych si příště radši pořídil nějakej jednoduchej černobílej - volání, sms, budík - nic jinýho s tím stejně nedělám, když nepočítám 2x použití GPRS. Hlavně aby to reagovalo hned a dlouho vydrželo na baterku.
Na ruku mi vlezla Klopuška mravenčí - Myrmecoris gracilis, s ulovenou mšicí.

Na lavičce na hřišti jsem si všiml dřevokazné houby, na netu jsem si dohledal, že se pravděpodobně jedná o kropilku - Dacrymyces minor.


Taknějak jsem doufal, že až ho dám zase dohromady, tak se spraví jedna věc, co mě štve. Asi před tejdnem jsem promazával smsky a asi mi během toho promazávání nějaká zase přišla a telefon se s tím nevyrovnal. Od té doby ukazuje ikonku nepřečtené zprávy furt. Vzhledem k tomu, že po zběžným pohledání na netu jsou všechny návody, manuály atd. za prachy, tak mi asi nezbude, než s ním někam zajít, aby mi ho zresetovali.
Telefon je to jinak relativně dobrej, i když mi přijde dost línej v lezení v menu. 1-2 vteřiny na zobrazení telefonního seznamu mi přijde dost. Hry stojej za houby a další jsou jen za $$. Javu to nemá, jenom nějakej brutálně proprietární systém, kterej není dostupnej ani developerům her. Ti maj k dispozici jenom soft.emulátor. Na druhou stranu přežil pád ze 3 metrů na dlažky. Ale stejně bych si příště radši pořídil nějakej jednoduchej černobílej - volání, sms, budík - nic jinýho s tím stejně nedělám, když nepočítám 2x použití GPRS. Hlavně aby to reagovalo hned a dlouho vydrželo na baterku.
Na ruku mi vlezla Klopuška mravenčí - Myrmecoris gracilis, s ulovenou mšicí.

Na lavičce na hřišti jsem si všiml dřevokazné houby, na netu jsem si dohledal, že se pravděpodobně jedná o kropilku - Dacrymyces minor.

Saturday, June 10, 2006
Cisco Aironet 350 - konektor na externí anténu
Cisco Aironet 350 je velmi solidní pcmcia wi-fi karta se slušnou podporou v linuxu. Jediná její vada je v absenci externího konektoru, což se dá ale poměrně snadno napravit. Pozor, následující zápis obsahuje cca 500 kB obrázků.
Mou výchozí inspirací byl zápisek VK1EME, troufám si ale tvrdit, že můj přístup je elegantnější a v důsledku i praktičtější a hezčí.
Co je potřeba? Pájka (pokud možno nikoliv transformátorová, ačkoliv jednou jsem se zapomněl a přežilo to), cín, pájecí pasta, kleště, lámací nůž, epoxidové lepidlo, samičí konektor RSMA na 3mm kablík (hokej v R/SMA konektorech je pěkně vysvětlen zde) - v prodeji třeba tady, 3 mm wi-fi kablík - stačí pár centimetrů, chemoprén a kolíčky na prádlo.

Z karty je nejprve nutno sloupnout plastovou krytku, jde to snadno, stačí pod ni strčit nůž a zapáčit.

Ta věc vpravo vedle diodek je konektor U.FL. Jeho nevýhodou je, že je drahej, těžko k sehnání a dá se použít max 30x. Možná by bylo vhodnější zrušit ho a napojení externí antény udělat místo něj, ale VK1EME do toho nešel a já jsem nechtěl riskovat; koneckonců funguje to bez problémů.

Lámacím nožem teda vyřízneme plochu, kde budeme operovat. Příště už bych nechal vlevo trochu víc místa, špatně se mi pak lepil kryt zpátky.


Ten zlatej obdélník je samotná vnitřní anténka. Aby bylo možné připojit externí anténu, je nutný ji odříznout od elektroniky karty, mělo by stačit oddělení cca 1mm, ale čím víc, tím líp. Vývody z karty je potřeba ošmirglovat, aby se potom dobře pájely - ale opatrně, aby se odšmirglovanej kov nedostal tam, kam nemá.

Na kablík se konektor přidělá klasicky, zapájí se středový pin,protáhne, přes opletení se přetáhne trubička a zamáčkne kleštěma, aby to bylo placatý.


Druhý konec kablíku hned za konektorem zkrátíme, odizolujeme střed a stínění rozdělíme na dva "copánky", pokud možno v rovině se zmáčknutím konektoru.

Konektor pak (opatrně) připájíme tak, aby byla jeho nejtlustší část v okraji karty. Středový vodič do prostřední cestičky, stínění na kraje.
(Nevím, jestli je to nutný, ale pro jistotu jsem ještě tu původní anténku přelepil izolačkou.)


Nakonec se konektor zaleje ze všech stran epoxidovým lepidlem a nechá zaschnout.

Originální umělohmotný kryt karty je potřeba trochu upravit - vyříznout v místě konektoru, který je přeci jenom trochu tlustší. Pro nalepení nazpátek jsem si pomohl trochou chemoprénu, secvaknul kolíčky na prádlo a nechal zaschnout.
Et voilà, zde je výsledek:

Cisco Aironet 350 is quite good pcmcia wi-fi card well supported in linux. It's only flaw is the absence of external connector, which can be easily resolved.
My initial inspiration was an article by VK1EME,
but I dare to say that my approach is more elegant and in the end more practical and prettier.
What is needed? Soldering iron (not the one using transformer, if possible, although I have forgot about it once and the card survived), solder, flux, pliers, knife, epoxy glue, female RSMA connector for 3mm cable (the chaos in R/SMA connectors is explained in depth here) - sold e.g. here, 3 mm wi-fi cable - just a few centimetres, glue and clothes pegs.

First you need to strip the plastic cover, it goes easily, just stick a knife below it and lever.

The thing next to the diodes is a U.FL connector. It's disadvantage is cost, is difficult to get and one can use it only 30 times. Perhaps it would be be better to remove it and plug the external connector instead of it, but VK1EME didn't and I didn't want to risk; it works ok, so why bother?

Use a knife (the kind that is used for cutting cardboard) to make space for further operation. Next time I would leave more plastic at the left to ease glueing the cover back.


The golden rectangle is the inner antenna. It is necessary to cut off its connection with the inner card electronics, 1mm space should be enough, but the more the better. The leads need to be sand-papered for better soldering, but be careful - the metal dust shouldn't get inside.

Tag the connector on to the cable in the usual way - solder the middle pin, put it through, put the tube around the shielding and press with pliers to make it (a bit) flat.


Cut the other end of the cable right near the connector, strip the insulation and the middle part and divide the shielding into two "plaits", if possible on a level with the connector.

Then (carefully) solder the connector so that its widest part was at in the edge of the card. The middle wire to the middle lead, shielding to the border ones. (Not sure if it's necessary, but to be sure I covered the inner antenna with a tape.)


Then seal the connector on all sides with the epoxy glue and let it dry.

The original plastic cover needs adjustation - cut out where the connector is. Then use some glue, fix it with the pegs and let dry.
Et voilà, here's the result:

Mou výchozí inspirací byl zápisek VK1EME, troufám si ale tvrdit, že můj přístup je elegantnější a v důsledku i praktičtější a hezčí.
Co je potřeba? Pájka (pokud možno nikoliv transformátorová, ačkoliv jednou jsem se zapomněl a přežilo to), cín, pájecí pasta, kleště, lámací nůž, epoxidové lepidlo, samičí konektor RSMA na 3mm kablík (hokej v R/SMA konektorech je pěkně vysvětlen zde) - v prodeji třeba tady, 3 mm wi-fi kablík - stačí pár centimetrů, chemoprén a kolíčky na prádlo.
Z karty je nejprve nutno sloupnout plastovou krytku, jde to snadno, stačí pod ni strčit nůž a zapáčit.

Ta věc vpravo vedle diodek je konektor U.FL. Jeho nevýhodou je, že je drahej, těžko k sehnání a dá se použít max 30x. Možná by bylo vhodnější zrušit ho a napojení externí antény udělat místo něj, ale VK1EME do toho nešel a já jsem nechtěl riskovat; koneckonců funguje to bez problémů.
Lámacím nožem teda vyřízneme plochu, kde budeme operovat. Příště už bych nechal vlevo trochu víc místa, špatně se mi pak lepil kryt zpátky.
Ten zlatej obdélník je samotná vnitřní anténka. Aby bylo možné připojit externí anténu, je nutný ji odříznout od elektroniky karty, mělo by stačit oddělení cca 1mm, ale čím víc, tím líp. Vývody z karty je potřeba ošmirglovat, aby se potom dobře pájely - ale opatrně, aby se odšmirglovanej kov nedostal tam, kam nemá.
Na kablík se konektor přidělá klasicky, zapájí se středový pin,protáhne, přes opletení se přetáhne trubička a zamáčkne kleštěma, aby to bylo placatý.
Druhý konec kablíku hned za konektorem zkrátíme, odizolujeme střed a stínění rozdělíme na dva "copánky", pokud možno v rovině se zmáčknutím konektoru.
Konektor pak (opatrně) připájíme tak, aby byla jeho nejtlustší část v okraji karty. Středový vodič do prostřední cestičky, stínění na kraje.
(Nevím, jestli je to nutný, ale pro jistotu jsem ještě tu původní anténku přelepil izolačkou.)

Nakonec se konektor zaleje ze všech stran epoxidovým lepidlem a nechá zaschnout.
Originální umělohmotný kryt karty je potřeba trochu upravit - vyříznout v místě konektoru, který je přeci jenom trochu tlustší. Pro nalepení nazpátek jsem si pomohl trochou chemoprénu, secvaknul kolíčky na prádlo a nechal zaschnout.
Et voilà, zde je výsledek:
Cisco Aironet 350 - connector for external antenna
Cisco Aironet 350 is quite good pcmcia wi-fi card well supported in linux. It's only flaw is the absence of external connector, which can be easily resolved.
My initial inspiration was an article by VK1EME,
but I dare to say that my approach is more elegant and in the end more practical and prettier.
What is needed? Soldering iron (not the one using transformer, if possible, although I have forgot about it once and the card survived), solder, flux, pliers, knife, epoxy glue, female RSMA connector for 3mm cable (the chaos in R/SMA connectors is explained in depth here) - sold e.g. here, 3 mm wi-fi cable - just a few centimetres, glue and clothes pegs.
First you need to strip the plastic cover, it goes easily, just stick a knife below it and lever.

The thing next to the diodes is a U.FL connector. It's disadvantage is cost, is difficult to get and one can use it only 30 times. Perhaps it would be be better to remove it and plug the external connector instead of it, but VK1EME didn't and I didn't want to risk; it works ok, so why bother?
Use a knife (the kind that is used for cutting cardboard) to make space for further operation. Next time I would leave more plastic at the left to ease glueing the cover back.
The golden rectangle is the inner antenna. It is necessary to cut off its connection with the inner card electronics, 1mm space should be enough, but the more the better. The leads need to be sand-papered for better soldering, but be careful - the metal dust shouldn't get inside.
Tag the connector on to the cable in the usual way - solder the middle pin, put it through, put the tube around the shielding and press with pliers to make it (a bit) flat.
Cut the other end of the cable right near the connector, strip the insulation and the middle part and divide the shielding into two "plaits", if possible on a level with the connector.
Then (carefully) solder the connector so that its widest part was at in the edge of the card. The middle wire to the middle lead, shielding to the border ones. (Not sure if it's necessary, but to be sure I covered the inner antenna with a tape.)

Then seal the connector on all sides with the epoxy glue and let it dry.
The original plastic cover needs adjustation - cut out where the connector is. Then use some glue, fix it with the pegs and let dry.
Et voilà, here's the result:
Monday, April 3, 2006
1280 x 1024
Tohle asi není vhodná otázka do fóra, proto to píšu do blogu:
Proč je jako další logický krok v rozlišeních 800*600, 1024*768 nabízeno 1280*1024 a ne 1280*960? (Např. lilo, X ...) Vždyť, kurník, poměr stran mého monitoru je pořád 4:3!
Proč je jako další logický krok v rozlišeních 800*600, 1024*768 nabízeno 1280*1024 a ne 1280*960? (Např. lilo, X ...) Vždyť, kurník, poměr stran mého monitoru je pořád 4:3!
Saturday, November 26, 2005
Debugování komunikace s klávesnicí
Momentálně si hraju s vylepšováním svojí klávesnice, akorát mi to moc nejde. Už jsem strávil tejdny různým zkoušením (no, nemám na hraní celý dny, proto tolik), až jsem uznal, že je nutný vědět, co se mezi klávesnicí a PC vlastně děje, protože podle teorie to prostě nefungovalo.
Takže jsem vyštrachal obvod MAX232, 5 kondenzátorů a napojil klávesnici na sériový port.


Šmírovací program jsem obšlehl od sitha. V C totiž vůbec neumím a připadá mi jako totálně nepohodlný a nepřehledný jazyk, takže - vím, že je to napsaný prasácky, ale je to jednoúčelová věc a stačí mi:
Prostě to vypisuje dvě hodnoty oddělený čárkou, první je stav CLOCK a druhý je stav DATA. Protože PS/2 jede jen na 9600 baudů, stíhá se to krásně:
Update:
A když se to nacpe do OpenOffice, tak se to dá krásně zvizualizovat:

English summary: Spying on the PS/2 keyboard protocol using serial port.
Takže jsem vyštrachal obvod MAX232, 5 kondenzátorů a napojil klávesnici na sériový port.


Šmírovací program jsem obšlehl od sitha. V C totiž vůbec neumím a připadá mi jako totálně nepohodlný a nepřehledný jazyk, takže - vím, že je to napsaný prasácky, ale je to jednoúčelová věc a stačí mi:
#include <stdio.h>
#include <fcntl.h>
#include <termios.h>
#include <sys/ioctl.h>
#include <time.h>
#define SERIAK "/dev/ttyS0"
int openserial ();
void closeserial ();
float mereni ();
int fd;
int
openserial () //otevrit seriak
{
if ((fd = open (SERIAK, O_RDWR)) == -1)
{
return 0;
}
return 1;
}
void
closeserial () //zavrit seriak
{
close (fd);
}
float
mereni () //hlavni fce, mereni napeti
{
int status, hodnota1 = 2, hodnota2 = 3;
while (1!=2)
{
ioctl (fd, TIOCMGET, &status);
hodnota1 = (status & TIOCM_CTS)/TIOCM_CTS; //clock
hodnota2 = (status & TIOCM_RI)/TIOCM_RI; //data
printf ("%i,", hodnota1);
printf ("%i\n", hodnota2);
}
// return (hodnota1);
}
int
main ()
{
if (!openserial ())
{
printf ("Nelze inicializovat port \"s\".", SERIAK);
return 0;
}
mereni();
closeserial ();
return 0;
}
Prostě to vypisuje dvě hodnoty oddělený čárkou, první je stav CLOCK a druhý je stav DATA. Protože PS/2 jede jen na 9600 baudů, stíhá se to krásně:
... 1,0 1,0 1,0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0,0 0,1 0,1 0,1 ...
Update:
A když se to nacpe do OpenOffice, tak se to dá krásně zvizualizovat:

English summary: Spying on the PS/2 keyboard protocol using serial port.
Tuesday, November 1, 2005
Abych pořád jenom nekritizoval
Dnešní zápisek je taková pochvala...
Takže tady je moje páječka.

Mám ji už 20 let (ne že bych byl takovej stařec, prostě ji mám odmala) a pořád funguje perfektně. Akorát někdy před 10 lety jsem měnil žárovku. Samozřejmě na pájení některých věcí použít nejde, ale do ruky ji beru celkem často.
Takže tady je moje páječka.

Mám ji už 20 let (ne že bych byl takovej stařec, prostě ji mám odmala) a pořád funguje perfektně. Akorát někdy před 10 lety jsem měnil žárovku. Samozřejmě na pájení některých věcí použít nejde, ale do ruky ji beru celkem často.
Sunday, September 25, 2005
Palírna
Rozhodl jsem se koupit si DVD vypalovačku, hlavně kvůli těm GB fotek a filmů (z digitálu), který seděj na disku a čekaj na Generála Failure. Nejdřív jsem se rozhodl pro
NEC 5340A
, ale článek na root.cz mě přesvědčil, abych utratil o pár kaček víc za podporu DVD-RAM. Mým novým favoritem se stala
LG 4163B
, s celkem dobrou
recenzí
na cdr.cz. Rád si ale vždycky přečtu názory opravdových lidí, jenže - je skutečně v lidských silách přečíst
1178 příspěvků
? Přeloženo do lidštiny, co je to za hovada, která z diskuze k recenzovanému výrobku dělají poradnu? To neexistuje něco jako abcwindows.cz? Oh my god...
NEC 5340A
, ale článek na root.cz mě přesvědčil, abych utratil o pár kaček víc za podporu DVD-RAM. Mým novým favoritem se stala
LG 4163B
, s celkem dobrou
recenzí
na cdr.cz. Rád si ale vždycky přečtu názory opravdových lidí, jenže - je skutečně v lidských silách přečíst
1178 příspěvků
? Přeloženo do lidštiny, co je to za hovada, která z diskuze k recenzovanému výrobku dělají poradnu? To neexistuje něco jako abcwindows.cz? Oh my god...
Subscribe to:
Posts (Atom)








