new (internal used) functions:
- _exit
- _exit_report
- _exit_sigint
these are used to fix several (wrong) error handlings.
new environment variable:
- UNATTENDED_PATCHING
by default we assume unattended patching, i.e. if an error occurs during
the patch, reset or any other process we will report the error and
auto close the shell. this is needed as we source functions and code and
so cannot simply terminate a master process. instead the whole shell will
be terminated so if an error occurs nothing else will be executed (and you
should notice easily that something is wrong).
without that a (serious) error can still continue the rest of a function
and you likely not even noticing the error itself.
you can use:
export UNATTENDED_PATCHING=0
before or after sourcing init.sh and it will *NOT* auto-close the shell.
that way you can check the output and fix any issues.
Signed-off-by: steadfasterX <steadfasterX@gmail.com>
when using strict (i.e set -e added by this PR) a build will fail on release when there is no recovery.img. this makes that non-fatal allowing to proceed
Signed-off-by: steadfasterX <steadfasterX@users.noreply.github.com>
this commit adds (the currently non-existing) error handling when
using divest's functions and scripts.
all the magic here gets activated when `source ../../Scripts/init.sh`
gets executed which is already a mandatory step before starting any
of the divest functions.
when something fails during patching, resetting or building
each error will be catched + printed including an error code now.
last but not least the executed file and the line number causing that
failure will be shown, too.
as all divest functions get source'd and so not a single build
script gets executed all ERR's needs to be trapped to catch issues.
I am not aware of another way to handle that properly as sourcing
means we cannot track a script or smth while this approach here
just works.
Example for an error thrown in a function call:
> ERROR: $DOS_WORKSPACE_ROOT/Scripts/Common/Functions.sh -> verifyAllPlatformTags() ended with status >1< at line >49<
Final SUCCESS result message after using `patchWorkspace`:
> [FINAL RESULT] No error detected (please check the above output nevertheless!)
Final ERROR result message after using `patchWorkspace`:
> [FINAL RESULT] Serious error(s) found!!!
> Summary error code was: 126. Check & fix all error lines above
Some notes:
- when an error occurs the process continues until the end (like it is now)
i.e. an error will not stop the current and following tasks
- when multiple errors occur the exit codes will be summed
- buildDevice: a (summed) end result gets printed (SUCCESS or ERROR) at the very end
- the trap used to catch any error will also be active for any command executed
on the cli. that means: type "false" -> ENTER and you will get an error, too
same for any script exectued after source init.sh
- when all goes well the trap will be resetted at the end but there are cases
where this might not happen -> that is why `resetEnv` can be executed to
reset the trap, i.e. all becomes as it was before sourcing init.sh
- `resetEnv` gets called automatically:
- after a successful `patchWorkspace` run
- whenever CTRL+C is used (during a running task or just on the cli)
- a process get killed (SIGHUP, TERM)
- the whole implementation might not catch all errors though - it highly depends
on how the function or the script/program called actually handles errors or better
said: if they return a proper exit code on failures.
For example some tools (like some git cmds) might print an error but don't return
a non-zero exit code. This cannot be tracked other then with your eyes or these
must be replaced by other methods returning a non-zero exit code on failures.
Signed-off-by: steadfasterX <steadfasterX@gmail.com>
Fixes the following issue on systems where /bin/sh != /bin/bash (e.g. Ubuntu):
> source [...]/Scripts/Common/Tag_Verifier.sh && verifyTagIfPlatform : 1: source: not found
for these (unsupported) systems the following is still required (not needed on Fedora or other systems using /bin/sh -> /bin/bash):
1. `ln -s /bin/bash ~/.local/bin/sh`
2. .bashrc -> `export PATH="$HOME/.local/bin:$PATH"`
3. .bashrc -> `alias sh='/bin/bash'`
Signed-off-by: steadfasterX <steadfasterX@users.noreply.github.com>
- Enable APEX for Pixel 6/7, necessary for camera and pKVM
- Also drop hack removing pKVM for Pixel 6/7
- patch from GrapheneOS
- Extend hmalloc workaround to /apex
- Deblobber:
- actually handle wildcard f/w/b overlays
- move some stuff around
- remove some more Pixel blobs
- flag and disable removal of camera extensions, being able to use the second camera is nice
- Adjust what hardenDefconfig disables, caused boot issues
minimal impact as most of these are already default-disabled
can be narrowed down in future
- Disable some of the bionic hardening patches, causing more boot issues
annoying to lose, but having a phone that boots is more important
- Add LTE only mode to 17.1, 18.1, 19.1, and 20.0, credit GrapheneOS
- Remove Pixel 2 ramdisk compression reverts, fixed upstream
And yes, I know I should've split up this commit...
Signed-off-by: Tad <tad@spotco.us>
- Add back the SIM ToolKit app
- 17.1: CarrierConfig testing
- 19.1: Enable op5 firmware inclusion, needs testing
- Don't disable coresight bits on op8, breaks compile
- 19.1: Add a patch from GrapheneOS to display/share logs when a crash happens
Signed-off-by: Tad <tad@spotco.us>
OnePlus 9 failed boot kernel log points to this.
GrapheneOS noted this as an inherent issue on the Pixel 4 and 5 too.
Signed-off-by: Tad <tad@spotco.us>
What is lost?
- sanity checks and redzoning on all devices
- redzoning reportedly however causes issues on some devices such as the Pixel 3/4 and OnePlus 7
- slub sanization on 3.0, 3.4, 4.4 (except google/wahoo), xiaomi/sm6150, and oneplus/sm7250
Note: all 3.4+ devices still have page sanization
Signed-off-by: Tad <tad@spotco.us>
- Disable slub_debug=P for devices with INIT_ON_ALLOC/FREE_DEFAULT_ON
- Disable slub_debug=Z due to known breakage
- Disable many debug options on Linux 4.x and up
- 19.1: fixup missing manifests for vayu :\
Signed-off-by: Tad <tad@spotco.us>
The backported fix for CVE-2021-39713 requires CONFIG_MODULES=y
MODULES is default enabled, but some kernels are mutilated and break with it on
Signed-off-by: Tad <tad@spotco.us>
Drop long non-compiling devices:
- 14.1: n7100, jellypro
- 15.1: himaul, oneplus2
- 16.0: zenfone3, fugu
- 17.1: yellowstone, fugu
- 18.1: bonito, sargo
Drop in favor of 19.1:
- 17.1: bonito, sargo
- 18.1: pro1, aura, sunfish, coral, flame, bramble, redfin
(experimental, but these devices don't currently appear to have any users)
Signed-off-by: Tad <tad@spotco.us>