-
Notifications
You must be signed in to change notification settings - Fork 8
Add support for User Mode Linux #59
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
Merged
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
c51a603
buildroot: Upgrade to 2022.02
nathanchance 8603a5c
images: Update
nathanchance 80e9a83
buildroot: Build an ext4 image for x86_64
nathanchance bd4b962
boot-utils: Add boot-uml.sh
nathanchance 9d37a7b
boot-uml.sh: Add link to issue for 'exec' workaround
nathanchance 2a315cc
utils.sh: Make get_full_kernel_path() more robust with UML
nathanchance File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,42 @@ | ||
| #!/usr/bin/env bash | ||
|
|
||
| BASE=$(dirname "$(readlink -f "$0")") | ||
| source "$BASE"/utils.sh | ||
|
|
||
| function parse_parameters() { | ||
| while (($#)); do | ||
| case $1 in | ||
| -i | --interactive | --shell) | ||
| kernel_args=(init=/bin/sh) | ||
| ;; | ||
| -k | --kernel-location) | ||
| shift | ||
| KERNEL_LOCATION=$1 | ||
| ;; | ||
| esac | ||
| shift | ||
| done | ||
| } | ||
|
|
||
| function reality_check() { | ||
| [[ -z $KERNEL_LOCATION ]] && die "Kernel image or kernel build folder ('-k') is required but not specified!" | ||
| KIMAGE=linux get_full_kernel_path | ||
| } | ||
|
|
||
| function decomp_rootfs() { | ||
| rootfs=$BASE/images/x86_64/rootfs.ext4 | ||
| rm -rf "$rootfs" | ||
| zstd -q -d "$rootfs".zst -o "$rootfs" | ||
| } | ||
|
|
||
| function execute_kernel() { | ||
| # exec is needed to avoid a "Killed" message when the kernel shuts down: | ||
| # https://github.com/ClangBuiltLinux/boot-utils/issues/60 | ||
| # Nothing runs after this command so it is okay for it to replace this process. | ||
| exec "$KERNEL" ubd0="$rootfs" "${kernel_args[@]}" | ||
| } | ||
|
|
||
| parse_parameters "$@" | ||
| reality_check | ||
| decomp_rootfs | ||
| execute_kernel |
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| 9aaaa1317ca1082ccdabe3f2566bba06975080a80256adf87f860bc4c3f45a9b buildroot-2022.02.tar.gz |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,2 +1,3 @@ | ||
| debian.img | ||
| rootfs.cpio | ||
| rootfs.ext4 |
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,42 @@ | ||
| #!/usr/bin/env bash | ||
|
|
||
| function pretty_print() { | ||
| printf "%b%s\033[0m" "${1}" "${2}" | ||
| shift 2 | ||
| while ((${#})); do | ||
| printf "%b" "${1}" | ||
| shift | ||
| done | ||
| printf '\n' | ||
| } | ||
|
|
||
| function green() { | ||
| pretty_print "\033[01;32m" "${@}" | ||
| } | ||
|
|
||
| function red() { | ||
| pretty_print "\033[01;31m" "${@}" | ||
| } | ||
|
|
||
| # Prints an error message in bold red then exits | ||
| function die() { | ||
| red "${@}" | ||
| exit 1 | ||
| } | ||
|
|
||
| # Expands '-k' to an absolute path to a kernel image if necessary | ||
| function get_full_kernel_path() { | ||
| # If '-k' is a file, we can just use it directly | ||
| if [[ -f ${KERNEL_LOCATION} ]]; then | ||
| KERNEL=${KERNEL_LOCATION} | ||
| # If not, we need to find it based on the kernel build directory | ||
| else | ||
| # If the image is an uncompressed vmlinux or a UML image, it is in the | ||
| # root of the build folder | ||
| # Otherwise, it is in the architecture's boot directory | ||
| [[ -z ${KIMAGE} ]] && KIMAGE=zImage | ||
| [[ ${KIMAGE} == "vmlinux" || ${KIMAGE} == "linux" ]] || BOOT_DIR=arch/${ARCH}/boot/ | ||
| KERNEL=${KERNEL_LOCATION}/${BOOT_DIR}${KIMAGE} | ||
| fi | ||
| [[ -f ${KERNEL} ]] || die "${KERNEL} does not exist!" | ||
| } |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.