I’ve already written a time or two how you can use git rebase to change your commit history as you work. Handy handy.. I think everyone should know how to do that.
Next up.. what if you pushed a commit and realize it’s not so great. First of all, everyone discourages this of course. The encouraged way is to just make another commit that fixes what you want different. We all want to break that rule every now and then though. Here’s how…
Continue reading “How to fix that mistake commit you just pushed to your git repository”
Well, have you ever wanted to pull a bunch of libraries off an Android phone? I bet you wish you could execute the command like this:
> adb pull /system/lib/*.so
Sorry. A no go. What about this then:
> for file in `adb ls /system/lib/`; do adb pull /system/lib/$file; done
Well, almost, but adb ls attaches the \n\r to the files. That wouldn’t be a problem if adb pull didn’t attach them to the names, so you have to get rid of the white space. This can work:
> for file in `adb ls /system/lib`; do adb pull `echo /system/lib/$file | tr -d '\n\r'`; done
I thought I’d better double check that the image upload still works fine with YUI 2.8.1 If you haven’t read the original YUI Image Uploader page, start there. After that, you can use this page for an example getting the script to work with the latest YUI.
Continue reading “YUI Image Uploader works with YUI 2.8.1”
I found a few different pages with information on debugging a Linux kernel with kgdb. There wasn’t a single source with all the information I needed to get set up and working though. So here is how I set things up on my Linux host machine to debug a target Linux kernel running in a VirtualBox VM.
Set up the virtual machine
When setting up the VM, add a serial port and set it to use Host Pipe. You can check the box to have VirtualBox create the pipe too. Give a path to the file on the host where you want the pipe. This will become the virtual serial console that gdb connects to on the host machine.
Install VirtualBox with a VM containing the kernel you want to debug. Build the kernel with debug symbols, kgdb support, sysrq keys
[*] Magic SysRq Key
[*] Kernel debugging
[*] Compile the kernel with debug info
[*] KGDB: kernel debugging with remote gdb ->
[*] KGDB: use kgdb over the serial console
Build your kernel and install the modules like you would any other kernel.
Add kgdboc=ttyS0,115200 to the kernel paremeters (ttyS[0-3] depending on which COM port you choose in the VM setup.)
Copy the vmlinux (uncompressed version to the host machine).
Also copy the .ko for the module you want to debug.
Get the target VM ready for debugging
After your module is inserted, you need its .text address so that you can see the source lines in gdb.
When you’re ready to start a debug session:
echo g > /proc/sysrq-trigger
Ready the Host to connect to the VM
You need to convert the pipe that VirtualBox created to a serial port like object. socat does that job:
> socat -d -d /path/to/pipe pty &
2010/04/29 12:18:44 socat N successfully connected from local address AF=1 "\0\0\0\0\0\0\0\0\0\x02\0\0\0\0[\0\0\0|\0\0\0w"
2010/04/29 12:18:44 socat N successfully connected via C\xE66
2010/04/29 12:18:44 socat N PTY is /dev/pts/3
2010/04/29 12:18:44 socat N starting data transfer loop with FDs [3,3] and [4,4]
Notice that your dev is pts/3.
Now we make a .gdbinit file so you can start gdb without typing the commands every time.
set remotebaud 115200
target remote /dev/pts/3
You’ll change your pts setting to whatever is relevant.
On the target, when you send the g to sysrq-trigger, you should drop to a breakpoint in gdb.
Next job is to load the module symbols.
> add-symbol-file <.text address>
> b some_file.c:NNN
Now you can set breakpoints or press c to continue. The target should continue until it comes to a breakpoint or encounters an error.
A last tidbit, when I wanted to close gdb on the host, use detach instead of quit.
Tom from mostynwebsolutions.com has created an ASP YUI Image Uploader backend. Direct Download: YuiExample.zip.
The YUI Image Upload posts on this site contain details on implementing the front end and editor if you’re just getting into this.
Do you like gitk? I find it almost invaluable in merging, branching, looking at old revisions, diffs, etc. I find it annoying that git log is hard to glean the same information. I searched a round a bit and found that git log is quite configurable as to what it outputs. Here is a simple alias that outputs the log with some of the data you’d find by viewing gitk.
git config alias.logk 'log --graph --pretty=format:"%h %ae: %s" --decorate --abbrev-commit'
You can add –global so you don’t have to make a logk alias for every repository.
You can also read the man page for “git log” and change the format to suite your liking.