| 1 | = User Serial Console = |
| 2 | |
| 3 | In order to use a serial console for the command line UI, a couple of conditions have to be met: |
| 4 | |
| 5 | * HelenOS must support passing boot arguments to the kernel on the given platform |
| 6 | * HelenOS must have a userspace driver for the serial console device |
| 7 | * the user needs to pass the exact location service path to the serial console device in the `console` argument |
| 8 | |
| 9 | Currently, these requirements are satisfied on ia32, amd64 and sparc64/sun4u. |
| 10 | |
| 11 | == ia32 and amd64 == |
| 12 | |
| 13 | Assuming your serial console device is at `devices/\hw\pci0\00:01.0\com1\a` (this is the case in QEMU), modify your grub.cfg to contain the following: |
| 14 | |
| 15 | {{{ |
| 16 | multiboot /boot/kernel.bin console=devices/\\hw\\pci0\\00:01.0\\com1\\a |
| 17 | }}} |
| 18 | |
| 19 | Note that the backslashes must be escaped on the GRUB command line. If you are modifying boot/Makefile.grub, make sure to escape the backslashes properly: |
| 20 | |
| 21 | {{{ |
| 22 | === modified file 'boot/Makefile.grub' |
| 23 | --- boot/Makefile.grub 2016-04-05 19:04:11 +0000 |
| 24 | +++ boot/Makefile.grub 2017-05-06 13:38:00 +0000 |
| 25 | @@ -85,7 +85,7 @@ |
| 26 | for module in $(MODULES) ; do \ |
| 27 | echo " echo 'Loading $$module'" >> $(BOOT_CONFIG) ; \ |
| 28 | if [ "$$module" = "kernel.bin" ] ; then \ |
| 29 | - echo " $(MULTIBOOT_CMD) /boot/$$module" >> $(BOOT_CONFIG) ; \ |
| 30 | + echo " $(MULTIBOOT_CMD) /boot/$$module console=devices/\\\\hw\\\\pci0\\\\00:01.0\\\\com1\\\\a" >> $(BOOT_CONFIG) ; \ |
| 31 | else \ |
| 32 | echo " $(MODULE_CMD) /boot/$$module /boot/$$module" >> $(BOOT_CONFIG) ; \ |
| 33 | fi \ |
| 34 | |
| 35 | }}} |
| 36 | |
| 37 | Upon boot, the `console` service should start using the serial console for its input/output. We can run HelenOS using the `tools/ew.py` in QEMU: |
| 38 | |
| 39 | {{{ |
| 40 | $ xterm -e `tools/ew.py -d` -serial stdio |
| 41 | }}} |
| 42 | |
| 43 | or if we want a complete headless run, we do: |
| 44 | |
| 45 | {{{ |
| 46 | xterm -e `tools/ew.py -d` -nographic |
| 47 | }}} |
| 48 | |
| 49 | == sparc64/sun4u == |
| 50 | |
| 51 | Serial console on sun4u is known to be working only under QEMU and is fully integrated into `tools\ew.py`: |
| 52 | |
| 53 | {{{ |
| 54 | bash-4.3$ tools/ew.py -d |
| 55 | xterm -T "HelenOS/sparc64 on generic" -e qemu-system-sparc64 -M sun4u --prom-env boot-args="console=devices/\hw\pci0\00:03.0\com1\a" -drive file=hdisk.img,index=0,media=disk,format=raw -device e1000,vlan=0 -net user,hostfwd=udp::8080-:8080,hostfwd=udp::8081-:8081,hostfwd=tcp::8080-:8080,hostfwd=tcp::8081-:8081,hostfwd=tcp::2223-:2223 -usb -boot d -cdrom image.iso -nographic |
| 56 | }}} |
| 57 | |