Skip to content

Commit

Permalink
add megrez docs
Browse files Browse the repository at this point in the history
  • Loading branch information
hokamilkv committed Dec 18, 2024
1 parent fc4f862 commit 43d3d90
Show file tree
Hide file tree
Showing 25 changed files with 1,051 additions and 0 deletions.
9 changes: 9 additions & 0 deletions docs/megrez/_category_.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"label": "🌟Megrez",
"position": 15,
"link": {
"type": "generated-index",
"slug": "/megrez",
"description": "Hello, I am Milk-V Megrez"
}
}
9 changes: 9 additions & 0 deletions docs/megrez/getting-started/_category_.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"label": "🚀 Getting Started",
"position": 15,
"link": {
"type": "generated-index",
"slug": "/megrez/getting-started",
"description": "Getting Started with Megrez"
}
}
46 changes: 46 additions & 0 deletions docs/megrez/getting-started/boost.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
---
sidebar_label: 'Frequency Adjustment'
sidebar_position: 30
---

# Frequency Adjustment

By default, the CPU frequency of Megrez is set to 1.4GHz, with a CPU voltage of 800mV.

## Increasing the Frequency to 1.8GHz

Using Rock OS as an example, after booting into Rock OS, enter the following command in the terminal:

~~~
sudo sh -c 'echo performance > /sys/devices/system/cpu/cpufreq/policy0/scaling_governor'
~~~

At this point, the CPU voltage will increase to 900mV, and the CPU frequency will rise to 1.8GHz.

## Reducing the Frequency to 1.4GHz

Using Rock OS as an example, after booting into Rock OS, enter the following command in the terminal:

~~~
sudo sh -c 'echo userspace > /sys/devices/system/cpu/cpufreq/policy0/scaling_governor'
~~~

At this point, the CPU voltage will decrease to 800mV, and the CPU frequency will drop back to 1.4GHz.

## Dynamic Frequency Scaling

Megrez supports dynamic frequency scaling, allowing the CPU frequency to adjust automatically based on the current task load to balance energy efficiency and performance.

Using Rock OS as an example, after booting into Rock OS, enter the following command in the terminal:

~~~
sudo sh -c 'echo schedutil > /sys/devices/system/cpu/cpufreq/policy0/scaling_governor'
~~~

Or:

~~~
sudo sh -c 'echo ondemand > /sys/devices/system/cpu/cpufreq/policy0/scaling_governor'
~~~

In this mode, the CPU frequency and voltage will adjust dynamically according to the task load. Under low-load conditions, the CPU frequency may drop to as low as 0.4GHz.
96 changes: 96 additions & 0 deletions docs/megrez/getting-started/boot.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
---
sidebar_label: 'Install OS'
sidebar_position: 10
---

# Milk-V Megrez Install OS

## Boot Instructions

The Megrez mainboard supports booting the system from four types of media: SD card, eMMC module, SSD (M.2 SATA), and SATA hard drive.

:::tip
The onboard SPI Flash is used to store boot programs like u-boot, which then loads the operating system from eMMC or SSD based on the boot priority.
:::

## System Image Information

Currently, the Megrez image package format is `img.zip`.

- System image packages with the `.img.zip` suffix:
- Can be flashed using tools like `balenaEtcher`, `Rufus`, or `Win32DiskImager`. On Linux, the `dd` command can be used. Some tools support flashing directly from the zip file, while others require extracting it to an `.img` file first. Please try accordingly.

## (Recommended) Using BalenaEtcher to Install the System onto SD Card/M.2 SATA SSD/SATA Hard Drive/eMMC Module

### Preparation
- A MicroSD card (greater than 16GB), M.2 SATA SSD, SATA hard drive, or eMMC module.
- An SD card reader, M.2 SATA enclosure, SATA hard drive enclosure, or eMMC module reader.

Using `balenaEtcher` as an example, the flashing process is as follows:

First, connect the storage media to your PC via the appropriate reader. Installing the system on the target drive will erase all existing data on the storage media, so **back up any important files** beforehand.

