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

[kernel] Consolidate reboot, shutdown and poweroff into single program #1999

Merged
merged 5 commits into from
Sep 5, 2024

Conversation

ghaerr
Copy link
Owner

@ghaerr ghaerr commented Sep 5, 2024

Combines three previously separate programs into shutdown, then uses hard links to create reboot and poweroff, reducing disk space while increasing functionality.

The functionality of these programs remains mostly the same, except that poweroff now also tries to unmount all mounted filesystems before powering down the system. Combining these almost-identical programs saves about 3-4k disk space.

Rewrites sys_reboot for some simplification, the two magic numbers passed as first arguments are now ignored, and previously unused options are removed.

@ghaerr ghaerr merged commit 3def215 into master Sep 5, 2024
1 check passed
@ghaerr ghaerr deleted the reboot branch September 5, 2024 05:40
@toncho11
Copy link
Contributor

toncho11 commented Sep 5, 2024

How are hard links done on Fat?

@ghaerr
Copy link
Owner Author

ghaerr commented Sep 5, 2024

How are hard links done on Fat?

They're not. For FAT, the files have to be copied multiple times. For the smallest image, 360k, we are currently only copying shutdown, instead of all three, just for this reason. But that shouldn't be a big deal not having poweroff or reboot commands on 360k.

Actually, I suppose we could add an option to shutdown/power/reboot to do any of the three, (-s/-p/-r) which could help. The current executable is 1280 bytes, so adding more code won't take away any space.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants