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

Bring up Linux kernel #508

Draft
wants to merge 25 commits into
base: master
Choose a base branch
from

Commits on Nov 2, 2024

  1. Bring up Linux kernel

    ChinYikMing committed Nov 2, 2024
    Configuration menu
    Copy the full SHA
    bf9d567 View commit details
    Browse the repository at this point in the history
  2. Introduce portable clz

    ChinYikMing committed Nov 2, 2024
    Configuration menu
    Copy the full SHA
    a74a9e8 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    7087369 View commit details
    Browse the repository at this point in the history
  4. Move peripherals to devices directory

    - modify Makefile to enable detect devices directory
    - decouple PLIC and UART into separate files
    - Bind RISC-V core to plic_t to enable sending interrupt from PLIC to
      core
    ChinYikMing committed Nov 2, 2024
    Configuration menu
    Copy the full SHA
    5b7fcbd View commit details
    Browse the repository at this point in the history
  5. Refine input

    ChinYikMing committed Nov 2, 2024
    Configuration menu
    Copy the full SHA
    3cd4460 View commit details
    Browse the repository at this point in the history
  6. Introduce ENABLE_USE_ELF

    Currently, the system test suite is compiled into a single ELF
    executable, leading to discrepancies between the inputs for Linux
    kernel emulation and the system test suite. By introducing
    ENABLE_USE_ELF, we can allow the use of the ELF executable when
    running the system test suite.
    
    This might be a temporarily solution, need to refactor more.
    ChinYikMing committed Nov 2, 2024
    Configuration menu
    Copy the full SHA
    d3c493d View commit details
    Browse the repository at this point in the history
  7. Introduce ENABLE_ON_TEST

    The MMU test suite relies on rv32emu's syscall function instead of
    its syscall table, unlike the Linux kernel. Therefore, use the
    ON_TEST macro to distinguish between the Linux kernel and MMU test
    suite as the emulation target.
    ChinYikMing committed Nov 2, 2024
    Configuration menu
    Copy the full SHA
    b8e1e8e View commit details
    Browse the repository at this point in the history
  8. Configuration menu
    Copy the full SHA
    9fe2ce7 View commit details
    Browse the repository at this point in the history
  9. Configuration menu
    Copy the full SHA
    921c300 View commit details
    Browse the repository at this point in the history
  10. Configuration menu
    Copy the full SHA
    4012f2a View commit details
    Browse the repository at this point in the history

Commits on Nov 3, 2024

  1. Some changes

    - use stack storage for vm_data_t to eliminate potential mem leak.
    - run_and_trace only accessible when USE_ELF is enable since it needs
      parsing the symbol of the ELF. Add TODO on it for parsing Linux kernel
      symbol. In addition, Linux kernel emulation specified code shall be
      checked as well.
    - enable parsing different kernel image, rootfs image, and dtb file by
      CLI parameters.
    - Linux kernel emulation needs dedicated mem size, but the current
      Makefile default enable SDL if libsdl is installed in system and then
      enable FULL_4G feature. Thus, forcely undefine MEM_SIZE if current
      emulation target is Linux kernel and use the dedicated one.
    ChinYikMing committed Nov 3, 2024
    Configuration menu
    Copy the full SHA
    071b55d View commit details
    Browse the repository at this point in the history

Commits on Nov 4, 2024

  1. Configuration menu
    Copy the full SHA
    5ed8482 View commit details
    Browse the repository at this point in the history
  2. Some changes

    - remove comment that related to MMU test suite in syscall_handler
      and mention them in Makefile instead
    - rename int and ints to intr and intrs respectively
    - use enum for PLIC's regs
    - Disable termios keyboard echoing and capture CTRL+a+x to exit VM
    ChinYikMing committed Nov 4, 2024
    Configuration menu
    Copy the full SHA
    5b64af8 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    0915b75 View commit details
    Browse the repository at this point in the history

