Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add p7zip #80

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions nasm/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Netwide Assembler

This is the netwide assembler and it is meant to be used in the binary compatibility mode of unikraft.

## Content
- sample_code.s: a sample assembly code file that can be assembled using nasm.
- usr/bin/nasm: the nasm binary
- lib/ & lib64/: the required libraries for nasm

## Extract dynamic libraries
```../extract.sh usr/bin/nasm```

output:
```
Copying /lib/x86_64-linux-gnu/libc.so.6 ...
Copying /lib64/ld-linux-x86-64.so.2 ...
```

## Run on linux
```nasm sample_code.s```

## Run on unikraft
```./run.sh -r ../dynamic-apps/nasm/ usr/bin/nasm sample_code.s```

This should generate the output file ```sample_code``` which is the assembled machine code generated by nasm.
Binary file added nasm/lib/x86_64-linux-gnu/libc.so.6
Binary file not shown.
Binary file added nasm/lib64/ld-linux-x86-64.so.2
Binary file not shown.
31 changes: 31 additions & 0 deletions nasm/sample_code.s
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
BITS 64

xor rax, rax
test rdi, rdi
jz end

loop:
cmp byte [rdi], 0
jz end

xor rbx, rbx
mov bl, byte [rdi]
cmp bl, 0x5a
ja loop_end

push rax
push rdi
mov rdi, rbx
mov rax, 0x403000
call rax
pop rdi
mov byte [rdi], al
pop rax
inc rax

loop_end:
inc rdi
jmp loop

end:
ret
Binary file added nasm/usr/bin/nasm
Binary file not shown.
Binary file added p7zip/7z
Binary file not shown.
Binary file added p7zip/7z.so
Binary file not shown.
Binary file added p7zip/7zCon.sfx
Binary file not shown.
Binary file added p7zip/7za
Binary file not shown.
Binary file added p7zip/7zr
Binary file not shown.
49 changes: 49 additions & 0 deletions p7zip/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
# p7zip

This is the p7zip compression utility that can be used with Unikraft bincompat mode.

## Content

- `lib/` & `lib64/`: required libs for p7zip
- `/7z`: the 7z main binary
- `7z.so`, `7za`, `7zCon.sfx`, `7zr`: different code modules for p7zip that will be used by 7z binary to perform different operations.

## Extracting Dynamic Libraries

Copy link
Member

Choose a reason for hiding this comment

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

Add wording here.

```console
../extract.sh ./7z
```

## Running on Linux

This will create a new archive called `archive.zip` and add the file `README.md` to it.
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
This will create a new archive called `archive.zip` and add the file `README.md` to it.
Create a new archive called `archive.zip` and add the file `README.md` to it:


```console
7z a archive.zip README.md
```

This will extract the archive:
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
This will extract the archive:
Extract the archive created above:


```console
7z x archive.zip
```

## Running on Unikraft

Copy link
Member

Choose a reason for hiding this comment

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

Add a line on using the run.sh script from the run-app-elfloader repository (see an example here).

This will create a new archive called `archive.zip` and add the file `README.md` to it.
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
This will create a new archive called `archive.zip` and add the file `README.md` to it.
Create a new archive called `archive.zip` and add the file `README.md` to it:


```console
./run.sh -r ../dynamic-apps/p7zip /7z a archive.zip README.md
```

Copy link
Member

Choose a reason for hiding this comment

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

Give an output sample of the command above.

This will extract an archive file called `archive.zip`.
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
This will extract an archive file called `archive.zip`.
Extract an archive file called `archive.zip`.


```console
./run.sh -r ../dynamic-apps/p7zip /7z x archive.zip
```

Copy link
Member

Choose a reason for hiding this comment

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

Give an output sample of the command above.

We can use this command to check that everything worked properly:
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
We can use this command to check that everything worked properly:
To check that everything worked properly, use:


```console
7z l archive.zip
```
Binary file added p7zip/archive.zip
Binary file not shown.
Binary file added p7zip/lib/x86_64-linux-gnu/libc.so.6
Binary file not shown.
Binary file added p7zip/lib/x86_64-linux-gnu/libdl.so.2
Binary file not shown.
Binary file added p7zip/lib/x86_64-linux-gnu/libgcc_s.so.1
Binary file not shown.
Binary file added p7zip/lib/x86_64-linux-gnu/libm.so.6
Binary file not shown.
Binary file added p7zip/lib/x86_64-linux-gnu/libpthread.so.0
Binary file not shown.
Binary file added p7zip/lib/x86_64-linux-gnu/libstdc++.so.6
Binary file not shown.
Binary file added p7zip/lib64/ld-linux-x86-64.so.2
Binary file not shown.