Difference between revisions of "FEXBash"

From FEX-Emu Wiki
Jump to navigation Jump to search
 
(2 intermediate revisions by the same user not shown)
Line 1: Line 1:
 +
[[Category:Utility_Type_Application]]
 
FEXBash is a utility program provided by FEX-emu for quickly spinning up a bash instance.
 
FEXBash is a utility program provided by FEX-emu for quickly spinning up a bash instance.
 
== What isn't FEXBash ==
 
== What isn't FEXBash ==
Line 8: Line 9:
 
* A way to install packages inside the x86-64 rootfs
 
* A way to install packages inside the x86-64 rootfs
 
** See [[Development:Setting_up_RootFS#If_you_want_to_install_packages_in_the_squashfs|this wiki page]] if you want to add packages to the rootfs.
 
** See [[Development:Setting_up_RootFS#If_you_want_to_install_packages_in_the_squashfs|this wiki page]] if you want to add packages to the rootfs.
 +
** Trying to install packages while running under FEXBash will not work. The rootfs is effectively read-only.
  
 
== What is FEXBash ==
 
== What is FEXBash ==

Latest revision as of 00:22, 5 October 2023

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
    • FEX is never a virtual machine.
  • A chroot
  • A way to install packages inside the x86-64 rootfs
    • See this wiki page if you want to add packages to the rootfs.
    • Trying to install packages while running under FEXBash will not work. The rootfs is effectively read-only.

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.