Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ia32: add option to run secondary psh #1263

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions _projects/ia32-generic-qemu/rootfs-overlay/etc/rc.psh
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,4 @@ X /bin/posixsrv
X /sbin/lwip rtl:0x18:11
T /dev/console
X /bin/psh
X /bin/psh -i /etc/secondary.psh
33 changes: 31 additions & 2 deletions _targets/ia32/generic/build.project
Original file line number Diff line number Diff line change
Expand Up @@ -48,13 +48,30 @@ export BOOT_DEVICE="hd0" # Default boot device
export MAGIC_USER_SCRIPT="baadf00d" # User script magic value


if [ "$CONSOLE" = "serial" ]; then
# Support setting multiple consoles in CONSOLE by listing them concatenated by a ','.
export CONSOLE_APP=
export CONSOLE_APP2=
export CONSOLE_DEVICE=
export CONSOLE_DEVICE2=

CONSOLES=(${CONSOLE//,/ })
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ [shellcheck] reported by reviewdog 🐶
Quote to prevent word splitting/globbing, or split robustly with mapfile or read -a. SC2206


if [ "${CONSOLES[0]}" = "serial" ]; then
CONSOLE_APP="uart16550"
CONSOLE_DEVICE="0.0"
else
CONSOLE_APP="pc-tty"
CONSOLE_DEVICE="3.0"
fi

export CONSOLE_APP

if [ "${CONSOLES[1]}" = "serial" ]; then
CONSOLE_APP2="uart16550"
CONSOLE_DEVICE2="0.0"
elif [ "${CONSOLES[1]}" = "vga" ]; then
CONSOLE_APP2="pc-tty"
CONSOLE_DEVICE2="3.0"
fi


b_build_project() {
Expand All @@ -80,6 +97,18 @@ b_image_target() {
SIZE_PARTITION_KB=$(image_builder.py query --nvm "$NVM_CONFIG" '{{ nvm.hd0.rootfs.size // 1024 }}')

rm -f "$ROOTFS"

# Indicate that there is a secondary psh shell to run.
echo ":{}:" > "$PREFIX_ROOTFS/etc/secondary.psh"
case "${CONSOLES[1]}" in
"serial" )
echo -e "T /dev/ttyS0\nX /bin/psh -t /dev/ttyS0" >> "$PREFIX_ROOTFS/etc/secondary.psh"
;;
"vga" )
echo -e "T /dev/tty0\nX /bin/psh -t /dev/tty0" >> "$PREFIX_ROOTFS/etc/secondary.psh"
;;
esac

SIZE_ROOTFS=$(du -ks "$PREFIX_ROOTFS" | cut -f 1)
echo "rootfs size: ${SIZE_ROOTFS} kB / $((SIZE_PARTITION_KB)) kB"
[ "$SIZE_ROOTFS" -gt "$SIZE_PARTITION_KB" ] && b_die "rootfs size exceeds the target partition!"
Expand Down
5 changes: 1 addition & 4 deletions _targets/ia32/generic/preinit.plo.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,7 @@ contents:
- phfs hd1 2.2 raw
- phfs hd2 2.3 raw
- phfs hd3 2.4 raw
- if: '{{ env.CONSOLE == "serial" }}'
str: console 0.0
- if: '{{ env.CONSOLE != "serial" }}'
str: console 3.0
- console {{ env.CONSOLE_DEVICE }} {{ env.CONSOLE_DEVICE2 }}
- wait 1000
- if: '{{ not(env.RAM_SCRIPT) | default(false) }}'
action: call
Expand Down
2 changes: 2 additions & 0 deletions _targets/ia32/generic/user.plo.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ is_relative: True
contents:
- kernel {{ env.BOOT_DEVICE }}
- app {{ env.BOOT_DEVICE }} -x dummyfs;-N;devfs;-D ram ram
- if: '{{ env.CONSOLE_APP2 }}'
str: app {{ env.BOOT_DEVICE }} -x {{ env.CONSOLE_APP2 }};-n ram ram
- app {{ env.BOOT_DEVICE }} -x {{ env.CONSOLE_APP }} ram ram
- app {{ env.BOOT_DEVICE }} -x psh;-i;/etc/rc.psh ram ram
- app {{ env.BOOT_DEVICE }} -x pc-ata ram ram
Expand Down
2 changes: 1 addition & 1 deletion phoenix-rtos-kernel
2 changes: 1 addition & 1 deletion phoenix-rtos-utils
Submodule phoenix-rtos-utils updated 1 files
+3 −1 psh/psh.c
2 changes: 1 addition & 1 deletion plo
Loading