-
Notifications
You must be signed in to change notification settings - Fork 49
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
Custom logo #496
base: main
Are you sure you want to change the base?
Custom logo #496
Changes from 11 commits
79070d8
b4ed847
8951203
efe1c29
2f31690
fd2d248
efcf289
e970041
13224ea
eefa306
d7e063a
a3ace4f
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,137 @@ | ||
### 确认 U-boot 是否是 rknext | ||
|
||
由于目前我们只在 rknext 中集成了该功能, 所以需要确认手中板子的 U-boot 是否是 2024 年 10 月份之后的版本, | ||
|
||
可在开机 log 中查看 U-boot 版本 | ||
nascs marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
如: | ||
|
||
```bash | ||
U-Boot SPL latest-2023.07.02-6-4257d241-g4257d241 (Oct 12 2023 - 07:58:46 +0000) | ||
``` | ||
|
||
<Tabs queryString="version"> | ||
<TabItem value="U-boot 是 2024 年 10 月份之前的"> | ||
</TabItem> | ||
<TabItem value="U-boot 是 2024 年 10 月份之后的"> | ||
- 参考 <a href={props.uboot_develop}> U-boot 开发</a>, 编译 rknext 的 U-boot | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @RadxaYuntian 看看这里怎么做区分?集成的产品和未做集成的产品需要怎么看,以及这个时间节点有没必要写? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 这个功能发布了么?发布了是不是每个产品还要单独做支持? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 需要作单独支持吧 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. hdmi也是? |
||
``` | ||
./bsp u-boot rknext -r 99 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 命令不对 |
||
``` | ||
|
||
- 将 {props.product} 的 U-boot 拷贝到板子上 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 直接装生成的deb包 |
||
|
||
<pre style={{ margin: 0 }}> | ||
scp -r .root/.root/usr/lib/u-boot/{props.product_dir}/ [email protected]:~/ | ||
</pre> | ||
|
||
- 在 {props.product} 上执行以下命令以替换最新的 U-boot | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. rsetup安装 |
||
|
||
<pre style={{ margin: 0 }}> | ||
cd {props.product_dir} | ||
sudo bash setup.sh update_bootloader /dev/mmcblk0 | ||
</pre> | ||
|
||
:::tip | ||
|
||
/dev/mmcblk0 这里是 eMMC, 如果系统安装在 SD 卡上, 那就是 /dev/mmcblk1 | ||
如果系统安装在 nvme 等设备上,那就需要更新 SPI Flash 上的 U-boot | ||
|
||
::: | ||
|
||
- 重启系统,确认 U-boot 更新到了最新的 rknext | ||
|
||
</TabItem> | ||
</Tabs> | ||
|
||
### 准备一张或者两张图片 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 什么图片,什么格式的,什么尺寸,什么分辨率的,规格说一下 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. jpg/jpeg/png 格式都行, 为了减少用户麻烦,所以我才写了 convert.py 这个脚本去把用户的图片转成规定的样式 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 直接说明两个图片的用途,这样用户自己知道要用一个还是两个图片 |
||
|
||
:::tip | ||
nascs marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
图片 width \* height 不能超过 200000 | ||
nascs marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
::: | ||
|
||
### 将图片转为 .bmp 格式 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 直接告诉用户需要使用bmp文件。我设计给我出一个Photoshop的psd文件你也能转换么? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 没测试过, 不过 PIL 库应该可以实现的 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 我的意思是,这个不需要写到文档里面。你现在写了pip是不是还要教怎么安装pip,但这些都不需要说明。用户有显示logo这个需求那他肯定是有个图片了,那他自己爱怎么转换怎么转换,我们只需要bmp就好 |
||
|
||
1. 安装所需要的库 | ||
|
||
```bash | ||
pip install Pillow | ||
``` | ||
|
||
2. 新建一个 convert.py 的文件, 将以下内容保存到 convert.py 中 | ||
|
||
<details> | ||
|
||
<summary>convert.py</summary> | ||
|
||
```py | ||
|
||
from PIL import Image | ||
import os | ||
import sys | ||
|
||
class ImageConverter: | ||
def __init__(self, input_path, output_path): | ||
self.input_path = input_path | ||
self.output_path = output_path | ||
self.target_size = 0.5 * 1024 * 1024 # 0.5 MB in bytes (512 KB) | ||
|
||
def convert_to_bmp(self): | ||
with Image.open(self.input_path) as img: | ||
# Convert to RGB since BMP doesn't support transparency | ||
img = img.convert("RGB") | ||
|
||
# Resize the image if the file size exceeds 0.5 MB | ||
img = self.resize_to_fit(img) | ||
|
||
# Save as BMP | ||
img.save(self.output_path, format='BMP') | ||
|
||
def resize_to_fit(self, img): | ||
# Gradually reduce the size of the image until it fits within the target size | ||
while True: | ||
img.save(self.output_path, format='BMP') | ||
if os.path.getsize(self.output_path) <= self.target_size: | ||
break | ||
# Reduce the size by 10% | ||
width, height = img.size | ||
img = img.resize((int(width * 0.9), int(height * 0.9)), Image.ANTIALIAS) | ||
return img | ||
|
||
def main(input_file, output_file): | ||
converter = ImageConverter(input_file, output_file) | ||
converter.convert_to_bmp() | ||
|
||
if __name__ == "__main__": | ||
if len(sys.argv) != 3: | ||
print("Usage: python3 convert_logo.py <input.jpg> <output.bmp>") | ||
else: | ||
main(sys.argv[1], sys.argv[2]) | ||
|
||
``` | ||
|
||
</details> | ||
|
||
3. 将图片转为 .bmp 格式 | ||
|
||
```bash | ||
python3 convert.py pic1.jpg logo.bmp | ||
python3 convert.py pic1.jpg logo_kernel.bmp | ||
``` | ||
|
||
### 将以上两张 bmp 图片保存到 config 分区 | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 有直接在编译的时候打包的方法吗 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 有,不过目前 rsdk 这部分功能还没有集成,另外,要在 rsdk 中替换图片,也是要转成规定样式的。 |
||
```bash | ||
sudo mount /dev/mmcblk0p1 /mnt/ | ||
sudo cp logo.bmp /mnt/ | ||
sudo cp logo_kernel.bmp /mnt/ | ||
sudo sync /mnt | ||
sudo umount /mnt | ||
``` | ||
|
||
### 重启系统 | ||
|
||
连接 HDMI 后,系统重新启动,HDMI 将显示刚设定的 logo,直至桌面出现。 |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
--- | ||
sidebar_position: 8 | ||
--- | ||
|
||
import LOGO from '../../../common/dev/\_custom_logo.mdx'; | ||
|
||
# 定制开机 Logo | ||
|
||
<LOGO uboot_develop="../u-boot" product="Radxa ROCK 3A" product_dir="rock-3a" /> |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
--- | ||
sidebar_position: 8 | ||
--- | ||
|
||
import LOGO from '../../../common/dev/\_custom_logo.mdx'; | ||
|
||
# 定制开机 Logo | ||
|
||
<LOGO uboot_develop="../u-boot" product="Radxa ROCK 3B" product_dir="rock-3b" /> |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,139 @@ | ||
### Verify that the U-boot is rknext | ||
|
||
Since we have only integrated this feature in rknext, you need to check if the U-boot on your board is from October 2024 onwards. | ||
|
||
U-boot version can be viewed in the boot log | ||
|
||
For example: | ||
|
||
```bash | ||
U-Boot SPL latest-2023.07.02-6-4257d241-g4257d241 (Oct 12 2023 - 07:58:46 +0000) | ||
``` | ||
|
||
<Tabs queryString="version"> | ||
<TabItem value="U-boot is before October 2024."> | ||
</TabItem> | ||
<TabItem value="U-boot is after October 2024."> | ||
- Refer to <a href={props.uboot_develop}> U-boot development</a> to compile rknext's U-boot. | ||
|
||
``` | ||
./bsp u-boot rknext -r 99 | ||
``` | ||
|
||
- Copy the U-boot of {props.product} to the board | ||
|
||
<pre style={{ margin: 0 }}> | ||
scp -r .root/.root/usr/lib/u-boot/{props.product_dir}/ [email protected]:~/ | ||
</pre> | ||
|
||
- Execute the following command on {props.product} to replace the latest U-boot | ||
|
||
<pre style={{ margin: 0 }}> | ||
cd {props.product_dir} | ||
sudo bash setup.sh update_bootloader /dev/mmcblk0 | ||
</pre> | ||
|
||
sh setup.sh update_bootloader /dev/mmcblk0{" "} | ||
|
||
:::tip | ||
|
||
/dev/mmcblk0 is eMMC, or /dev/mmcblk1 if the system is installed on an SD card. | ||
If the system is installed on a device such as nvme, then you need to update the U-boot on the SPI Flash | ||
|
||
::: | ||
|
||
- Reboot the system and make sure the U-boot is updated to the latest rknext. | ||
|
||
</TabItem> | ||
</Tabs> | ||
|
||
### Prepare one or two images | ||
|
||
:::tip | ||
|
||
Image width \* height must not exceed 200000 | ||
|
||
::: | ||
|
||
### Convert the image to .bmp format | ||
|
||
1. Install the required libraries | ||
|
||
```bash | ||
pip install Pillow | ||
``` | ||
|
||
2. Create a new convert.py file and save the following to convert.py | ||
|
||
<details> | ||
|
||
<summary>convert.py</summary> | ||
|
||
```py | ||
|
||
from PIL import Image | ||
import os | ||
import sys | ||
|
||
class ImageConverter: | ||
def __init__(self, input_path, output_path): | ||
self.input_path = input_path | ||
self.output_path = output_path | ||
self.target_size = 0.5 * 1024 * 1024 # 0.5 MB in bytes (512 KB) | ||
|
||
def convert_to_bmp(self): | ||
with Image.open(self.input_path) as img: | ||
# Convert to RGB since BMP doesn't support transparency | ||
img = img.convert("RGB") | ||
|
||
# Resize the image if the file size exceeds 0.5 MB | ||
img = self.resize_to_fit(img) | ||
|
||
# Save as BMP | ||
img.save(self.output_path, format='BMP') | ||
|
||
def resize_to_fit(self, img): | ||
# Gradually reduce the size of the image until it fits within the target size | ||
while True: | ||
img.save(self.output_path, format='BMP') | ||
if os.path.getsize(self.output_path) <= self.target_size: | ||
break | ||
# Reduce the size by 10% | ||
width, height = img.size | ||
img = img.resize((int(width * 0.9), int(height * 0.9)), Image.ANTIALIAS) | ||
return img | ||
|
||
def main(input_file, output_file): | ||
converter = ImageConverter(input_file, output_file) | ||
converter.convert_to_bmp() | ||
|
||
if __name__ == "__main__": | ||
if len(sys.argv) != 3: | ||
print("Usage: python3 convert_logo.py <input.jpg> <output.bmp>") | ||
else: | ||
main(sys.argv[1], sys.argv[2]) | ||
|
||
``` | ||
|
||
</details> | ||
|
||
3. Converting images to .bmp format | ||
|
||
```bash | ||
python3 convert.py pic1.jpg logo.bmp | ||
python3 convert.py pic1.jpg logo_kernel.bmp | ||
``` | ||
|
||
### Save the above two bmp images to the config partition | ||
|
||
```bash | ||
sudo mount /dev/mmcblk0p1 /mnt/ | ||
sudo cp logo.bmp /mnt/ | ||
sudo cp logo_kernel.bmp /mnt/ | ||
sudo sync /mnt | ||
sudo umount /mnt | ||
``` | ||
|
||
### Reboot System | ||
|
||
After connecting the HDMI, the system will reboot and the HDMI will display the logo you just set until the desktop appears. |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
--- | ||
sidebar_position: 8 | ||
--- | ||
|
||
import LOGO from '../../../common/dev/\_custom_logo.mdx'; | ||
|
||
# Customized Boot Logo | ||
|
||
<LOGO uboot_develop="../u-boot" product="Radxa ROCK 3A" product_dir="rock-3a" /> |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
--- | ||
sidebar_position: 8 | ||
--- | ||
|
||
import LOGO from '../../../common/dev/\_custom_logo.mdx'; | ||
|
||
# Customized Boot Logo | ||
|
||
<LOGO uboot_develop="../u-boot" product="Radxa ROCK 3B" product_dir="rock-3b" /> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
rknext是什么,需要解释,比如
当前该功能只在rknext分支集成,请切换到rknext
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
现在应该是rk2410版本才有支持,rknext是没有的