📄 cropram.sh
字号:
#!/bin/shecho This script helps you set/check the correct parameters to reserveecho the top of physical memory for osdbuf and/or yuvbuf.echo#if [ $UID != 0 ]; then echo Run this script as root.; exit -1; fi#if [ -z "$1" ]; then echo Give as first parameters how much you want to reserve in bytes.; exit -1; fi#BIOSRAMMAP=`grep -n "kernel: BIOS-provided physical RAM map:" /var/log/messages |tail -1 |cut -d: -f1`if [ -z "$BIOSRAMMAP" ]; then echo Cannot parse log files: cannot proceed.; exit -1; fi## has this already been run?#USERRAMMAP=`grep -n "Kernel command line:" /var/log/messages |grep cropram=done |tail -1 |cut -d: -f1`if [ "$USERRAMMAP" ]; then if [ $USERRAMMAP -gt $BIOSRAMMAP ]; then LI=`tail +$USERRAMMAP /var/log/messages |head -1` echo DETECTED CROPPED MEMORY. echo echo Your logs say ---$LI--- echo echo Run sh insmod_osdbuf.sh or directly: echo cat insmod_osdbuf.sh exit 0 fifi#echo NO TOP MEMORY IS ACTUALLY RESERVED FOR OSDBUF/YUVBUF.echo## ``mem='' parameters does not specify an absolute physical offset but the total# amount of bytes. ## Because, usually, a PC has unusable hole in the range [0x9fc00,0x100000[# (0x60400 bytes) saying mem=Q will make linux actually use addresses up to Q+0x60400# and ruin our plans.## So: we rectify the RESERVEOFFSET. Let's be conservative: waste one meg :-(#HOLES=$[1024*1024]#LI=`tail +$[$BIOSRAMMAP+2] /var/log/messages |grep "\(usable\)"`#echo Your logs say ---$LI---echoHEXTOP=`echo $LI |cut -d: -f5 |tr '(' '-' |cut -d- -f2 |tr -d ' '`echo PROPOSITION:RESERVEOFFSET=$[(0x$HEXTOP-$1)/0x1000*0x1000]HEXRESERVEOFFSET=`printf "%08x" $RESERVEOFFSET`HEXRECTIFIEDOFFSET=`printf "%08x" $[$RESERVEOFFSET-$HOLES]`USABLEBYTES=$[0x$HEXTOP-$RESERVEOFFSET]echo "New kernel limit [ - 00000000"$HEXRESERVEOFFSET[echo osdbuf and/or yuvbuf can use [00000000$HEXRESERVEOFFSET - $HEXTOP[ \($USABLEBYTES bytes\)echo# note: cropram=done is not really a boot parameter, it will be ignored by the kernel;# we use it to check the new command line has been taken into account.echo LILO users: append this line to your lilo.conf paragraph for kernel `uname -r`:echo append=\"mem=0x$HEXRECTIFIEDOFFSET cropram=done\"echo AND RUN lilo AGAINechoecho GRUB users: append this to your grub.conf paragraph for kernel `uname -r`:echo kernel /boot/... ... ... mem=0x$HEXRECTIFIEDOFFSET cropram=doneechoecho DO NOT INSMOD NOW! REBOOT, and run this script again.echoecho For osdbuf, the correct insmod line will be:echo insmod ../realmagichwl/kernel_src/realmagichwl_kernelland_osdbuf.o osdbuf_physicaladdress=0x$HEXRESERVEOFFSET osdbuf_size=$USABLEBYTES#echo insmod ../realmagichwl/kernel_src/realmagichwl_kernelland_osdbuf.o osdbuf_physicaladdress=0x$HEXRESERVEOFFSET osdbuf_size=$USABLEBYTES >insmod_osdbuf.shecho insmod ../realmagichwl/kernel_src/realmagichwl_kernelland_yuvbuf.o yuvbuf_physicaladdress=0x$HEXRESERVEOFFSET yuvbuf_size=$USABLEBYTES >insmod_yuvbuf.shexit 0
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -