Commit Graph

143 Commits

Author SHA1 Message Date
Kelvin Zhang
ed656a3993 [ci][github] Disable buffering on subprocess output
Testing script works by reading output of subprocess and checking if
output matches expectation. To ensure that we can see output in timely
fashion, disable buffering.
2025-08-05 03:52:06 -04:00
Travis Geiselbrecht
be52909f49 [make][buildall] add ability to filter buildall by architecture
Clean up make targets list-arch and list-toolchain to be much faster and
work without needing to invoke the archtecture's arch rules.mk. This
should make it work on machines that do not have that particular
toolchain in the path.

This is setting up for using it in the github action script.
2025-07-18 21:51:50 -07:00
Travis Geiselbrecht
50dc95b85e [scripts][buildall] print if building with WERROR or not
General cleanup of script based on vscode suggestions.
2025-07-18 20:57:07 -07:00
Kelvin Zhang
97e2d701b7 [ci][github] Increase test timeout to 5s
It was found that QEMU process is often under D(Disk Sleep) state
after test fails due to timeout. This suggests that I/O is sometimes
extremely slow on github CI server. Hence increase test timeout to
5s for reliability.
2025-06-03 22:17:22 -07:00
Kelvin Zhang
a7addca7bc [ci][github] Check QEMU process state before exiting
This helps understand what the QEMU process is doing when test
fails due to timeout
2025-06-03 22:17:22 -07:00
Kelvin Zhang
91a65fd20d [ci][github] Fix CI stability
* Sometimes apt-get install qemu fails with fetch error, run apt-get
update first to mitigate
* unittest.py often fails due to app shell not started in 0.5s, increase
  timeout