Download the appropriate system image package (suffix `.img.zip`) from the resource download page: [Resource Download Overview](https://milkv.io/docs/megrez/getting-started/resources).

You can either extract it to an `.img` file before flashing or flash it directly without extracting, as `balenaEtcher` supports loading zip files.

1. Download and install the flashing tool [balenaEtcher](https://etcher.balena.io/).
2. Click `Flash from file` and select the downloaded image.
<Image src='/docs/common/etcher-step1.webp' maxWidth='100%' align='left' />
3. Click `Select target` and choose the storage media.
<Image src='/docs/common/etcher-step2.webp' maxWidth='100%' align='left' />
4. Click `Flash!` to start the flashing process.
<Image src='/docs/common/etcher-step3.webp' maxWidth='100%' align='left' />

After flashing is complete, insert the storage media into the Megrez mainboard and power it on. Since the system does not currently support automatic partition resizing on first boot, please manually resize the system partition as described in the "System Partition Resizing" section.

## Using Fastboot to Install the System onto SD Card/M.2 SATA SSD/eMMC Module

Coming soon.

## System Partition Resizing

:::tip
The system does not currently support automatic partition resizing after boot. Please resize manually after the first boot to avoid running out of space or being unable to access the desktop after a reboot.
:::

The following instructions use the `gparted` tool as an example for resizing. You may also use other tools you are familiar with to accomplish the task.

1. Install the `gparted` tool.
```bash
sudo apt update
sudo apt install gparted
```

2. Launch the gparted program from the command line or by selecting it from the application menu.
```bash
sudo gparted
```

3. In the top-right corner, select the SD card device. You should see the unallocated space (22GB) and the root filesystem rootfs `/` (6GB).
<Image src='/docs/jupiter/gparted-extend-01.webp' maxWidth='100%' align='left' />

4. Select the rootfs `/` partition, right-click, and choose `Resize/Move` to expand the partition.
<Image src='/docs/jupiter/gparted-extend-02.webp' maxWidth='100%' align='left' />

5. In the `New size` field, specify the size of the root filesystem. It is recommended to set at least 16GB (enter `16384`). You can also adjust the size by dragging the top slider. Alternatively, set `Free space following` to `0` to allocate all remaining space to the root filesystem.
<Image src='/docs/jupiter/gparted-extend-03.webp' maxWidth='100%' align='left' />

6. After making the changes, click `Resize`.
<Image src='/docs/jupiter/gparted-extend-04.webp' maxWidth='100%' align='left' />

7. You will now see that the rootfs `/` partition has been resized to 16GB. Click the `checkmark` icon in the menu to apply the changes.
<Image src='/docs/jupiter/gparted-extend-05.webp' maxWidth='100%' align='left' />
A prompt will appear. Select `Apply`.
<Image src='/docs/jupiter/gparted-extend-06.webp' maxWidth='100%' align='left' />

8. After the changes are applied, the final partition layout will appear as follows:
<Image src='/docs/jupiter/gparted-extend-07.webp' maxWidth='100%' align='left' />

## Updating/Re-Flashing U-Boot

### When U-Boot is Available
Coming soon.

### When U-Boot is Unavailable
Coming soon.
140 changes: 140 additions & 0 deletions docs/megrez/getting-started/hardware.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,140 @@
---
sidebar_label: 'Hardware Interface'
sidebar_position: 5
---

# Hardware Interface

<Image src='/docs/megrez/megrez-interface.webp' maxWidth='100%' align='left' />

## Power Interface

The Megrez motherboard supports the following power supply methods:

- DC interface, specification: 5.5*2.5mm, 12V/3A or higher.
- PC standard ATX 24-pin power supply.
- PoE power supply via network port (requires an additional PoE module).

:::tip
The power consumption of the Megrez motherboard depends on the power and number of connected peripherals. Choose the appropriate power supply method based on specific requirements.
:::

## Type-C Interface

- The Type-C interface can be used for flashing or debugging. It allows the installation of system images to the board's `SPI FLASH`, `eMMC module`, or `SATA SSD`.

## F_PANEL Interface

`F_PANEL` stands for `Front Panel` and is a set of pins used to connect the front panel of a standard PC case. It includes signals for `power button`, `reset button`, `power indicator`, and `hard drive activity light`.

:::tip
After powering the Megrez motherboard using one of the methods mentioned in the `Power Interface` section, the board will automatically boot. The `power button` in the `F_PANEL` is used for shutting down or turning the board back on after a shutdown.
:::

<Image src='/docs/jupiter/jupiter-interface-f-panel-1.webp' maxWidth='100%' align='left' />

<Image src='/docs/jupiter/jupiter-interface-f-panel-2.webp' maxWidth='100%' align='left' />

## F_AUDIO, F_USB2, F_USB3 Interfaces

Below is an example of a standard PC case front panel USB and audio expansion board, which includes Audio, USB2.0, and USB3.0 interfaces. You can use the corresponding connectors on the Megrez motherboard to extend USB and audio interfaces to the front panel of the PC case.

:::tip
The Megrez motherboard already has onboard Audio, USB2.0, and USB3.0 interfaces, so the corresponding functions can be used without a PC case.
:::

<Image src='/docs/jupiter/jupiter-interface-f-usb-audio.webp' maxWidth='100%' align='left' />

### F_AUDIO

The F_AUDIO audio interface on the Megrez motherboard is compatible with the AC'97 front audio interface. The pin definitions are as follows:

<Image src='/docs/megrez/megrez-f_audio.webp' maxWidth='100%' align='left' />

<div className='gpio_style'>

| Description | PIN | PIN | Description |
|:------------|:---:|:---:|:------------|
| MIC_IN | 1 | 2 | GND |
| MIC_POWER | 3 | 4 | GND |
| AUDIO_OUT_R | 5 | 6 | RET_R(NC) |
| NC | 7 | | |
| AUDIO_OUT_L | 9 | 10 | RET_L(NC) |

</div>

### F_USB2

The F_USB2 interface on the Megrez motherboard is compatible with standard PC motherboard USB2.0 interfaces. The pin definitions are as follows:

<Image src='/docs/megrez/megrez-f_usb2.webp' maxWidth='100%' align='left' />

<div className='gpio_style'>

| Description | PIN | PIN | Description |
|:------------|:---:|:---:|:------------|
| 5V | 1 | 2 | 5V |
| USB1- | 3 | 4 | USB2- |
| USB1+ | 5 | 6 | USB2+ |
| GND | 7 | 8 | GND |
| | | 10 | GND |

</div>

### F_USB3

The F_USB3 interface on the Megrez motherboard is compatible with standard PC motherboard USB3.0 interfaces. The pin definitions are as follows:

<Image src='/docs/megrez/megrez-f_usb2.webp' maxWidth='100%' align='left' />

<div className='gpio_style'>

| Description | PIN | PIN | Description |
|:------------|:---:|:---:|:------------|
| ID | 1 | 2 | P2-D+ |
| P1-D+ | 3 | 4 | P2-D- |
| P1-D- | 5 | 6 | GND |
| GND | 7 | 8 | P2-SSTX+ |
| P1-SSTX+ | 9 | 10 | P2-SSTX- |
| P1-SSTX- | 11 | 12 | GND |
| GND | 13 | 14 | P2-SSRX+ |
| P1-SSRX+ | 15 | 16 | P2-SSRX- |
| P1-SSRX- | 17 | 18 | Vbus |
| Vbus | 19 | | |

</div>

## Recovery/Normal Boot Toggle Switch

The default boot order for the Megrez motherboard is SPI Flash (U-boot) -> SD/eMMC/SATA.

If the U-boot firmware in the SPI Flash is damaged and cannot boot, you can use the `Recovery/Normal Boot Toggle Switch` to enter recovery mode. In this mode, the Megrez motherboard will load a `temporary U-boot` from USB.

<Image src='/docs/megrez/megrez-recovery-switch.webp' maxWidth='100%' align='left' />

The status definitions are as follows:

| Description | PIN | PIN | Description |
| :------------------------------ | :------: | :----: | :------------------------- |
| Boot from USB U-boot (Temporary) | RECOVERY | NORMAL | Boot from SPI Flash U-boot |

## SATA SEL Toggle Switch

The Megrez motherboard has two SATA hard drive interfaces:

One is the `M.2 SATA SSD interface`, and the other is the `SATA3 hard drive interface`. These two interfaces share the same SATA signal and can be switched using the `SATA SEL Toggle Switch`.

<Image src='/docs/megrez/megrez-sata-sel.webp' maxWidth='100%' align='left' />

## Debug/Download

The Megrez motherboard has a built-in CH340 chip. By default, connecting the Type-C port to a PC enables debugging, and a new device `tty.usbserial-1220` will appear on the PC.

The default serial port parameters for the Megrez motherboard are as follows:
```
baudrate: 115200
data bit: 8
stop bit: 1
parity : none
flow control: none
```
31 changes: 31 additions & 0 deletions docs/megrez/getting-started/resources.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
---
sidebar_label: 'Resource Download'
sidebar_position: 70
---

## Resource Download Summary

## Operating System Image

For instructions on installing the operating system, please refer to: [Installing the Operating System](https://milkv.io/zh/docs/megrez/getting-started/boot).

### Debian/RockOS

RockOS is a Debian-optimized distribution supported and developed by the PLCT Lab, specifically tailored for the EIC77 series chip ecosystem. It has been fully adapted and optimized for ESWIN EIC77 series chips and the SiFive P550 high-performance CPU, with a particular focus on virtualization capabilities. Through deep optimization, RockOS provides efficient support for virtual machines and containers, meeting diverse requirements.

Download Link: Coming Soon

The default password for the `debian` account in Debian/RockOS is `debian`.

### Fedora 41 System (by [Fedora-V Force](https://github.com/fedora-riscv))

The Fedora-V Force (FVF) is a technical team focused on porting and building the Linux kernel and Fedora distribution based on the RISC-V architecture, as well as firmware development. The team is committed to creating a more refined Fedora distribution and promoting the Linux open-source software ecosystem on RISC-V. Team members are from the Fedora community and RISC-V open-source enthusiasts, with years of technical expertise in firmware, U-Boot, the Linux kernel, Fedora, and other foundational software domains. They are also deeply involved in the RISC-V open architecture and its open-source ecosystem. Under the guidance of RISC-V ambassador Wei Fu, the team maintains the largest Fedora on RISC-V compilation system in China, independently compiling multiple Fedora versions from 36 to rawhide, and adapting to all mainstream RISC-V development boards on the market. This has significantly advanced the adoption of RISC-V as a major Fedora architecture. Additionally, the team actively participates in upstreaming open source code, adhering to Fedora's "upstream first" policy.

Download Link: [https://images.fedoravforce.org/Megrez](https://images.fedoravforce.org/Megrez)

The default password for the `root` account in the system is `riscv`.

## Hardware Resource Download

### V1.0
Coming Soon
34 changes: 34 additions & 0 deletions docs/megrez/getting-started/setup.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
---
sidebar_label: 'Setting Up'
sidebar_position: 20
---

# Setting Up

## UART Serial Console

The Megrez board includes a reserved UART debugging serial port, which can be used to view system boot logs or log in to the console after the system has booted to execute terminal commands.

### USB to Serial Cable

The pin definitions of a common USB to TTL serial cable are as follows:

<Image src='/docs/common/usb2ttl.webp' maxWidth='100%' align='left' />

### Connecting the Serial Port

The debugging serial port operates at a 3.3V level. As shown in the diagram below, connect the USB to TTL serial module, but do not connect the red wire.

<div className='gpio_style'>

| Milk-V Megrez | \<---> | USB to TTL Cable |
| :-----------: | :----: | :--------------: |
| GND | \<---> | Black wire |
| RX | \<---> | Green wire (TX) |
| TX | \<---> | White wire (RX) |

</div>

<Image src='/docs/megrez/megrez-ttl.webp' maxWidth='100%' align='left' />

The default serial port parameters for Megrez are as follows:
Loading

0 comments on commit 43d3d90

Please sign in to comment.