about summary refs log tree commit diff stats
path: root/dev/c/src/linux
diff options
context:
space:
mode:
Diffstat (limited to 'dev/c/src/linux')
-rw-r--r--dev/c/src/linux/Makefile13
-rw-r--r--dev/c/src/linux/init.c8
-rw-r--r--dev/c/src/linux/rungdb.sh12
3 files changed, 33 insertions, 0 deletions
diff --git a/dev/c/src/linux/Makefile b/dev/c/src/linux/Makefile
new file mode 100644
index 0000000..e026551
--- /dev/null
+++ b/dev/c/src/linux/Makefile
@@ -0,0 +1,13 @@
+CC=gcc
+CFLAGS=-Wall -static
+#LDFLAGS=-lc -lnss_files -lnss_dns -lresolv
+
+all: init ramdisk
+
+init: init.c
+
+ramdisk:
+	find . | cpio -o -H newc | gzip > rootfs.cpio.gz
+
+clean:
+	rm -f *.o init rootfs.cpio.gz
diff --git a/dev/c/src/linux/init.c b/dev/c/src/linux/init.c
new file mode 100644
index 0000000..10af0be
--- /dev/null
+++ b/dev/c/src/linux/init.c
@@ -0,0 +1,8 @@
+#include <stdio.h>
+#include <unistd.h>
+
+int main() {
+    printf("FOOBAR FOOBAR FOOBAR FOOBAR FOOBAR FOOBAR FOOBAR\n");
+    sleep(0xFFFFFFFF);
+    return 0;
+}
diff --git a/dev/c/src/linux/rungdb.sh b/dev/c/src/linux/rungdb.sh
new file mode 100644
index 0000000..9408d7f
--- /dev/null
+++ b/dev/c/src/linux/rungdb.sh
@@ -0,0 +1,12 @@
+#!/bin/bash
+
+gdb \
+    -ex "add-auto-load-safe-path $(pwd)" \
+    -ex "file vmlinux" \
+    -ex 'set arch i386:x86-64:intel' \
+    -ex 'target remote localhost:1234' \
+    -ex 'hbreak start_kernel' \
+    -ex 'continue' \
+    -ex 'disconnect' \
+    -ex 'set arch i386:x86-64' \
+    -ex 'target remote localhost:1234'