FDOS / kernel

FreeDOS kernel - implements the core MS-DOS/PC-DOS (R) compatible operating system. It is derived from Pat Villani's DOS-C kernel and released under the GPL v2 or later. Please see http://www.freedos.org/ for more details about the FreeDOS (TM) Project.
http://kernel.fdos.org/
GNU General Public License v2.0
817 stars 143 forks source link

Depack utility for UPX-compressed FreeDOS kernel #75

Open ecm-pushbx opened 2 years ago

ecm-pushbx commented 2 years ago

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.

ecm-pushbx commented 2 years ago

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