- set baudrate 38400 to ttymxc2
參考此篇 (應該說是照抄 ><) -
serial programming
#include <stdio.h>
#include <termios.h>
#include <fcntl.h>
void setparameter(void)
{
int tty;
struct termios tio;
tty = open("/dev/ttymxc1",O_RDWR | O_NOCTTY | O_NONBLOCK);
tcgetattr(tty,&tio);
tio.c_cflag = B38400 | CS8 | CLOCAL | CREAD;
tcflush(tty,TCIFLUSH);
tcsetattr(tty,TCSANOW,&tio);
close(tty);
}
int main(int argc,char *argv[])
{
FILE *fd;
int i;
printf("set ttymxc1 baudrate for rdr3300\n");
setparameter();
return 0;
}
makefile
ARCH=arm
CROSS_COMPILE=/home/nelsonchung/gcc-4.1.2-glibc-2.5-nptl-3/arm-none-linux-gnueabi/bin/arm-none-linux-gnueabi-
CC=$(CROSS_COMPILE)gcc
LD=$(CROSS_COMPILE)ld
all:
$(CC) uart2gps.c -o uart2gps -static
clean:
rm uart2gps
有賴Auron學長之前的教學
現在會build給imx51使用的程式
- build application
make
把程式放到root裡面
checko說 需要修改init.rc
/device/fsl/imx5x/init.rc 與 /out/target/product/imx51_bbg/root/init.rc相同
所以修改/device/fsl/imx5x/init.rc
在build的時候 應該會將imx5x下的init.rc copy到root folder下
init.rc裡面
發現有這樣子的內容
# create basic filesystem structure
mkdir /data/misc 01771 system misc
mkdir /data/misc/bluetoothd 0770 bluetooth bluetooth
mkdir /data/misc/bluetooth 0770 system system
mkdir /data/misc/keystore 0700 keystore keystore
mkdir /data/misc/vpn 0770 system system
mkdir /data/misc/systemkeys 0700 system system
mkdir /data/misc/vpn/profiles 0770 system system
# give system access to wpa_supplicant.conf for backup and restore
mkdir /data/misc/wifi 0770 wifi wifi
chmod 0770 /data/misc/wifi
chmod 0660 /data/misc/wifi/wpa_supplicant.conf
mkdir /data/local 0771 shell shell
mkdir /data/local/tmp 0771 shell shell
mkdir /data/data 0771 system system
mkdir /data/app-private 0771 system system
mkdir /data/app 0771 system system
mkdir /data/property 0700 root root
# create dalvik-cache and double-check the perms
mkdir /data/dalvik-cache 0771 system system
chown system system /data/dalvik-cache
chmod 0771 /data/dalvik-cache
# create the lost+found directories, so as to enforce our permissions
mkdir /data/lost+found 0770
mkdir /cache/lost+found 0770
# double check the perms, in case lost+found already exists, and set owner
chown root root /data/lost+found
chmod 0770 /data/lost+found
chown root root /cache/lost+found
chmod 0770 /cache/lost+found
去初始化data folder
難怪我一開始分割好的data沒有資料
一開機完就有資料
原來是在這邊做的
加入
service uart2gps /system/bin/uart2gps
oneshot
到init.rc
預期希望執行此程式一次就好
要記得將uart2gps放到/system/bin/下 就重新make snod產生一個新的system.img
產生ramdisk.img
acp -fpt device../init.rc out/.../root/init.rc
mkbootfs out/../root | minigzip > ramdisk.img
還要轉成uramdisk.img
沒有留言:
張貼留言