aboutsummaryrefslogtreecommitdiffstats
path: root/dev
diff options
context:
space:
mode:
Diffstat (limited to 'dev')
-rw-r--r--dev/c/index.html90
-rw-r--r--dev/index.html2
-rw-r--r--dev/php/index.html23
3 files changed, 110 insertions, 5 deletions
diff --git a/dev/c/index.html b/dev/c/index.html
index 09374c6..684c7d2 100644
--- a/dev/c/index.html
+++ b/dev/c/index.html
@@ -7,6 +7,92 @@
<body>
<a href="../index.html">Development Index</a>
+ <h1>System Development</h1>
+
+ <p>System development requires debug kernel know how,
+ in this example will be used qemu and gdb. A simple init
+ program is created. Create init.S;</p>
+
+ <pre>
+ .global _start
+ _start:
+ mov $1, %rax
+ mov $1, %rdi
+ mov $message, %rsi
+ mov $message_len, %rdx
+ syscall
+ jmp .
+ message: .ascii "FOOBAR FOOBAR FOOBAR FOOBAR FOOBAR FOOBAR FOOBAR\n"
+ .equ message_len, . - message
+ </pre>
+
+ <p>Assemble, link and create simple initial ram disk;</p>
+
+ <pre>
+ mkdir d
+ as --64 -o init.o init.S # assemble
+ ld -o d/init init.o # link
+ cd d
+ find . | cpio -o -H newc | gzip > ../rootfs.cpio.gz
+ </pre>
+
+ <p>Clean temporary directory;</p>
+
+ <pre>
+ cd ..
+ rm -r d/
+ </pre>
+
+ <p>Can be used C to create init program;</p>
+
+ <pre>
+ #include &lt;stdio.h&gt;
+ #include &lt;unistd.h&gt;
+
+ int main() {
+ printf("FOOBAR FOOBAR FOOBAR FOOBAR FOOBAR FOOBAR FOOBAR\n");
+ sleep(0xFFFFFFFF);
+ return 0;
+ }
+ </pre>
+
+ <pre>
+ $ gcc -static init.c -o init
+ </pre>
+
+ <p>Test qemu, kernel and simple init program, you should see
+ "FOOBAR FOOBAR FOOBAR FOOBAR FOOBAR FOOBAR FOOBAR";</p>
+
+ <pre>
+ $ qemu-system-x86_64 -enable-kvm --kernel arch/x86_64/boot/bzImage \
+ --initrd rootfs.cpio.gz
+ </pre>
+
+ <p>If everything goes well you can start qemu without start CPU at
+ startup (-S) and with gdb server on TCP port 1234 (-s).</p>
+
+ <pre>
+ $ qemu-system-x86_64 -enable-kvm --kernel arch/x86/boot/bzImage \
+ --initrd rootfs.cpio.gz \
+ -S -s
+ </pre>
+
+ <p>On another terminal start gdb;</p>
+
+ <pre>
+ gdb \
+ -ex "add-auto-load-safe-path $(pwd)" \
+ -ex "file vmlinux" \
+ -ex 'set arch i386:x86-64:intel' \
+ -ex 'target remote localhost:1234' \
+ -ex 'break start_kernel' \
+ -ex 'continue' \
+ -ex 'disconnect' \
+ -ex 'set arch i386:x86-64' \
+ -ex 'target remote localhost:1234'
+ </pre>
+
+
<h1>C &amp; GDB</h1>
<p><a href="http://blog.fourthbit.com/2013/06/18/creating-an-open-source-program-in-c-with-autotools-part-1-of-2/">C program with autotools</a>
@@ -74,7 +160,7 @@
thread 1
</pre>
- <p><a href=" http://ftp.gnu.org/old-gnu/Manuals/gdb/html_node/gdb_39.html#SEC40">Stopping and Starting</a>
+ <p><a href="http://ftp.gnu.org/old-gnu/Manuals/gdb/html_node/gdb_39.html#SEC40">Stopping and Starting</a>
multi-thread programs</p>
<pre>
@@ -86,8 +172,6 @@
<pre>
strace -c ./program
</pre>
-
-
<a href="../index.html">Development Index</a>
<p>
This is part of the c9-doc Manual.
diff --git a/dev/index.html b/dev/index.html
index befe5d6..cb238d7 100644
--- a/dev/index.html
+++ b/dev/index.html
@@ -119,7 +119,7 @@
<a href="../index.html">Documentation Index</a>
<p>
This is part of the c9-doc Manual.
- Copyright (C) 2016
+ Copyright (C) 2017
c9 team.
See the file <a href="../fdl-1.3-standalone.html">Gnu Free Documentation License</a>
for copying conditions.</p>
diff --git a/dev/php/index.html b/dev/php/index.html
index 2a44270..a4549f1 100644
--- a/dev/php/index.html
+++ b/dev/php/index.html
@@ -9,10 +9,31 @@
<h1>c9 PHP</h1>
+
+ <h2>Hello World</h2>
+
+ <p>PHP comes with a built in server that helps to speed up
+ developing by not having to configure a system web server,
+ first create file index.php;</p>
+
+ <pre>
+ &lt;?php
+ echo "Hello World";
+ </pre>
+
+ <p>Now run the server;</p>
+
+ <pre>
+ $ php -S localhost:8000
+ </pre>
+
+ <p>Open your browser and browse http://localhost:8000,
+ you should see "Hello World".</p>
+
<a href="../index.html">Development Index</a>
<p>
This is part of the c9-doc Manual.
- Copyright (C) 2016
+ Copyright (C) 2017
c9 team.
See the file <a href="../../fdl-1.3-standalone.html">Gnu Free Documentation License</a>
for copying conditions.</p>