Commits on Nov 6, 2024

  1. Add DTS file

    When you build using the command make ENABLE_SYSTEM=1 -j$(nproc),
    the default target in the Makefile is invoked. At this stage, the
    Device Tree Blob (DTB) should already be built before executing
    rv32emu. Therefore, system.mk is included before the all target
    in the Makefile.
    ChinYikMing committed Nov 6, 2024
    Configuration menu
    Copy the full SHA
    e1f9d0a View commit details
    Browse the repository at this point in the history
  2. Some changes

    - rewrite MMIO handler.
    To adapt more MMIO in the future (e.g., VirtIO), the IIF(io) cannot be
    used since it supports only binary. Thus, rewrite using switch case can
    solve this.
    
    - suppress warning.
    In mmu-based read handler, warning 'non-void function does not return a
    value in all control paths' could be reached, so add __UNREACHABLE() to
    suppress it.
    
    - keyboard hacking should be defined only when Linux kernel emulation.
    
    - opt_trace only available when target RV32 file is ELF executable.
    
    - map_file might be not available on non POSIX compatible machine, thus
      adding a fault back implementation when HAVE_MMAP is not set.
    ChinYikMing committed Nov 6, 2024
    Configuration menu
    Copy the full SHA
    91c0287 View commit details
    Browse the repository at this point in the history
  3. Add Build and Run and Automation image build section in README

    - Stores the default configurations for buildroot, busybox, and Linux
      within the assets directory. Initially, assets were designated for
      wasm usage, but to avoid creating a new directory for configurations,
      the assets directory is reused for this purpose. Also, add an
      automation image build script 'build-img.sh'.
    - Add a new Makefile target called 'system' to build and run more easier
      for user.
    ChinYikMing committed Nov 6, 2024
    Configuration menu
    Copy the full SHA
    7151690 View commit details
    Browse the repository at this point in the history

Commits on Nov 10, 2024

  1. Move system img build script to tools/

    Since build linux images script is stored in tools/, thus define the
    build-linux-img Makefile target in mk/tools.mk for consistency.
    ChinYikMing committed Nov 10, 2024
    Configuration menu
    Copy the full SHA
    fcf5848 View commit details
    Browse the repository at this point in the history

Commits on Nov 11, 2024

  1. Tweak artifact CI and Makefile

    With the Linux image and ELF executable already separated, it is
    also necessary to decouple the tags. Add the suffix 'Linux-Image'
    for the Linux image release artifact and 'ELF' for the test bench
    ELF executable.
    
    Additionally, include the Buildroot and Linux kernel version files
    in .ci/. Updating either of these files will trigger a rebuild of
    the Linux image artifact.
    ChinYikMing committed Nov 11, 2024
    Configuration menu
    Copy the full SHA
    3432824 View commit details
    Browse the repository at this point in the history

Commits on Nov 12, 2024

  1. Tweak build linux image rules

    - reuse mk/external.mk to verify integrity of the source.
    - let build-system-image Makefile target can be reused in build-artifact
      CI.
    - the download, extract and verify function in mk/external.mk are adjusted
      since git CLI command is added to pull buildroot and Linux. Note that
      the '*/.git/*' of a git cloned repository has to be filtered out
      during SHA value verification because the metadata is difference every
      time when cloning.
    - all linux image store in build/linux-image directory.
    ChinYikMing committed Nov 12, 2024
    Configuration menu
    Copy the full SHA
    296ebe2 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    3705621 View commit details
    Browse the repository at this point in the history
  3. Disable SMP config

    ChinYikMing committed Nov 12, 2024
    Configuration menu
    Copy the full SHA
    2d2e94d View commit details
    Browse the repository at this point in the history
  4. Remove minimal.dtb when make distclean and clean

    Note that ENABLE_SYSTEM=1 shall be specified
    ChinYikMing committed Nov 12, 2024
    Configuration menu
    Copy the full SHA
    ab8b756 View commit details
    Browse the repository at this point in the history
  5. CI: Tweak rebuild Linux image rules

    The Linux image rebuild will be triggered if and only if the version of them
    are changed in mk/external.mk.
    ChinYikMing committed Nov 12, 2024
    Configuration menu
    Copy the full SHA
    36d664e View commit details
    Browse the repository at this point in the history

Commits on Nov 21, 2024

  1. Add a typedef name for uint32_t

    To make PTE variable more semantic. Also, it can be easily to support
    more MMU schema afterwards.
    ChinYikMing committed Nov 21, 2024
    Configuration menu
    Copy the full SHA
    0574e35 View commit details
    Browse the repository at this point in the history