Affichage des articles dont le libellé est diy. Afficher tous les articles
Affichage des articles dont le libellé est diy. Afficher tous les articles

samedi 18 mai 2013

Crossing streams : How I swamped my ThinkPad X60s keyboard

I splought (when you choke to avoid coughing but end up spiting twice more with a now open mouth) on my keyboard. Some of it got under the keys. Fortunately I have spare parts, especially keyboards (touchtypist/IBM keyboard feel fetish) so I swap to let this one dry. After a little bit of tissue and a few minutes I plug it back, and I witness something for the first time : a keyboard bug. Pairs of adjacent keys are now influencing each others lines, typing 's' echo 'sa'. '1' echo '21'. 'tab' echo 'tab[invisible caps lock]' which means now it's FREE LISP STYLE. Before I toss it to the garbage I try remove the key support tryptic. It's a set of 3 fragile and tiny plastic parts: a bottom frame, and two crossing hooks forming a X supporting a little rectangle pushing over a latex cushion. I don't know what degree you need to do that, it's all so tiny and weak yet when plugged together its stable and sturdy. Plus it's very very easy to unmount/remount. At least when you figured it out. Anyway, it's amazing, and now that they're all off the keyboard plane, I can spill a little bit of isopropylic alcohol in the hope that it will improve things. It's unbelievably dirty here, full of 0.1mm breadcrumbs, and also lots of cat hair stuck in every possible way...
Time to plug it back for good, just after a quick keyless test (the key are just providing pressure for the board layers to connect, so your finger will do just fine) showing everything got back to order. Reassembling the 10~ keys and their X support is quite fun. And here I am typing this.















reassembly step 1 : pre slide

reassembly step 2 - half slide

reassembly step 3 - pre second half

reassembly step 4 - base seated

step 5 - cross up insertion

step 6 - up insertion done, bottom resting

step 7 - push bottom legs in their plug~

step 8 - legs done








locking claws~ to be clipped on top of Cross

mardi 10 avril 2012

LFS Success. Retrospective.

You have successfully registered!
ID: 23340
Name: agumonkey
First LFS Version: 20120409
© 1998-2012 Gerard Beekmans. Website design by Jeremy Huntwork & Matthew Burgess.
Finally I boot a LFS system.

I don't remember, it might be my 5th attempt ? development branch no less.
Never could go further than new system gcc/glibc.
Couldn't put my mind into solving.. too much noise. Weak mental.

Wasn't a walk in the park this time, what went wrong. Or what I should call
'The Overlook List' :

- choose a host
  last attempt was on a usb key 1Go for debian live, 6Go for the new lfs
  Failed early, stayed that way.
  last attempt started bad, I didn't pay attention and used lfslivecd which was obsolete.
  => realize that no special os needed, just a right set of tools
  now I thought to reuse the usb key and debian .. but I didn't want to boot another system.
  => realize that no special os needed, I run Kubuntu .. it's actually enough even for the latest SVN branch.

- headfirst style
  Created a local lfs user. Used $HOME/lfs as target for $LFS.
  I went through the book simply. This time not writing commands, I now understand sed enough
  so I can just copy/paste, and avoid time-wasting typos.
  By the time I reach the chapter 7 I wonder how I'm gonna boot this local folder.
  So I skip the beat, erase the usb key 2nd partition. cp -R $HOME/lfs /media/usb
  and try to finish there.

- lfs-bootscript, wrong sudo : host corrupted
  In a hurry I try to trick make to install bootscripts using DESTDIR variable.
  Except, I think, that sudo doesn't inherit the environment, thus letting make
  do its job using the host /.
  Luckily, Kubuntu init.d wasn't too corrupted, network setup takes 2 minutes
  now but it still boots. At first I thought I was good for a full setup.

- can't compile kernel (predefs.h not found)
  Not caring much about Kubuntu, I reach the kernel compilation step.
  To my surprise I made something wrong. Someone in the toolchain complains about
  about 'predefs.h' and 'bits.h' not being found. Seems related to kernel headers.
  Problem : too complex, Brain : too weak.

- redo & build an env
  Frustrated by the bare naked, information overload, and fragility. I try to improve a bit
  the process. I recreate the lfs user, add a .bash.d with :
  - extract function
  - lfs specific variable setup
  - a little login message to remind me of what variables are set or not.
  Nothing fancy at all, but it's already easier.
  I also time and log everything:
  `time make $cmd 2>&1 | tee $logs/$chapter/$(basename $(pwd))-$cmd.log` ; echo ">>> $?"

  I can leverage history key bindings almost blindly. Almost.

- grub road bump
  Things are smooth, no more `sudo` havoc, kernel compiles. I'm anxious about the
  grub process but anyway.
  Grub stops, saying he can't do shit, but even grub1 is nice enough to let you poke
  around live. The usb key is hd0, so I prepend the vmlinuz path with (hd0,2).
  F10 to run. 'Decompressing Kernel...' followed by kernel panic.

- IRC saves the day again
  Can't count how much knowledge I got on IRC channels.
  @Ratrophy tell me to add rootdelay=n[seconds] to avoid mounting before the usb key is
  fully setup.
  Works fine, now the kernel only panics, but for a totally different reason.

