Cursor control characters in a bash script

To control the cursor’s position with a plain bash “echo” command, use the fact that the $’something‘ pseudo-variable interprets that something more or less like a C escape sequence. So the ESC character, having ASCII code 0x1b, can be generated with $’0x1b’. $’\e’ is also OK, by the way. There are plenty of sources for [...]

Using Linux’ setpci to program an EEPROM attached to an PLX / Avago PCIe switch

Introduction These are my notes as I programmed an Atmel AT25128 EEPROM, attached to a PEX 8606 PCIe switch, using PCIe configuration-space writes only (that is, no I2C / SMBus cable). This is frankly quite redundant, as Avago supplies software tools for doing this. In fact, in order to get their tools, register at Avago’s [...]

Moving a Windows 7-installed hard disk to a new computer

This has been documented elsewhere, but it’s important enough to have a note about here. In short, before switching to a new hardware, it’s essential to prepare it, or an 0x0000007b blue screen will occur on the new hardware. The trick is to run sysprep.exe (under windows\system32\sysprep\) before the transition. Have “Generalize” checked, and choose [...]

Linux kernel hack for calming down a flood of PCIe AER messages

While working on a project involving a custom PCIe interface, Linux’ message log became flooded with messages like pcieport 0000:00:1c.6: device [8086:a116] error status/mask=00001081/00002000 pcieport 0000:00:1c.6: [ 0] Receiver Error pcieport 0000:00:1c.6: [ 7] Bad DLLP pcieport 0000:00:1c.6: [12] Replay Timer Timeout pcieport 0000:00:1c.6: Error of this Agent(00e6) is reported first pcieport 0000:02:00.0: PCIe Bus [...]

syslogd notes

A few jots on playing with the system logger (the one that writes to /var/log/messages) on an ancient CentOS 5.5. First, check the version: It says Oct 6 15:12:06 diskless syslogd 1.4.1: restart. So it’s a quite old revision of syslogd, unfortunately. There are no filter conditions to rely on. The relevant configuration file is [...]

Hexdump notes

General notes For plain byte-per-byte hex dump, $ hexdump -C To dump a limited number of bytes, use the -n flag: $ hexdump -C -n 64 /dev/urandom 00000000  9c 72 b0 43 da 6e 27 2f  f9 f1 34 06 60 d5 71 ad  |.r.C.n’/..4.`.q.| 00000010  cc 07 89 02 f7 f9 5f 85  f6 [...]

Linux kernel compilation jots

General These are a few random notes to self regarding kernel compilation. The preferred vanilla kernel rep to use is Linux Stable: $ git clone https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/ It’s often a good idea to pick a kernel version that was released a while ago, but with a high sub-subversion number. So it has been tested properly and [...]