FDOS/kernel

Depack utility for UPX-compressed FreeDOS kernel

ecm-pushbx opened this issue · 1 comments

Having worked some on the kernel's exeflat I took on the challenge of undoing the compression that it orchestrates along with UPX. Here's the resulting program: https://hg.pushbx.org/ecm/fddepack/file/85a255f5048a/depack.c

As you can see it is a very basic program. It calls upx -d using a system call in C, the error handling is rudimentary, and it needs the output filename to end in .exe. Further, it only supports the MZ .EXE compression format for now. The resulting output file can be re-used as input to exeflat to recreate a bootable kernel (with or without UPX compression).

I checked with a kernel 2042 that I had around, the kernel 2036 from dosemu-freedos-1.0-bin.tgz, and the current git (with my exeflat update).

I think that the depacker might come in handy to appease the UPX usage conditions. If not under the GPL (which would require redistributing the corresponding source of UPX with any compressed kernel) they want us to not modify their depacker stub (what we technically do not do, just prepend our stub stub) and to allow anyone to depack compressed files. Even with this depacker we don't follow these requirements to the letter, but in spirit perhaps.

Updated to support the new format, both DOS/EXE and DOS/SYS compression formats: https://hg.pushbx.org/ecm/fddepack/file/e7c21dc601da/depack.c