chroot [dir]
This command changes the root directory to dir
for subsequent
commands.
This command returns 0 on success and non-zero if an error is encountered.
The destination directory dir
must exist.
NONE
The following is an example of how to use chroot
and the impact it has on the environment for subsequent
command invocations:
SHLL [/] $ cat passwd cat: passwd: No such file or directory SHLL [/] $ chroot etc SHLL [/] $ cat passwd root:*:0:0:root::/:/bin/sh rtems:*:1:1:RTEMS Application::/:/bin/sh tty:!:2:2:tty owner::/:/bin/false SHLL [/] $ cat /etc/passwd cat: /etc/passwd: No such file or directory
This command is included in the default shell command set.
When building a custom command set, define
CONFIGURE_SHELL_COMMAND_CHROOT
to have this
command included.
This command can be excluded from the shell command set by
defining CONFIGURE_SHELL_NO_COMMAND_CHROOT
when all
shell commands have been configured.
The chroot
is implemented by a C language function
which has the following prototype:
int rtems_shell_rtems_main_chroot( int argc, char **argv );
The configuration structure for the chroot
has the
following prototype:
extern rtems_shell_cmd_t rtems_shell_CHROOT_Command;
Copyright © 1988-2008 OAR Corporation