Second run: qemu+gdb

In you ubuntu (not inside docker), you may see something like this:
~/Downloads/pcs3746-sistemas-operacionais/1/docker$ ls
default_cmd1.sh  default_cmd1.sh~  default_cmd.sh*  default_cmd.sh.1*  Dockerfile  Dockerfile.1  entrypoint.sh*  initramfs/  linux/  src/

Open the Dockerfile. At the end you see:
CMD ["/default_cmd.sh"]
It means that after the docker will run default_cmd at last.
Let us see this default_cmd:
Basically it compiles what has to be compiled about the ARM linux kernel and boots it by qemu.
The last line is:
qemu-system-arm -M versatilepb -m 128M -nographic -kernel $BOOT/zImage -dtb $BOOT/dts/versatile-pb.dtb -initrd build/rootfs.gz -append "root=/dev/ram" 
This last line makes qemu runs alone, with no gdb.
To make it stops and waits for the gdb connection, you do add -s and -S at the end of the line to make a connection via socket at port 1234 and to Stop waiting for the connection:
qemu-system-arm -M versatilepb -m 128M -nographic -kernel $BOOT/zImage -dtb $BOOT/dts/versatile-pb.dtb -initrd build/rootfs.gz -append "root=/dev/ram" -s -S
This is your first modification; just edit default_cmd.sh to make it happen!
Rebuild the docker image and run it again:
~/Downloads/pcs3746-sistemas-operacionais/1/docker$ docker build -t tiagoshibata/pcs3746 . 
~/Downloads/pcs3746-sistemas-operacionais/1$./run.sh
Observe that it is running differently: no more messages scrolling at the terminal because qemu is waiting for a gdb connection.
We need to:

  • open a terminal to this docker container
  • run gdb on this terminal.

Let us see how, in the next post.



Comentários

Postagens mais visitadas deste blog

Basics on ARM processor

Assignments - 1

2. run gdb