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

Feature: Add optional delay before booting via fastboot boot #467

Merged
merged 1 commit into from
Dec 21, 2024
Merged
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
5 changes: 5 additions & 0 deletions Documentation/building.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,11 @@ to override the version (i.e. if you want to package lk2nd build), set this vara
By setting this option to 1 lk2nd will always enter the menu upon boot instead of
continuing with the usual workflow. This is useful for debugging and development.

#### `LK2ND_FASTBOOT_DELAY=` - Add delay before booting via `fastboot boot` (ms)

This can help with debugging on devices with carkit uart.
You need to switch the cable before starting linux to see all the logs.

### lk2nd specific

#### `LK2ND_ADTBS=`, `LK2ND_QCDTBS=`, `LK2ND_DTBS=` - Only build listed dtbs
Expand Down
6 changes: 6 additions & 0 deletions app/aboot/aboot.c
Original file line number Diff line number Diff line change
Expand Up @@ -3466,6 +3466,12 @@ void cmd_boot(const char *arg, void *data, unsigned sz)
fastboot_okay("");
fastboot_stop();

#ifdef LK2ND_FASTBOOT_DELAY
/* This can help with debugging on devices with carkit uart. You need to switch the cable before starting linux to see all the logs */
dprintf(INFO, "Waiting %ums before boot\n", LK2ND_FASTBOOT_DELAY);
thread_sleep(LK2ND_FASTBOOT_DELAY);
#endif

boot_linux((void*) hdr->kernel_addr, (void*) hdr->tags_addr,
(const char*) hdr->cmdline, board_machtype(),
(void*) hdr->ramdisk_addr, hdr->ramdisk_size,
Expand Down
4 changes: 4 additions & 0 deletions lk2nd/project/base.mk
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,10 @@ ifeq ($(LK2ND_FORCE_FASTBOOT), 1)
DEFINES += LK2ND_FORCE_FASTBOOT=1
endif

ifdef LK2ND_FASTBOOT_DELAY
DEFINES += LK2ND_FASTBOOT_DELAY=$(LK2ND_FASTBOOT_DELAY)
endif

# Keep the kernel command line clean when booting other operating systems
DEFINES += GENERATE_CMDLINE_ONLY_FOR_ANDROID=1

Expand Down
Loading