Skip to content

Commit

Permalink
Automatically detect and set correct panel cmdline
Browse files Browse the repository at this point in the history
This script will find the value given by the kernel with get_panel_maker_id

	LCD_RENESAS_LGD = 0,
	LCD_RENESAS_JDI = 1

The lcd_maker_id value is generated from the panel hardware, is always accurate and will always set the correct cmdline of your panel

This script can also simply be copy pasted for a kernel zip in loki.sh before the loki function. It has no other requirements besides the script itself since it directly searches and modifies the boot.img and doesn't require the boot.img to be unpacked.

Do not shorten the search function as we need to ensure only the cmdline is being changed and nothing in the actual kernel source.

Continue building the kernel with either the full lgd or jdi cmdline, the script will change the panel as needed.

Currently the script looks for the extracted boot.img in /tmp and /tmp/loki

Signed-off-by: dr87 <nb00870@gmail.com>
  • Loading branch information
dr87 committed Jun 30, 2014
1 parent 5985d29 commit 58feacb
Showing 1 changed file with 42 additions and 2 deletions.
44 changes: 42 additions & 2 deletions releasetools/loki.sh
Original file line number Diff line number Diff line change
@@ -1,10 +1,50 @@
#!/sbin/sh
#
# This leverages the loki_patch utility created by djrbliss which allows us
# to bypass the bootloader checks on jfltevzw and jflteatt
# This leverages the loki_patch utility created by djrbliss
# See here for more information on loki: https://github.com/djrbliss/loki
#


# 4.4 Kernel - Panel Detection - dr87
#
# Detect panel and swap as necessary
# lcd_maker_id is determined by get_panel_maker_id on the hardware and is always accurate
# This searches directly in the boot.img and has no other requirements
# Do not shorten the search or you may change the actual kernel source
#
# LCD_RENESAS_LGD = 0,
# LCD_RENESAS_JDI = 1

# Search the two common locations to extract boot.img for loki
#
# Search for boot.img in /tmp/loki

lcdmaker=$(grep -c "lcd_maker_id=1" /proc/cmdline)
if [ $lcdmaker == 1 ]; then
echo "JDI panel detected"
find /tmp/loki/boot.img -type f -exec sed -i 's/console=ttyHSL0,115200,n8 androidboot.hardware=g2 user_debug=31 msm_rtb.filter=0x0 mdss_mdp.panel=1:dsi:0:qcom,mdss_dsi_g2_lgd_cmd/console=ttyHSL0,115200,n8 androidboot.hardware=g2 user_debug=31 msm_rtb.filter=0x0 mdss_mdp.panel=1:dsi:0:qcom,mdss_dsi_g2_jdi_cmd/g' {} \;
elif [ $lcdmaker == "0" ]; then
echo "LGD panel detected"
find /tmp/loki/boot.img -type f -exec sed -i 's/console=ttyHSL0,115200,n8 androidboot.hardware=g2 user_debug=31 msm_rtb.filter=0x0 mdss_mdp.panel=1:dsi:0:qcom,mdss_dsi_g2_jdi_cmd/console=ttyHSL0,115200,n8 androidboot.hardware=g2 user_debug=31 msm_rtb.filter=0x0 mdss_mdp.panel=1:dsi:0:qcom,mdss_dsi_g2_lgd_cmd/g' {} \;
else
echo "lcd_maker_id doesn't exist. Something went wrong."
fi

# Search for boot.img in /tmp

lcdmaker=$(grep -c "lcd_maker_id=1" /proc/cmdline)
if [ $lcdmaker == 1 ]; then
echo "JDI panel detected"
find /tmp/boot.img -type f -exec sed -i 's/console=ttyHSL0,115200,n8 androidboot.hardware=g2 user_debug=31 msm_rtb.filter=0x0 mdss_mdp.panel=1:dsi:0:qcom,mdss_dsi_g2_lgd_cmd/console=ttyHSL0,115200,n8 androidboot.hardware=g2 user_debug=31 msm_rtb.filter=0x0 mdss_mdp.panel=1:dsi:0:qcom,mdss_dsi_g2_jdi_cmd/g' {} \;
elif [ $lcdmaker == "0" ]; then
echo "LGD panel detected"
find /tmp/boot.img -type f -exec sed -i 's/console=ttyHSL0,115200,n8 androidboot.hardware=g2 user_debug=31 msm_rtb.filter=0x0 mdss_mdp.panel=1:dsi:0:qcom,mdss_dsi_g2_jdi_cmd/console=ttyHSL0,115200,n8 androidboot.hardware=g2 user_debug=31 msm_rtb.filter=0x0 mdss_mdp.panel=1:dsi:0:qcom,mdss_dsi_g2_lgd_cmd/g' {} \;
else
echo "lcd_maker_id doesn't exist. Something went wrong."
fi

# Loki

export C=/tmp/loki_tmpdir

mkdir -p $C
Expand Down

1 comment on commit 58feacb

@RenderBroken
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for Sharing!!

Please sign in to comment.