FEXBash

From FEX-Emu Wiki
Revision as of 00:16, 15 August 2022 by Sonicadvance1 (talk | contribs) (Created page with "FEXBash is a utility program provided by FEX-emu for quickly spinning up a bash instance. == What isn't FEXBash == FEXBash is '''not''': * A virtual machine * A chroot * A way...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

FEXBash is a utility program provided by FEX-emu for quickly spinning up a bash instance.

What isn't FEXBash

FEXBash is not:

  • A virtual machine
  • A chroot
  • A way to install packages inside the x86-64 rootfs

What is FEXBash

FEXBash is a wrapper program that executes FEXInterpreter to run x86-64 /bin/sh or /bin/bash. Which application is executed depends on the number of arguments passed in

Usage

Zero arguments

If the user passes in no arguments then FEXBash will execute x86-64 /bin/bash to give an emulated shell environment for tinkering around in.

 ryanh@ubuntu:~$ uname -a
 Linux ubuntu 5.15.0-rc1+ #106 SMP Tue Aug 2 19:43:23 PDT 2022 aarch64 aarch64 aarch64 GNU/Linux
 ryanh@ubuntu:~$ FEXBash
 FEXBash-ryanh@ubuntu:~> uname -a
 Linux ubuntu 5.15.0 #FEX-2208-11-ga2f4f494a SMP Aug 13 2022 09:47:20 x86_64 x86_64 x86_64 GNU/Linux

This is not a virtual machine. It is just an emulated environment that overlays the AArch64 host environment. You can still execute AArch64 programs from the host and also x86-64 programs.

Any arguments

If any arguments are passed in then FEXBash executes /bin/sh -c with the provided arguments passed along. One must be careful with this as sh -c is usually expected to have its arguments wrapped in double quotes.

 ryanh@ubuntu:~$ sh -c uname -a
 Linux
 ryanh@ubuntu:~$ sh -c "uname -a"
 Linux ubuntu 5.15.0-rc1+ #106 SMP Tue Aug 2 19:43:23 PDT 2022 aarch64 aarch64 aarch64 GNU/Linux
 ryanh@ubuntu:~$ FEXBash uname -a
 Linux
 ryanh@ubuntu:~$ FEXBash "uname -a"
 Linux ubuntu 5.15.0 #FEX-2208-11-ga2f4f494a SMP Aug 13 2022 09:47:20 x86_64 x86_64 x86_64 GNU/Linux

As one can see, without the double quotes you effectively lose the -a argument. This behaves the same as /bin/sh -c behaviour without FEXBash.

This is usually used for some sort of scripting wanting to enter the FEX emulated environment.