UBUNTU frame buffer 数码相框 显示器分辨率改为1024x768 24位

http://forum.ubuntu.org.cn/viewtopic.php?t=269452


当显示花屏时,主要是由于分辨率不正确,一般的frame buffer显示需要的分辨率为1024x768 24位的,所以可用以下方法修改成1024x768 24的分辨率。

(1)安装所需包:
sudo apt-get install v86d hwinfo
(2)查看framebuffer
sudo hwinfo --framebuffer

我的显示器分辨率是1344x768的,我需要的是:1024x768-24

如果已经有1024x768-24,则不需要按照下面的步骤修改了

(3)修改grub文件
sudo gedit /etc/default/grub


-------------------------------------------------------------------------------------------------------------------
# If you change this file, run 'update-grub' afterwards to update
# /boot/grub/grub.cfg.

GRUB_DEFAULT=0
GRUB_HIDDEN_TIMEOUT=0
GRUB_HIDDEN_TIMEOUT_QUIET=true
GRUB_TIMEOUT=10
GRUB_DISTRIBUTOR=`lsb_release -i -s 2> /dev/null || echo Debian`

#need to add this line####################################################
GRUB_CMDLINE_LINUX_DEFAULT="quiet splash nomodeset video=uvesafb:mode_option=1024x768-24,mtrr=3,scroll=ywrap"
#add end     #############################################################


GRUB_CMDLINE_LINUX=""

# Uncomment to disable graphical terminal (grub-pc only)
#GRUB_TERMINAL=console

# The resolution used on graphical terminal
# note that you can use only modes which your graphic card supports via VBE
# you can see them in real GRUB with the command `vbeinfo'
#GRUB_GFXMODE=1280x800

# Uncomment if you don't want GRUB to pass "root=UUID=xxx" parameter to Linux
#GRUB_DISABLE_LINUX_UUID=true

# Uncomment to disable generation of recovery mode menu entries
#GRUB_DISABLE_LINUX_RECOVERY="true"

# Uncomment to get a beep at grub start
#GRUB_INIT_TUNE="480 440 1"
-------------------------------------------------------------------------------------------------------------------


(4)修改initramfs:
sudo gedit /etc/initramfs-tools/modules


-------------------------------------------------------------------------------------------------------------------
# List of modules that you want to include in your initramfs.
#
# Syntax: module_name [args ...]
#
# You must run update-initramfs(8) to effect this change.
#
# Examples:
#
# raid1
# sd_mod
##############################need to add this line###
uvesafb mode_option=1024x768-24 mtrr=3 scroll=ywrap
############################# add end##############
-------------------------------------------------------------------------------------------------------------------


(5)强制使用Framebuffer:
echo FRAMEBUFFER=y | sudo tee /etc/initramfs-tools/conf.d/splash
(6)更新grub和initramfs:
sudo update-grub2
sudo update-initramfs -u
(7)重启


### Ubuntu 系统中无法修改显示器分辨率的解决方案 在Ubuntu系统中,如果遇到无法修改显示器分辨率的问题,通常与显卡驱动、Xorg配置文件或显示管理器设置有关。以下是针对该问题的详细解决方案。 #### 1. 检查显卡驱动是否正确安装 确保系统的显卡驱动已正确安装并启用。对于NVIDIA显卡用户,可以通过以下命令检查驱动状态: ```bash lspci | grep -i nvidia ``` 如果发现驱动未正确安装,可以尝试重新安装适合的驱动程序。例如,安装最新的NVIDIA驱动: ```bash sudo add-apt-repository ppa:graphics-drivers/ppa sudo apt update sudo apt install nvidia-driver-<version> ``` 其中`<version>`为具体驱动版本号[^1]。 #### 2. 添加自定义分辨率 如果系统中缺少所需的分辨率选项,可以使用`xrandr`工具手动添加。首先列出当前连接的显示器及其支持的分辨率: ```bash xrandr --query ``` 然后通过`cvt`命令生成新的模式行: ```bash cvt <width> <height> <refresh_rate> ``` 例如,生成一个1920x1080分辨率的模式行: ```bash cvt 1920 1080 60 ``` 将输出中的模式行复制,并通过以下命令添加到显示器: ```bash xrandr --newmode "1920x1080_60.00" 173.00 1920 2048 2248 2576 1080 1083 1088 1120 -hsync +vsync xrandr --addmode <output_name> "1920x1080_60.00" ``` 最后应用新分辨率: ```bash xrandr --output <output_name> --mode "1920x1080_60.00" ``` 其中`<output_name>`是`xrandr --query`命令中显示的输出设备名称[^2]。 #### 3. 配置Xorg以保存分辨率设置 为了使自定义分辨率永久生效,需要编辑或创建Xorg配置文件。进入`/etc/X11/xorg.conf.d/`目录: ```bash sudo nano /etc/X11/xorg.conf.d/10-monitor.conf ``` 在文件中添加以下内容: ```conf Section "Monitor" Identifier "<monitor_name>" Modeline "1920x1080_60.00" 173.00 1920 2048 2248 2576 1080 1083 1088 1120 -hsync +vsync Option "PreferredMode" "1920x1080_60.00" EndSection Section "Screen" Identifier "<screen_name>" Monitor "<monitor_name>" DefaultDepth 24 SubSection "Display" Modes "1920x1080_60.00" EndSubSection EndSection ``` 保存文件后重启系统以应用更改。 #### 4. 调整双屏设置 对于双屏环境,确保主屏幕和副屏幕的分辨率置设置正确。可以通过以下命令打开显示设置界面: ```bash gnome-control-center display ``` 调整主屏幕和副屏幕的分辨率、刷新率及相对置。如果图形界面无法解决问题,可直接使用`xrandr`命令进行精确配置。 --- ### 示例代码 以下是一个完整的脚本示例,用于添加自定义分辨率并应用: ```bash #!/bin/bash # 创建新模式 xrandr --newmode "1920x1080_60.00" 173.00 1920 2048 2248 2576 1080 1083 1088 1120 -hsync +vsync # 将新模式添加到输出设备 xrandr --addmode HDMI-1 "1920x1080_60.00" # 应用新模式 xrandr --output HDMI-1 --mode "1920x1080_60.00" ``` ---
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值