Skip to content

Commit

Permalink
Merge pull request #47 from alexandrasandulescu/2-uart
Browse files Browse the repository at this point in the history
Assignment setup for 2-uart
  • Loading branch information
dbaluta authored Mar 29, 2018
2 parents c663f33 + acb165f commit 8c79310
Show file tree
Hide file tree
Showing 7 changed files with 722 additions and 1 deletion.
16 changes: 15 additions & 1 deletion tools/labs/qemu/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,13 @@ YOCTO_IMAGE=core-image-minimal-qemu$(ARCH).ext4
QEMU_OPTS = -kernel $(ZIMAGE) \
-device virtio-serial \
-chardev pty,id=virtiocon0 -device virtconsole,chardev=virtiocon0 \
-serial pipe:pipe1 -serial pipe:pipe2 \
-net nic,model=virtio,vlan=0 -net tap,ifname=tap0,vlan=0,script=no,downscript=no \
-drive file=$(YOCTO_IMAGE),if=virtio,format=raw \
--append "root=/dev/vda console=hvc0" \
--display $(QEMU_DISPLAY) -s

boot: .modinst tap0
boot: .modinst tap0 pipe1.in pipe1.out pipe2.in pipe2.out
ARCH=$(ARCH) qemu/qemu.sh $(QEMU_OPTS)

TEMPDIR := $(shell mktemp -u)
Expand Down Expand Up @@ -54,6 +55,19 @@ $(YOCTO_IMAGE):
tap0:
qemu/create_net.sh $@

pipe1.in:
mkfifo $@

pipe1.out:
mkfifo $@

pipe2.in: pipe1.out
ln $< $@

pipe2.out: pipe1.in
ln $< $@


clean::
rm -f .modinst

Expand Down
14 changes: 14 additions & 0 deletions tools/labs/templates/assignments/2-uart/checker/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
CFLAGS = -Wall -g -static -m32

.PHONY: all run clean

all: test solution.ko

test: _test/test.o
$(CC) $(CFLAGS) -o $@ $^

solution.ko: _test/solution.ko
ln -s $< $@

clean:
-rm -f *~ test _test/test.o solution.ko
39 changes: 39 additions & 0 deletions tools/labs/templates/assignments/2-uart/checker/README
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
= UART16550 TEST SUITE ==

Test suite for UART16550

== FILES ==

README
* this file

Makefile.checker
* Makefile for automating the build process

_checker
* script to run all tests defined in _test/test.c

_test/test.c
* test suite for UART16550

_test/solution.ko
* kernel module implementing UART16550,
used to transmit/receive data to/from your kernel module

== BUILDING ==

Use the Makefile to properly build the test executable:

make -f Makefile.checker

== RUNNING ==

Copy your uart16550.ko module and _checker, test and solution.ko
to fsimg/root directory on your QEMU/KVM virtual machine.

In order to run the test suite you can use the _checker script.

The _checker script runs all tests and computes assignment grade:

./_checker

4 changes: 4 additions & 0 deletions tools/labs/templates/assignments/2-uart/checker/_checker
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/sh

insmod uart16550.ko; cat /proc/modules > /dev/kmsg; rmmod uart16550
./test
Loading

0 comments on commit 8c79310

Please sign in to comment.