- FS drivers !
  It's been a long time since I've compiled a kernel, the menu organisation changed a bit.
  I didn't see EXT4 because it's written Extended Fileblahblahblah-long-wording Version 4.
  Okay, since I kept linux source in their compiled state, I can rebuild it quick with ext4 module.
  ...
  Seems that it needs to be builtin. Oh yeah there's no initrd .. I don't understand it all but
  someone has to have ext4 builtin.
  Now it .. panics. Saying /dev/sda can't be mounted. My kernel parameters mention /dev/sdb
  so Y U NO bOOT ?!?

- fstab ...
  Ah I copied the fstab from the book taking a bet on the device name, thinking the usb key would
  get sda since I boot on it. Wrong. Let's go vimcorrect that.
  Now I reach init ! and then I see a horrifying error message talking about forced halt.

- Stubbornness => single mode peeping.
  So :
  - the bootloader is fine
  - the kernel is fine
  - the filesystem is fine
  - the userspace is fine ( as in, program runs when chrooted in the host )

  This can't be serious. I poke in grub, making the FS rw.. No progress.
  Some setups drop the kernel into a shell. I wish I could.. I can only try single user mode.
  Rewrite grub.cfg `linux (hd0,2)/boot/vmlinuz-xxx root=/dev/sdb2 ro single init=/bin/bash`
  Boot, and here it is, the glorious shell. First time I type in that state.
  Can't do shit since the FS is ro, but I understand that only 10 minutes later.

- devtmpfs investigation
  I try running the bootscripts by hand, line by line.
  `mount -t -o procfs none /proc`
  Now ps works ... nice but not what I want.
  I mount everything until I realize /dev is quite empty. What is udev waiting for ??
  `mount -t devtmpfs .. /dev` => error, unknown fs type devtmpfs. WAT
  What is devtmpfs anyway ? isn't it devfs ?
  Then my eyes catch the huge NOTE saying not to forget to activate 'devtmpfs' ...
  Okay, reboot Kubuntu, recompile (the whole) kernel.

- Register
  Yep it boots, grub >= kernel >= init >= login.
  60MB used, 38 for cache. Not bad Linus.

- BLFS ? Not so fast
  - the network is not setup right
  - I got a static IP
  - no route to my internet gateway
  - there's no ssh, no wget. only ftp is on the system

- Ending notes
   Even though I've had a lot of criticizing in my head about LFS, it's a wonderful tutorial.
   Thanks a lot to their team.

lundi 2 avril 2012

nano-hack : wrt54g v2 plus ddwrt plus ssh


$ ps
PID USER       VSZ STAT COMMAND
    1 root      1464 S    /sbin/init noinitrd 
    2 root         0 SW   [keventd]
    3 root         0 SWN  [ksoftirqd_CPU0]
    4 root         0 SW   [kswapd]
    5 root         0 SW   [bdflush]
    6 root         0 SW   [kupdated]
    9 root         0 SW   [mtdblockd]
   13 root      1500 S    watchdog 
   91 root      1460 S    resetbutton 
  141 root      1100 S    telnetd 
  160 root       808 S    dnsmasq --conf-file=/tmp/dnsmasq.conf 
  164 root      1456 S    wland 
  168 root       692 S    udhcpc -i vlan1 -p /var/run/udhcpc.pid -s /tmp/udhcpc
  172 root       692 S    cron 
  179 root      1424 S    ttraff 
  200 root      2140 S    httpd -p 80 
  381 root      1536 S    dropbear -b /tmp/loginprompt -r /tmp/root/.ssh/ssh_ho
  419 root      1456 S    process_monitor 
  572 root      1104 S    sh -c alias ping='ping -c 3'; eval "ps" > /tmp/ping.l
  573 root      1104 R    ps 
  574 root      1104 S    sh -c /sbin/ledtool 1 
  575 root      1104 R    sh -c /sbin/ledtool 1


$ uname -a
Linux DD-WRT 2.4.35 #3392 Mon Nov 2 13:19:34 CET 2009 mips unknown

That, is the output of commands using ddwrt on a wrt54g v2.

Finally tried to upgrade this old device. It uses 192.168.1.1 which collides with my actual internet gateway so I had to think (far too long) to connect to the wrt54g without stopping the gateway. Stopping my laptop's wifi and using ethernet wire between both gave me a functionning network, ping 192.168.1.1 was responding. 
I forgot that I set up https on the linksys webadmin. After uploading an almost random firmware found on ddwrt page I saw a 'upload success' but something failed. Rebooting it twice didn't bring the webadmin page back (http nor https). I could ping to the box so I tried to upload another firmware using tftp. First to attempts failed, the third printed a message saying it was cleaning nvram flash then exited. The process was a bit too quick to feel right. I consider resetting using the back button, hoping to reinitiate an upload, then I saw a webpage .. but it was ddwrt webadmin. Somehow it works now, so I fiddled with it, enabled ssh. And that's about it, what's next ?

- Adding usb ports. Nice if you use the device as a server
- Better antennas
- Heatsink
- More recent software. ddwrt last firmware uses linux 2.4 and busybox. Running 3.3 kernel and such might be fun, for the sake of it.

ps: A+ on the hackability of this thing. The case has no screw, just stiff surface bumps that hold the board into a two part case. Really nice.