====== Piotr JaroszyƄski: Usermode debugging under Linux ====== ===== Previous work [ Prior to 24 May 2010 ] ===== ==== Unrelated work ==== Before I even started thinking about a proposal for my project I decided to do some pretty much random unrelated work to get a better feeling of gPXE in general. This resulted in a few trivial patches: *[[http://git.etherboot.org/?p=gpxe.git;a=commitdiff;h=46d6ec7d77a041d8266d0d9811f57ba92e86599e|[build] Add support for local configuration files]] *[[http://git.etherboot.org/?p=gpxe.git;a=commitdiff;h=9feb7b38a5d38fd1dcf431b8ff2139d5d7afd90f|[build] Look for isolinux.bin in more places]] *[[http://git.etherboot.org/?p=gpxe.git;a=commitdiff;h=70537cbe3504b90f3b524cec1bb3867b04514c37|[util] Hide an expected error from the 'which' command]] And then I decided to tackle something involving proper coding - adding base64 support to iSCSI. This resulted in not yet merged changes: *[[http://git.etherboot.org/?p=people/peper/gpxe.git;a=shortlog;h=refs/heads/base64|base64 branch]] ==== Related work ==== Even after doing some work on gPXE earlier I didn't know where to start the project I wanted to work on during summer. Josh helped me a lot with that. Firstly I tried an efi build to see how the different ''ARCH''s and ''PLATFORM''s work. Unfortunately that resulted in some compilation as well as linking problems. I have managed to fix them: *[[http://git.etherboot.org/?p=people/peper/gpxe.git;a=shortlog;h=refs/heads/efi64|efi64 branch]] With that behind me, I added a new ''linux'' ''PLATFORM'', which involved the following: * Remapping stdlib's symbols to avoid collisions with gPXE (see [[..:notes/implementation_details#kernel_interface|Kernel Interface]]) * Adding linker scripts (for ''i386'' and ''x86_64'') just to handle tables (see ''include/gpxe/tables.h'') * Adding an empty ''linuxprefix'' Having that base I implemented the very first linux subsytem: ''CONSOLE_LINUX'', which got usermode gPXE as far as: $ bin-x86_64-linux/rtl8139.linux gPXE initialising devices... Segmentation fault That work can be seen on [[http://git.etherboot.org/?p=people/peper/gpxe.git;a=shortlog;h=refs/heads/linux|linux branch]] (up to the "[linux] Add console" commit). After that I decided to add a network driver based on tun/tap and all the subsystems necessary for that: * ''TIMER_LINUX'' * ''UACCESS_LINUX'' * ''UMALLOC_LINUX'' * ''NAP_LINUX'' It's in an ugly state, but seems to be working: $ ./bin-x86_64-linux/virtual.linux gPXE initialising devices... gPXE 1.0.0+ -- Open Source Boot Firmware -- http://etherboot.org Features: HTTP DNS TFTP net0: 52:54:00:12:34:56 on (open) [Link:up, TX:0 TXE:0 RX:0 RXE:0] DHCP (net0 52:54:00:12:34:56).... ok net0: 192.168.1.201/255.255.255.0 gw 192.168.1.1 Booting from filename "http://boot.kernel.org/bko/pxelinux.0" http://boot.kernel.org/bko/pxelinux.0. Not an executable image (0x2e008001) Could not boot from filename "http://boot.kernel.org/bko/pxelinux.0": Not an executable image (0x2e008001) No more network devices The changes can be seen currently on the [[http://git.etherboot.org/?p=people/peper/gpxe.git;a=shortlog;h=refs/heads/linux-ugly|linux-ugly branch]] with just one monolithic commit. During that work usermode gPXE helped me track down and fix two bugs: *[[http://git.etherboot.org/?p=gpxe.git;a=commitdiff;h=019327eca42c76e1135154c4d002859d84edc5c0|[uri] Fix NULL dereference in parse_uri()]] *[[http://git.etherboot.org/?p=gpxe.git;a=commitdiff;h=79d9b2861545837ef92f259326c78ef12f8d2e3f|[uri] Special case NULL in churi()]]