2025-05-28 16:04:10 -07:00
Travis Geiselbrecht
9d66069183 Merge from x86-smp: implement SMP for both 32 and 64bit x86
A large pile of changes to the PC platform and x86 architecture that
facilitate SMP support. Tested in both 64 and 32bit on qemu and real
hardware all the way back through i486.
2025-04-10 22:17:02 -07:00
Travis Geiselbrecht
2987f73d08 [platform][pc] add support for TSC based clock
-Detect if under KVM hypervisor and read tick rate or
-calibrate tick against PIT
2025-03-30 21:59:39 -07:00
Travis Geiselbrecht
7fff3510a3 [scripts][buildall] hard set WERROR=0 if -e not passed
This allows it to override the WERROR setting if, say, someone put
WERROR?=1 in their local.mk. (It's a good idea)

Note: I can't really leave WERROR enabled in the default build because
of all of the variants of compilers folks use in the wild, but I do
highly suggest folks use it locally.
2025-01-11 17:24:51 -08:00
Travis Geiselbrecht
164f9fa47e WIP working with lapic to trigger a timer 2025-01-03 20:54:30 -08:00
Joshua Seaton
1b2c449ceb [scripts] Introduce scripts/fetch-toolchains.py
This change introduces $LK_ROOT/toolchain as an official installation
directory for toolchains, as well as a new script for conveniently
installing them there (versus manual GETs + untarring).

getting_started.md is updated to suggest its use.
2024-08-11 22:40:14 -07:00
Travis Geiselbrecht
fdf48a80c8 [scripts][do-qemuarm] add support for using HVF on mac
Detect if it's being run on a darwin host and try to use HVF if the -k
switch is passed.
2024-08-11 12:06:54 -07:00
Kelvin Zhang
87b7245a6b [github-ci] Add uefi_load unittest to github CI 2024-06-24 14:10:33 -07:00
Travis Geiselbrecht
d1f4b4a546 [target][banana pi f3] quick n dirty port to the bananapi f3 board
A decent 8 core riscv64 board with dual ethernet and 2 or 4GB ram.

Fairly easy to bring up on, though not a lot of docs at the moment.
2024-06-19 16:43:16 -07:00
Travis Geiselbrecht
74864a56c0 [scripts][buildall] catch ctrl-c and abort the script 2024-06-14 15:35:58 -07:00
Travis Geiselbrecht
ec4da9673b [platform][qemu-riscv32] trim usable memory to 1GB on qemu-riscv32 2024-05-16 20:52:45 -07:00
Travis Geiselbrecht
d54735cf5d [scripts][do-qemuarm] add switch to try to use KVM 2024-05-09 23:11:58 -07:00
Cody Wong
64b462cb37 [arm][v9p] Add v9p host dir sharing support for arm platform
- Add the v9p support for arm platform.
 - Add an option `-f` to set the shared directory on the host machine to
   `do-qemuarm`.
 - For example, to use the v9p dir sharing, run the script as:
    ```
    # under `lk/` run the follow command will share the current
    # directory `lk/` within LK vm as VirtIO 9p device
    scripts/do-qemuarm -f .
    ```

Signed-off-by: Cody Wong <codycswong@google.com>
2024-04-01 23:09:30 -07:00
Aaron Odell
47c8b9a711 [scripts][buildall] Propogate logged error status through pipe tee
In the non-QUIET case, the log function pipes output to the tee command.
Without the pipefail option, if a make command fails, but the tee exits
succesfully, the overall status is 0 and the failed project doesn't get
added to the FAILED list and reported. Adding the pipefail option
propagates the make failure appropriately and adds the target to the
FAILED list.
2023-04-23 17:34:45 -07:00
Travis Geiselbrecht
3dd8a32e92 [arch][riscv] a few small tweaks
Updated comment regarding clobbers on the SBI call.
Tweak a boot time print of SBI version.
Add a commented out line to the do-qemuriscv to assist in dumping future
device trees.
2023-02-18 14:42:59 -08:00
Travis Geiselbrecht
208bae5feb [scripts][do-qemux86] use the older 'pc' machine model when selecting x86-32
This gets a bit more coverage of hardware. In general if using 32bit LK
it's for running on older hardware anyway.
2022-10-18 23:59:15 -07:00
Travis Geiselbrecht
7505c3087a [arch][x86][fpu] spiff up the fpu code to detect things more cleanly
Doesn't really change the functionality of the code except it'll try to
work with less fpu features present.
2022-07-24 19:56:24 -07:00
Travis Geiselbrecht
3dff26ae7b [make] add BUILDDIR_SUFFIX build variable
This allows you to tag your build dirs with an optional string.

Update scripts/buildall to also allow building all release (DEBUG=0)
builds. Add a few other convenience switches.
2022-07-23 15:57:53 -07:00
Travis Geiselbrecht
b76ba5ec0e [scripts][do-qemuriscv] synchronize with options available from arm version
Most notably the ability to specify the disk image
2022-05-12 20:24:17 -07:00
Travis Geiselbrecht
74386913a0 [scripts][do-qemuarm] set script=no when using tun/tap 2022-05-12 20:08:21 -07:00
Travis Geiselbrecht
d7ef1985eb [scrtipts][do-qemu] align the arm and x86 script a bit more
Add option to specify disk file to ARM
2022-04-21 21:31:01 -07:00
Peter Collingbourne
4a15661ee0 [arch][arm64] use SMC when booted at EL2 in QEMU
If we were booted at EL2 (e.g. when passing -machine
virt,virtualization=on), we need to use SMC instead of HVC for PSCI
calls. Change psci_call() to do this and add a flag to do-qemuarm to
allow testing this scenario.
2022-04-19 18:32:12 -07:00
Travis Geiselbrecht
9caf62273c [lib][minip] start of TCP connect state machine
A few miscellaneous tweaks outside of that.
2022-03-19 14:43:55 -07:00
Travis Geiselbrecht
4bd6de50b0 [scripts][do-qemux86] add a few more virtio devices and tweaks 2022-02-27 19:37:48 -08:00
Travis Geiselbrecht
8ed7d0fc70 [scripts][make-parallel] add uname cases for netbsd and openbsd as well 2022-02-10 22:48:14 -08:00
Travis Geiselbrecht
36e73e0fac [bus][pci] add routines to pass in PCI bus resources prior to starting the pci bus manager
Wire them up on arm and riscv which need them. x86-pc does not, so dont
call it.

Also fix a few miscellaneous bugs, notably PCI not detecting 64bit bars
properly due to an off by one bit error.
2022-02-06 19:46:39 -08:00
Travis Geiselbrecht
f3a337789c [dev][e1000] add an atomic counter to number the e1000s found 2022-01-11 00:15:10 -08:00
Travis Geiselbrecht
35da2d1260 [minip][dhcp] spiff up the state machine to handle more edge cases
-Add TAP option to scripts/qemux86
2021-12-31 17:23:57 -08:00
Travis Geiselbrecht
0617d6c845 [scripts][do-qemux86] add ability to set the network driver 2021-12-27 22:24:31 -08:00
Travis Geiselbrecht
caafb3e2ad [dev][net][e1000] First stab at a working e1000 driver.
-Works against qemu's e1000 and e1000e driver.
-Untested on real hardware yet.
2021-12-27 22:24:31 -08:00
Travis Geiselbrecht
a47cf76f14 [scripts][do-qemuarm] hard disable network if not selected
Turns out qemu was putting a e1000 nic on the PCI bus if no options were
selected. No reason to do so if the network is explicitly not called
for.
2021-11-20 17:42:41 -08:00
Travis Geiselbrecht
6fec0cb2bf [scripts][x86] spiff up the qemu x86 script to handle a virtio disk and net device 2021-11-09 00:29:57 -08:00
Travis Geiselbrecht
911900f3df [arch][m68k] Merge in Motorola 68k port 2021-11-08 23:24:37 -08:00
Travis Geiselbrecht
189c0e8cd4 [target][stm32f7-discovery] update the openocd script
Use a newer name for the stlink.cfg file.
2021-10-07 00:00:22 -07:00
Travis Geiselbrecht
12fee4b59a [arch][m68k] initial port to m68k
Uses the QEMU virt machine for 68k defined in qemu 6.0+.
Basic support that boots, prints to the console, takes input from
console, and context switches.

TODO: interrupt support, timer support.
2021-06-06 19:38:45 -07:00
Travis Geiselbrecht
b730a5ef5c [github][actions] Add a new action to build LK, replacing travis-ci
Use the new github actions to replace the travis-ci builders which
seem to no longer work and are being removed.

This first stab is fairly rough, just matches the explicit matrix
that was in the travis-ci hooks, but at least gets back to a buildable
state again.
2021-02-14 20:23:39 -08:00
Travis Geiselbrecht
a21bc34022 [arch][riscv] restructure the qemu starter script to share the embedded and non embedded logic 2020-12-30 02:02:42 -08:00
Travis Geiselbrecht
6ea6256d89 [platform][sifive] add switch to scripts/do-riscvqemu to run sifive unleashed
Also fix up some broken bits on the previously unused qemu-sifive-u target.
2020-12-30 01:40:05 -08:00
Travis Geiselbrecht
11ca56717e [scripts][do-sifive-e] point the script at the current versions of the sifive-e sdk
Not ideal to have these hard coded but it beats building them from scratch.
2020-11-30 23:22:59 -08:00
Travis Geiselbrecht
01f9a97dc1 [arch][openrisc] fix up and get the OpenRISC port working again
Previous to now it had always relied on a custom patched gcc
and a custom sim. In the interim since the initial port went in
some time in 2015 GCC and QEMU have both officially picked up support
for the architecture and the machine that was emulated in the previous
emultor.

Using gcc 10.2 fix up the build and get it basically working. Timers
seem to not be working right but it's probably fairly easy to fix.
2020-10-21 02:34:50 -07:00
Travis Geiselbrecht
2d29b94c84 [travisci] use parallel builds 2020-05-17 13:55:16 -07:00
Travis Geiselbrecht
35c3742b6c [scripts][codestyle] add some comments on the codestyle script 2020-05-16 15:33:00 -07:00
Travis Geiselbrecht
f0449cc59c [platform][riscv] move the supervisor mode switch to -S which makes more sense 2020-01-26 12:11:14 -08:00
Travis Geiselbrecht
9c71a0ec57 [platform][qemu-riscv] Fixup qemu-riscv target
-Fix plic driver to handle machine vs supervisor mode
-Add switch to scripts/do-qemuriscv to run in supervisor mode (with OpenSBI)
-Use the FDT to detect the number of cpus and size of memory
2020-01-19 14:48:25 -08:00
Travis Geiselbrecht
fdc08a8446 [arch][riscv] port to riscv64
Very little needed to port except to conditionalize some assembly in the
context switch and exception code. Mostly needed to move build system
stuff around and add a new project.
2019-11-02 17:21:13 -07:00