Reference https://bellard.org/jslinux/tech.html
Used asm.js EMScripten put Tinyemu with JS, Tinyemu supports x86 and streamline instructions
https://bellard.org/tinyemu/tinyemu-2018-09-23.tar.gz
Install / usr / local / bin / temu
Regenerate intent
Https://bellard.org/tinyemu/diskimage-linux-riscv-2018-09-23.tar.gz
Temu root-riscv64.cfg
Successful operation
Cat root-riscv64.cfg
/ * VM Configuration File * / {Version: 1, Machine: “RISCV64”, Memory_Size: 128, BIOS: “BBL64.BIN”, KERNEL: “kernel-riscv64.bin”, cmdline: “console = HVC0 root = / dev / VDA RW “, Drive0: {File:” root-riscv64.bin “}, eth0: {driver:” tap “, ifname:” tap0 “},}
Control a x is exit
If you want to run x86
First use QEMU test: x86
Need to prepare a 2.6 kernel BZImage and operating chest system file root.bin
/ usr / libexec / qemu-kvm -kernel bzimage -drive file = root.bin, if = IDE, cache = none -append “console = ttys0 root = / dev / hda rw init = / sbin / init notsc = 1” – Boot ORDER = DC, MENU = On -Nographic
BZIMAGE Refer to Jslinux 2.6 compilation
Root.bin Source [URL] https://github.com/killinux/jslinux-deobfuscated[/URL] ROOT.BIN
Profile reference
https://bellard.org/jslinux/buildroot-x86.cfg
/ * VM Configuration File * / {Version: 1, Machine: “PC”, Memory_Size: 128, Kernel: “kernel-x86.bin”, cmdline: “loglevel = 3 console = hVc0 root = root rootfstype = 9p rootflags = trans = Virtio RO TZ = $ {Tz} “, fs0: {file:” https://vfsync.org/u/os/buildroot-x86 “}, eth0: {driver:” user “},}
VFSync.org is a remote mapping file system, changed to a local
Change the configuration file to
my-x86.cfg
/ * VM Configuration File * / {Version: 1, Machine: “PC”, Memory_Size: 128, Kernel: “kernel-x86.bin”, cmdline: “console = HVC0 root = / dev / vda rw init = / sbin / INIT NOTSC = 1 “, Drive0: {file:” root.bin “},}
Where kernel-x86.bin source official website [URL] https://bellard.org/jslinux/kernel-x86.bin [/ url] (this need to be compiled once)
In addition, the input and output is HVC0, which is different from the use of root.bin.
Use QEMU to enter the rootbin system
Modify / sbin / init put the final
#settsid sh -c ‘exec sh dev / ttys0> / dev / ttys0 2> & 1′ change to setsid sh -c ‘exec sh dev / hvc0> / dev / hvc0 2> & 1 is HVC0 or TTYS00 shouldBe the kernel decision
Note that HDA and VDA also have different
~ # cat / sbin / init #! / bin / shexport path = / bin: / sbin: / usr / bin: / usr / sbin: / usr / local / binExport Home = / rootexport term = vt100mount -Aifconfig LO 127.0.0.1# allow running dos .com executables with the small ‘Runcom’ UtilityEcho ‘: doscom: E :: COM :: / usr / bin / runcom:>> proc / sys / fs / binfmt_misc / registercd $ home # stty -f /DEV / TTYS0 ROWS 30SHOW_BOOT_TIMEECHO “Welcome to JS / Linux” while / bin / true; do # setsid sh -c ‘exec sh dev / ttys0> / dev / ttys0 2> & 1’setsid sh -c’ Exec SH / HVC0> / DEV / HVC0 2> & 1’Done
Last started
Temu my-x86.cfg
Normally