Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
W
wendelin.core
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Joshua
wendelin.core
Commits
ea15cec7
Commit
ea15cec7
authored
Feb 11, 2019
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
848b5f51
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
27 additions
and
6 deletions
+27
-6
t/qemu-runlinux
t/qemu-runlinux
+27
-6
No files found.
t/qemu-runlinux
View file @
ea15cec7
#!/bin/sh -e
# qemu-runlinux <kernel> <program> ...
# qemu-runlinux
[options]
<kernel> <program> ...
# run kernel in QEMU with root fs taken from host
#
# Useful to test/debug just compiled kernel via running programs
...
...
@@ -7,7 +7,6 @@
# pid=1: we are running inside booted kernel as init.
# mount /sys /proc etc and tail to the program.
qshutdown
()
{
echo
1
>
/proc/sys/kernel/sysrq
echo
o
>
/proc/sysrq-trigger
# shutdown
...
...
@@ -58,12 +57,33 @@ if [ $$ == 1 ]; then
qdie
"unreachable"
fi
# ----------------------------------------
die
()
{
echo
"
$*
"
1>&2
exit
1
}
nographic
=
y
while
test
$#
!=
0
do
case
"
$1
"
in
-g
)
nographic
=
;;
*
)
break
;;
esac
shift
done
kernel
=
$1
arch
=
`
uname
-m
`
test
-z
"
$kernel
"
&&
kernel
=
arch
/
$arch
/boot/bzImage
test
-n
"
$kernel
"
||
die
"kernel not specified"
shift
prog
=
"
$@
"
test
-n
"
$prog
"
||
die
"program not specified"
dir
=
`
pwd
`
...
...
@@ -85,9 +105,10 @@ dir=`pwd`
# References
# http://unix.stackexchange.com/questions/90423/can-virtfs-9p-be-used-as-root-file-system
# http://stackoverflow.com/questions/11408041/kernel-debugging-with-gdb-and-qemu
arch
=
`
uname
-m
`
qemu-system-
$arch
\
-enable-kvm
\
-nographic
\
${
nographic
:+-nographic
}
\
\
-m
512M
`
# default 128M is too limiting` \
\
...
...
@@ -96,7 +117,7 @@ qemu-system-$arch \
\
-kernel
$kernel
\
-append
"ro rootfstype=9p rootflags=trans=virtio
\
console=ttyS0
init="
$(
realpath
$0
)
"
\
${
nographic
:+console
=ttyS0
}
init="
$(
realpath
$0
)
"
\
CWD="
$dir
" HOME="
$HOME
" LANG="
$LANG
" TERM="
$TERM
" PATH="
$PATH
"
\
--
$prog
\
"
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment