Skip to content
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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@ build/
.xmake/
rootfs/
.vscode/
private/
18 changes: 18 additions & 0 deletions apps/cpp/main.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
/*
* Copyright (c) 2006-2018, RT-Thread Development Team
*
* SPDX-License-Identifier: GPL-2.0
*
* Change Logs:
* Date Author Notes
* 2020-10-20 Bernard The first version
*/

#include <iostream>
using namespace std;

int main()
{
cout << "Hello, World!" << endl;
return 0;
}
30 changes: 30 additions & 0 deletions apps/cpp/xmake.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
-- Licensed under the Apache License, Version 2.0 (the "License");
-- You may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
--
-- Copyright (C) 2022-2023 RT-Thread Development Team
--
-- @author zhouquan
-- @file xmake.lua
--
-- Change Logs:
-- Date Author Notes
-- ------------ ---------- -----------------------------------------------
-- 2023-03-10 zhouquan initial version
--
add_rules("mode.debug", "mode.release")

target("cpp")
do
add_rules("rt.cpp")
add_files("*.cpp")
end
target_end()
6 changes: 0 additions & 6 deletions prebuilt/qemu-vexpress-a9/qemu-nographic.bat

This file was deleted.

Binary file removed prebuilt/qemu-vexpress-a9/rtthread.bin
Binary file not shown.
149 changes: 0 additions & 149 deletions prebuilt/qemu-virt64-aarch64-ext4/README.md

This file was deleted.

7 changes: 0 additions & 7 deletions prebuilt/qemu-virt64-aarch64-ext4/qemu.sh

This file was deleted.

Binary file removed prebuilt/qemu-virt64-aarch64-ext4/rtthread.bin
Binary file not shown.
Binary file added prebuilt/qemu-virt64-aarch64/rtthread.bin
Binary file not shown.
26 changes: 26 additions & 0 deletions prebuilt/qemu-virt64-aarch64/run.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#!/bin/bash

# @author zhouquan
# @file run.sh
#
# Change Logs:
# Date Author Notes
# ------------ ---------- -----------------------------------------------
# 2023-01-12 zhouquan initial version
#

script_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"

qemu-system-aarch64 \
-M virt,gic-version=2 \
-cpu cortex-a53 \
-m 128M \
-kernel ${script_dir}/rtthread.bin \
-nographic \
-drive if=none,file=${script_dir}/ext4.img,format=raw,id=blk0 \
-device virtio-blk-device,drive=blk0,bus=virtio-mmio-bus.0 \
-netdev user,id=net0,hostfwd=tcp::8080-:80 \
-device virtio-net-device,netdev=net0,bus=virtio-mmio-bus.1 \
-device virtio-serial-device \
-chardev socket,host=127.0.0.1,port=43211,server=on,wait=off,telnet=on,id=console0 \
-device virtserialport,chardev=console0
28 changes: 28 additions & 0 deletions prebuilt/qemu-virt64-aarch64/run_debug.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#!/bin/bash

# @author zhouquan
# @file run.sh
#
# Change Logs:
# Date Author Notes
# ------------ ---------- -----------------------------------------------
# 2023-01-12 zhouquan initial version
#

script_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"

qemu-system-aarch64 \
-M virt,gic-version=2 \
-cpu cortex-a53 \
-m 128M \
-kernel ${script_dir}/rtthread.bin \
-nographic \
-drive if=none,file=${script_dir}/ext4.img,format=raw,id=blk0 \
-device virtio-blk-device,drive=blk0,bus=virtio-mmio-bus.0 \
-netdev user,id=net0,hostfwd=tcp::8080-:80 \
-device virtio-net-device,netdev=net0,bus=virtio-mmio-bus.1 \
-device virtio-serial-device \
-chardev socket,host=127.0.0.1,port=43211,server=on,wait=off,telnet=on,id=console0 \
-device virtserialport,chardev=console0 \
-S \
-gdb tcp::1234
9 changes: 0 additions & 9 deletions prebuilt/qemu-virt64-riscv/qemu-nographic.bat

This file was deleted.

11 changes: 0 additions & 11 deletions prebuilt/qemu-virt64-riscv/qemu-nographic.sh

This file was deleted.

Binary file modified prebuilt/qemu-virt64-riscv/rtthread.bin
100644 → 100755
Binary file not shown.
25 changes: 25 additions & 0 deletions prebuilt/qemu-virt64-riscv/run.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#!/bin/bash

# @author zhouquan
# @file run.sh
#
# Change Logs:
# Date Author Notes
# ------------ ---------- -----------------------------------------------
# 2023-01-12 zhouquan initial version
#

script_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"

qemu-system-riscv64 \
-nographic \
-machine virt \
-m 256M \
-kernel ${script_dir}/rtthread.bin \
-drive if=none,file=${script_dir}/ext4.img,format=raw,id=blk0 \
-device virtio-blk-device,drive=blk0,bus=virtio-mmio-bus.0 \
-netdev user,id=tap0,hostfwd=tcp::8080-:80 \
-device virtio-net-device,netdev=tap0,bus=virtio-mmio-bus.1 \
-device virtio-serial-device \
-chardev socket,host=127.0.0.1,port=43212,server=on,wait=off,telnet=on,id=console0 \
-device virtserialport,chardev=console0
27 changes: 27 additions & 0 deletions prebuilt/qemu-virt64-riscv/run_debug.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#!/bin/bash

# @author zhouquan
# @file run.sh
#
# Change Logs:
# Date Author Notes
# ------------ ---------- -----------------------------------------------
# 2023-01-12 zhouquan initial version
#

script_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"

qemu-system-riscv64 \
-nographic \
-machine virt \
-m 256M \
-kernel ${script_dir}/rtthread.bin \
-drive if=none,file=${script_dir}/ext4.img,format=raw,id=blk0 \
-device virtio-blk-device,drive=blk0,bus=virtio-mmio-bus.0 \
-netdev user,id=tap0,hostfwd=tcp::8080-:80 \
-device virtio-net-device,netdev=tap0,bus=virtio-mmio-bus.1 \
-device virtio-serial-device \
-chardev socket,host=127.0.0.1,port=43212,server=on,wait=off,telnet=on,id=console0 \
-device virtserialport,chardev=console0 \
-S \
-gdb tcp::1234
1 change: 1 addition & 0 deletions prebuilt/sha1sum.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
https://github.com/RT-Thread/rt-thread: 3e4797c63c43384825d63166966289bb60b6be78
10 changes: 5 additions & 5 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,21 +71,21 @@ xmake 是一个基于 Lua 的轻量级跨平台构建工具,使用 xmake.lua

5. **镜像制作**

运行 `xmake smart-rootfs` 制作 rootfs ,运行 `xmake smart-image` 制作镜像
运行 `xmake smart-rootfs --no-symlink` 制作 rootfs ,运行 `xmake smart-image` 制作镜像

```shell
xmake smart-rootfs
xmake smart-image -o ../prebuilt/qemu-virt64-aarch64-ext4/ext4.img # 将镜像输出至 qemu-virt64-aarch64-ext4 目录
xmake smart-rootfs --no-symlink # 制作无符号链接的rootfs
xmake smart-image -o ../prebuilt/qemu-virt64-aarch64/ext4.img # 将镜像输出至 qemu-virt64-aarch64 目录
```

![image-20230531173829621](./assets/image-20230531173829621.png)

6. **运行 qemu**

进入 `userapp/prebuilt/qemu-virt64-aarch64-ext4`,运行 qemu.sh 脚本启动 qemu
进入 `userapp/prebuilt/qemu-virt64-aarch64`,运行 qemu.sh 脚本启动 qemu

```shell
cd prebuilt/qemu-virt64-aarch64-ext4/
cd prebuilt/qemu-virt64-aarch64/
./qemu.sh
```

Expand Down
4 changes: 2 additions & 2 deletions repo/packages/a/aarch64-smart-musleabi/xmake.lua
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,12 @@ do
if is_host("windows") then
add_urls("http://117.143.63.254:9012/www/rt-smart/aarch64-linux-musleabi_for_i686-w64-mingw32_$(version).zip")

add_versions("176897", "0a0c332cc32ef6faae6cac81aace6c223aa9b30e76363c649c17c7d2ac6cd9ee")
add_versions("179715", "c402a27e7a40ce274b76214b57c3857b3583ced2872415b2db77657ba933a350")
elseif is_host("linux") then
add_urls(
"http://117.143.63.254:9012/www/rt-smart/aarch64-linux-musleabi_for_x86_64-pc-linux-gnu_$(version).tar.bz2")

add_versions("176897", "3c2fb82661e9b3206dcbb3b8f2768011acd1c23e12dfa163d934ba378a645b5b")
add_versions("179715", "9267551aed0d3432149ed1d672582d1c5a300e6e780250feda20299d650c5202")
end

on_install("@windows", "@linux|x86_64", function(package)
Expand Down
Loading