ref: ce815eb209fa12fd3e0b67adc745170483ecc5d1
parent: 7b48acc5257406f5cecd8d50a050419dba933c4a
author: cinap_lenrek <cinap_lenrek@felloff.net>
date: Sun Feb 23 15:14:52 EST 2025
aux/aout2uimage: add a flag to override ostype (lie about not being plan9) uboot can be so broken, that it becomes necessary to masquerade as a linux kernel for anything to work, so add a flag where the ostype can be set.
--- a/sys/src/cmd/aux/aout2uimage.c
+++ b/sys/src/cmd/aux/aout2uimage.c
@@ -7,6 +7,7 @@
int infd, outfd;
ulong dcrc;
ulong *tab;
+ulong lie = 23; /* plan9 */
uchar buf[65536];
enum {
@@ -67,7 +68,7 @@
void
usage(void)
{
- fprint(2, "usage: %s a.out\n", argv0);
+ fprint(2, "usage: %s [-o outfile] [-Z kzero] [-l ostype] a.out\n", argv0);
exits("usage");
}
@@ -109,6 +110,7 @@
ofile = nil;
ARGBEGIN {
case 'Z': kzero = strtoull(EARGF(usage()), 0, 0); break;
+ case 'l': lie = strtoul(EARGF(usage()), 0, 0); break;
case 'o': ofile = strdup(EARGF(usage())); break;
default: usage();
} ARGEND;
@@ -152,7 +154,7 @@
put(&header[16], fhdr.txtaddr - kzero); /* load address */
put(&header[20], fhdr.entry - kzero); /* entry point */
put(&header[24], dcrc); /* data crc */
- header[28] = 23; /* os = plan 9 */
+ header[28] = lie;
header[29] = arch;
header[30] = 2; /* type = kernel */
header[31] = 0; /* compressed = no */
--
⑨