Skip to content

Expanded the basic-porting.mdx file so it includes a tutorial on porting external libraries#552

Draft
StefanAMN wants to merge 1 commit intounikraft:mainfrom
StefanAMN:stancustefan/expand-basic-porting.mdx
Draft

Expanded the basic-porting.mdx file so it includes a tutorial on porting external libraries#552
StefanAMN wants to merge 1 commit intounikraft:mainfrom
StefanAMN:stancustefan/expand-basic-porting.mdx

Conversation

@StefanAMN
Copy link
Copy Markdown

I added a new part in the basic-porting.mdx file that includes a small guide on importing external libraries, which comes mainly from the hackathons/sessions/contributing-to-unikraft folder in an old commit, couples with some other ideas from some sessions from USoC23. This expands on the basic-porting.mdx file and integrates lessons from USoC23 regarding external C library porting.

…ing external libraries

Signed-off-by: Stefan Stancu <stefanstancu2006@gmail.com>
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR expands the existing “basic porting” guide to cover porting external C libraries alongside a simple application example, incorporating lessons from earlier Unikraft sessions.

Changes:

  • Updates the guide title/description to include library porting.
  • Reflows and extends the existing echo/pwd porting tutorial text.
  • Adds a new section describing external library porting concepts plus a kdtree practical exercise.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +213 to +220
Examining a Ported Library: libhogweed

Let's examine core components of an existing port, such as lib-libhogweed.
Glue Code

Sometimes, an external library's requirements are not fully present in Unikraft. The solution is to add "glue code" manually to the library's sources. Glue code is also useful when a library includes test modules; you can wrap them into a single function that Unikraft can invoke.
Configuration: Config.uk

`-- unikraft/
```

Examining a Ported Library: libhogweed
Comment on lines +253 to +255
$(call verbose_cmd,CONFIG,libhogweed: $(notdir $@), \
cd $(LIBHOGWEED_EXTRACTED) && ./configure --enable-mini-gmp \
)

```makefile
LIBKDTREE_BASE = $(UK_LIBS)/libkdtree
LIBKDTREE_EXTRACTED = $(LIBKDTREE_BUILD)/origin
Comment on lines +31 to 33
```shell
$ ls workdir/libs/musl
abort.c Makefile.rules Makefile.uk.musl.errno Makefile.uk.musl.locale ......
@razvand razvand self-assigned this May 2, 2026
@razvand razvand self-requested a review May 2, 2026 13:46
Copy link
Copy Markdown
Contributor

@razvand razvand left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See the linter checks. In particular, use a single sentence on a line.

Do not add the library porting in the basic-porting.mdx guide. Create a new guide called library-porting.mdx. We will end up with three porting guides: basic-porting.mdx, library-porting.mdx and advanced-porting.mdx.

Add a commit body to your commit.

Prefix the commit title with feat(guides):.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants