View: 29219|Reply: 6

HowTo: Setting up resolution 1280x1024 (HDMI-DVI) on H3 boards.

[Copy link]

2

threads

3

posts

66

credits

Registered member

Rank: 2

credits
66
Published in 2016-7-9 00:19:06 | Show all floors |Read mode
Edited by markusp at 2016-7-9 02:22

Linux Kernel is always under developing. Armbian includes common kernel patches. Author of Armbian provides easy-to-use system for building custom kernels and completely OS distributions. At this moment only "legacy-kernel" provides basic support for H3 SoC - accelerated video, audio drivers.

For setting custom video resolution you need:
  •         to patch kernel sources
  •         compile kernel
  •         install new kernel into target OS


Unfortunately, for realizing these simple steps, we must pass 7 circles of hell.

As described in http://docs.armbian.com/Developer-Guide_Build-Preparation/:

1. Setup VirtualBox.
For kernel compilation 10 Gb virtual drive is enough. Also Network Adapter must be set to "Bridged Adapter", for accessing VM through Samba and SSH.

2. Get base Ubuntu OS
Download Ubuntu Trusty 14.04 mini.iso, boot and install base system to VM.
http://archive.ubuntu.com/ubuntu ... es/netboot/mini.iso

3. Login as root to your VM's Ubuntu.
For enabling root account, set root password:  
https://www.server-world.info/en ... &p=initial_conf&f=2 :   sudo passwd root

4. Install samba and ssh-server.
http://help.ubuntu.ru/wiki/samba.
to grant access to the whole rootfs add the following lines to your /etc/samba/smb.conf and restart service:

   [root]
      path = /
      guest ok = yes
      browseable = yes
      read only = no


   sudo service smbd restart

Setup dropbear for SSH connection https://www.howtoinstall.co/en/ubuntu/trusty/dropbear
   sudo update-rc.d dropbear defaults
   sudo service dropbear start

now you can:  
   connect to your VM using any ssh client (dbclient root@ubuntu)
   open VM's rootfs as a network share.

5. Download Armbian build system and kernel sources.


   mkdir /root/armbian
   cd /root/armbian
   apt-get -y -qq install git
   git clone --depth 1 https://github.com/igorpecovnik/lib
   cp lib/compile.sh .

6. Making patches
Kernel sources are in ./sources/linux-sun8i/sun8i
You need make changes to 4 files, but make changes directly to the kernel source is not allowed by default. Because compilation scripts will revert all changes  . So we need make patches:

copy original files elsewhere:

   mkdir -p respatch/a
   cd ./sources/linux-sun8i/sun8i
   cp --parents drivers/video/sunxi/disp/de/disp_display.c ../../../respatch/a
   cp --parents drivers/video/sunxi/disp2/disp/de/disp_display.c ../../../respatch/a
   cp --parents drivers/video/sunxi/disp2/hdmi/aw/hdmi_core.c ../../../respatch/a
   cp --parents drivers/video/sunxi/disp2/hdmi/aw/hdmi_edid.c ../../../respatch/a
   cd ../../../respatch
   cp -r a b

Now edit 4 files under b/ directory. As described here https://github.com/dni1337/Orang ... 460b8586276d20e8fb6
   b/drivers/video/sunxi/disp/de/disp_display.c
   b/drivers/video/sunxi/disp2/disp/de/disp_display.c
   b/drivers/video/sunxi/disp2/hdmi/aw/hdmi_core.c
   b/drivers/video/sunxi/disp2/hdmi/aw/hdmi_edid.c

For example in first file disp_display.c goto line ~726 (approximately), find line similar to shown and make changes marked with green color. Then goto line ~780 replace values, save changes and close file. Now change other 3 files.make patch:
make sure you are in respatch directory, run:

   diff -ur a b > res-1280x1024.patch
   cd ..

copy patch to patches dir:
   cp respatch/res-1280x1024.patch lib/patch/kernel/sun8i-default

7. Compilation

   ./compile.sh

Select what to build: "Kernel, U-boot and other packages"
Select one of supported boards: "your board"
Select one of supported kernels: "default 3.4.x - 3.14.x legacy"

First compilation may takes hour or two, second - 10-20 min.

When finished move all *.dep packages from output/debs to the flash drive or directly to boot device.

all other stuffs going on board's system itself...

8. Install new packages
Boot Armbian as usual, login and run:

   h3disp -m 5 -d

(http://forum.armbian.com/index.p ... -devices/#entry5676)

Insert flash drive, navigate deb packages and install all of them:

   sudo dpkg -i *.deb

9. Edit script.fex


  cd /boot
   bin2fex script.bin script.fex

As mentioned here by dni http://www.orangepi.org/orangepi ... 475&page=5#pid7126. Open script.fex in the text editor, search for pll_video and (for 1280x1024) change it's value  to:

   pll_video = 432

save file and convert it to bin


   fex2bin script.fex script.bin

10. Change default soundcard.
On Debian Jessie default sound card is hdmisnd. But if you are using HDMI-DVI or HDMI monitor without speakers, you may want to use analog audio output by default. Replace all "card 1" to "card 0" in /etc/asound.conf.

11. reboot


Following https://github.com/dni1337/OrangePI-Kernel/commits/master it is possible to change resolution to 1024x768. In this case you need right value of pll_video. In other cases you'll need pll_video and correct parameters for hdmi_core.c.


3

threads

54

posts

1385

credits

Gold member

Rank: 6Rank: 6

credits
1385
Published in 2016-7-9 00:25:42 | Show all floors
It seems kinda quiet around here, so figured I would at least thank you for your participation here and your contribution to this forum

While Xunlong seems to not want to pay any attention anymore, there still are some people out here who do and appreciate you giving back to the community!

Cheers!

2

threads

3

posts

66

credits

Registered member

Rank: 2

credits
66
 Author| Published in 2016-7-9 02:05:32 | Show all floors
Edited by markusp at 2016-7-9 02:21

thanks!

what about pll_video and hdmi_core parameters?
how these parameters are defined?
how can we force the kernel to read these parameters from an external text file

2

threads

3

posts

66

credits

Registered member

Rank: 2

credits
66
 Author| Published in 2016-7-20 01:13:15 | Show all floors
Edited by markusp at 2016-7-20 17:11

Ok, so i found a way to get parameters important for setting any custom resolution.

First you'll need get Modeline for your resolution:

go to https://www.mythtv.org/wiki/Modeline_Database (Database of standard modelines) and look your monitor resolution. For example 1440x900 60 Hz. Copy full Modeline string:


ModeLine "1440x900" 108.84 1440 1472 1880 1912 900 918 927 946 +HSync +VSync

now go to http://www.epanorama.net/faq/vga2rgb/calc.html (Calculator for video timings. Copyright Tomi Engdahl 1998-2006) and paste it to first input box, click "Import Modeline".


Ok. So now you have all necessary values for hdmi_core.c:

VIC

PCLK0,108840000 Pixel clock frequency (108.84*1000000)
AVI_PR 0
X 1440 Resolution
Y 900 Resolution
HT 1912 Horizontal total pixels = X+HBP+HFP+HST (1440+32+32+408)
HBP 32 Back porch
HFP 32 Front porch
HST 408 Sync pulse
VT 946 Vertical total pixels = Y+VBP+VFP+VST (900+19+18+9)
VBP 19 Back porch
VFP 18 Front porch
VST 9 Sync pulse
h_pol1 Horizontal polarity
v_pol 1 Vertical polarity
int 0
vac 0
trd 0

Now you steel need value of PLL_VIDEO (phase-locked loops), but like wondered  roger_gz http://www.orangepi.org/orangepibbsen/forum.php?mod=viewthread&tid=475&page=5#pid7142

"PLL video equals to the Pixel clock*4".

So for 1440x900 you can try 108.84*4 ~= 435.

All you'll need is integrate new mode through proper patch.


9

threads

634

posts

4427

credits

Moderator

Rank: 7Rank: 7Rank: 7

credits
4427
Published in 2016-7-20 18:09:27 | Show all floors
Edited by igorpec at 2016-7-20 11:10

We also have requests / pleads for new video modes,
https://github.com/igorpecovnik/lib/issues/222
https://github.com/igorpecovnik/lib/issues/323
but not enough resources to take care ...

If one can provide a patch to close those issues, I can provide a board as a tiny compensation / motivation.

0

threads

3

posts

30

credits

Novice

Rank: 1

credits
30
Published in 2016-7-26 13:29:31 | Show all floors
Looks like zldo has just uploaded a patch yesterday, see https://github.com/igorpecovnik/lib/issues/323 again
I haven't tried it, but am using it as reference. It looks like the most complete of anything I've found.

2

threads

20

posts

283

credits

Intermediate member

Rank: 3Rank: 3

credits
283
Published in 2016-9-15 02:46:10 | Show all floors
Hi,

is there a way to apply this procedure to a Android image ? I need a working Android image with supported 16:10 resolution.
You need to log in before you can reply login | Register

Points Rule

Quick reply Top Return list