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

Dzollo/polaris #1360

Open
wants to merge 5 commits into
base: v2.3.0-release
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
27 changes: 27 additions & 0 deletions board/piksiv3/patches/linux/0004-Force-USB-full-speed.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
From d5172acddb1991f781283eeb9e0651535cdd4d03 Mon Sep 17 00:00:00 2001
From: denniszollo <[email protected]>
Date: Wed, 18 Jul 2018 18:02:55 +0000
Subject: [PATCH] Force USB full speed

---
drivers/usb/chipidea/core.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/usb/chipidea/core.c b/drivers/usb/chipidea/core.c
index 69426e644d17..b27f33caec2b 100644
--- a/drivers/usb/chipidea/core.c
+++ b/drivers/usb/chipidea/core.c
@@ -683,8 +683,8 @@ static int ci_get_platdata(struct device *dev,
return ret;
}

- if (usb_get_maximum_speed(dev) == USB_SPEED_FULL)
- platdata->flags |= CI_HDRC_FORCE_FULLSPEED;
+ /* Force USB full speed to work around potential hardware bugs */
+ platdata->flags |= CI_HDRC_FORCE_FULLSPEED;

of_property_read_u32(dev->of_node, "phy-clkgate-delay-us",
&platdata->phy_clkgate_delay_us);
--
2.11.0

18 changes: 18 additions & 0 deletions package/common_init/overlay/etc/init.d/S01poweroff_logger
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#!/bin/sh

# shellcheck disable=SC1091,SC2169,SC2039

export name="shutdown_logger" # required by template_command.inc.sh

export log_tag=$name # required by logging.sh
source /etc/init.d/logging.sh

start() {
:
}

stop() {
logi --sbp "System Shutdown..."
}

source /etc/init.d/template_command.inc.sh
33 changes: 18 additions & 15 deletions package/common_init/overlay/etc/init.d/migrate_storage_media.sh
Original file line number Diff line number Diff line change
Expand Up @@ -91,30 +91,33 @@ migrate_storage()
for dev in $(list_partitions "$mountname"); do
devname="${dev:2}"
if needs_migration "$devname"; then

logw --sbp "Deteted that device '${devname}' should be migrated to ${new_fs_type}..."
logw --sbp "Storage media migration is entirely disabled for this build."

# --- HACK Disabling all migration related things ---
# Stop services that use the sdcard
/etc/init.d/S83standalone_file_logger stop
/etc/init.d/S98copy_sys_logs stop
#/etc/init.d/S83standalone_file_logger stop
#/etc/init.d/S98copy_sys_logs stop

# Disable automount...
echo >/var/run/automount_disabled
#echo >/var/run/automount_disabled

mountpoint=$(lsblk -o MOUNTPOINT "/dev/$devname" | tail -n -1)
#mountpoint=$(lsblk -o MOUNTPOINT "/dev/$devname" | tail -n -1)

[[ -z "$mountpoint" ]] || umount "$mountpoint" || {
logw --sbp "Failed to migrate '${devname}' to ${new_fs_type}..."
return 1;
}
#[[ -z "$mountpoint" ]] || umount "$mountpoint" || {
# logw --sbp "Failed to migrate '${devname}' to ${new_fs_type}..."
# return 1;
#}

new_fs_type=$(fetch_new_fs_type "$devname")
logw --sbp "Migrating '$devname' to $new_fs_type..."
#new_fs_type=$(fetch_new_fs_type "$devname")
#logw --sbp "Migrating '$devname' to $new_fs_type..."

format_with_fs_type "$devname" "$new_fs_type" || return 1
#format_with_fs_type "$devname" "$new_fs_type" || return 1

logi "Done migrating '${devname}' to ${new_fs_type}..."
#logi "Done migrating '${devname}' to ${new_fs_type}..."

set_reboot_after_migrate
set_stop_wait_for_mount
#set_reboot_after_migrate
#set_stop_wait_for_mount
fi
done
}
Expand Down
12 changes: 12 additions & 0 deletions package/common_init/overlay/usr/bin/umount_all
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/bin/sh
echo "Disabling automount" | sbp_log --info
echo >/var/run/automount_disabled
echo "Stopping standalone logging service" | sbp_log --info
/etc/init.d/S83standalone_file_logger stop
echo "Stopping copy sys logs service" | sbp_log --info
/etc/init.d/S98copy_sys_logs stop
echo "Unmounting USB" | sbp_log --info
umount /media/sda1;
echo "Unmounting sd card" | sbp_log --info
umount /media/mmcblk0p1
echo "It is now safe to shut off your Piksi!" | sbp_log --info
7 changes: 7 additions & 0 deletions package/piksi_system_daemon/overlay/etc/init.d/do_poweroff
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/bin/sh

/etc/init.d/S01poweroff_logger stop

# We use -f to force immediate reboot. Orderly shutdown sometimes fails
# when unloading remoteproc drivers.
poweroff -f
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,7 @@ piksi_sys ALL=(ALL) NOPASSWD: /usr/bin/upgrade_tool --debug /data/upgrade.image_
piksi_sys ALL=(ALL) NOPASSWD: /etc/init.d/update_eth0_config
piksi_sys ALL=(ALL) NOPASSWD: /etc/init.d/update_ntp_config
piksi_sys ALL=(ALL) NOPASSWD: /etc/init.d/do_sbp_msg_reset
piksi_sys ALL=(ALL) NOPASSWD: /etc/init.d/do_poweroff
piksi_sys ALL=(ALL) NOPASSWD: /usr/bin/umount_all
piksi_sys ALL=(fileio) NOPASSWD: /usr/bin/spawn_nc
piksi_sys ALL=(fileio) NOPASSWD: /usr/bin/sbp_fileio_flush
33 changes: 32 additions & 1 deletion package/piksi_system_daemon/src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,8 @@ static void sbp_command(u16 sender_id, u8 len, u8 msg_[], void *context)

if (strcmp(msg->command, "upgrade_tool upgrade.image_set.bin") != 0
&& strcmp(msg->command, "spawn_nc") != 0 && strcmp(msg->command, "stream_logs") != 0
&& strcmp(msg->command, "dump_syslog") != 0) {
&& strcmp(msg->command, "dump_syslog") != 0 && strcmp(msg->command, "umount_all") != 0
&& strcmp(msg->command, "halt") != 0 ) {
msg_command_resp_t resp = {
.sequence = msg->sequence,
.code = (u32)-1,
Expand Down Expand Up @@ -224,6 +225,36 @@ static void sbp_command(u16 sender_id, u8 len, u8 msg_[], void *context)

return;
}

if (strcmp(msg->command, "umount_all") == 0) {

char umount[1024];

size_t count = snprintf(umount,
sizeof(umount),
"sudo umount_all; sbp_cmd_resp --sequence %u --status $?",
msg->sequence);

assert(count < sizeof(umount));
(void)system(umount);

return;
}

if (strcmp(msg->command, "halt") == 0) {

char halt[1024];

size_t count = snprintf(halt,
sizeof(halt),
"sudo /etc/init.d/do_poweroff; sbp_cmd_resp --sequence %u --status $?",
msg->sequence);

assert(count < sizeof(halt));
(void)system(halt);

return;
}

const char *upgrade_cmd =
"sh -c 'set -o pipefail; "
Expand Down