bare-metal-gophers

Demo code and slides for my GolangUK '17 talk: "Bare Metal Gophers: Can you write a kernel in Go?"

  • 所有者: achilleasa/bare-metal-gophers
  • 平台:
  • 许可证:
  • 分类:
  • 主题:
  • 喜欢:
    0
      比较:

Github星跟踪图

Bare Metal Gophers

This repository contains the demo code for the GolangUK2017 talk
"Bare Metal Gophers: Can you write a kernel in Go?".

The slides for the talk are available here.

Requirements

The project Makefile contains targets for building a bootable ISO containing
the compiled code. Virtualbox or qemu
can be used to boot the generated ISO (make run-qemu or make run-vbox). A
debugging target is also provided (make gdb) that boots the ISO using qemu
and then spawns an interactive gdb session.

The code was developed using Go 1.8. However, you should be able to compile it
with any Go version that supports native cross-compilation.

Building on Linux

To compile the demo code when running on Linux you need a fairly recent version of:

  • xorriso
  • grub
  • nasm
  • gcc (for GNU ld)
  • go (1.6+; recommended: 1.8)
  • gdb (optional; only install if you want to debug the demo code)

The above dependencies can be installed using the appropriate package manager
for each particular Linux distribution.

Building on OSX

To properly link the kernel object files so that the bootloader can pick up the
multi-boot signature we need to be able to control the linker configuration. For
the time being this is only possible when using GNU ld (lld
is a potential alternative but doesn't yet fully support linker scripts).

You can still build the kernel using vagrant. For
this purpose, a Vagrantfile is provided so all you need to do is just install
vagrant on your machine and run vagrant up before running any of the following
make commands.

To debug the demo code, you need to install gdb. If using
brew you can do this by running brew install gdb --with-all-targets. This is an optional step and is not required for running
the demo code.

Supported make targets

The provided Makefile will work on both Linux and OSX (using vagrant) targets.
When running under OSX, the Makefile will ensure that all build-related
commands actually run inside the vagrant box. The following targets are
supported:

  • run-vbox: compile the code, build an ISO file and run it using virtualbox.
  • run-qemu: compile the code, build an ISO file and run it using qemu.
  • gdb: compile the code, build an ISO file, run it using qemu and start a gdb session.
  • iso: compile the code and build a bootable ISO using grub as the bootloader.
  • kernel: compile the code into an elf binary.

How does it look?

If you are curious what the demo looks like but do not want to actually build
and run it, here is a screen capture of it running under virtualbox:

running under virtualbox

主要指标

概览
名称与所有者achilleasa/bare-metal-gophers
主编程语言Go
编程语言Makefile (语言数: 3)
平台
许可证
所有者活动
创建于2017-08-13 08:49:32
推送于2024-04-28 13:39:34
最后一次提交2021-07-16 18:28:47
发布数0
用户参与
星数159
关注者数6
派生数17
提交数10
已启用问题?
问题数1
打开的问题数0
拉请求数1
打开的拉请求数2
关闭的拉请求数0
项目设置
已启用Wiki?
已存档?
是复刻?
已锁定?
是镜像?
是私有?