Saturday, September 8, 2012

Ubuntu 12.04 stuck at VMware easy install screen!

The issue happened right just after the Ubuntu 12.04 LTS installation, it stuck at VMware Easy install screen.




******************************************************************
******************************************************************
Vmware Easy Install

PLEASE WAIT! VMware Tools is currently being
installed on your system. Depending on the
version of Ubuntu you are installing, you may
log in below and use the system during
intallation. Otherwise, please wait for the
graphical environment to launch. Thank you.

******************************************************************
******************************************************************

  This is the note to fix the issue.

  1. Restore the /etc/issue file:
    sudo mv /etc/issue.backup /etc/issue*
  2. Restore the /etc/rc.local file:
    sudo mv /etc/rc.local.backup /etc/rc.local
  3. Restore the /etc/init/lightdm.conf file:
    sudo mv /opt/vmware-tools-installer/lightdm.conf /etc/init
Then reboot.

Highlight to setup Android build environment with Ubuntu 12.04

  This is a note how to setup the build environment on top of the Ubuntu 12.04.

  I am not going to write down all the details here as most of the steps & details could be found in http://source.android.com/source/initializing.html. Instead I just highlight some common errors here.

i) Install the Java run time engine.

  As the Ubuntu 12.04 is came with the OpenJava run-time & the android build environment is requested a java6 runtime, it will be a problem. Some websites mentioned that user could re-install the jdk with the repo but it just doesn't work. Anyway, the solution is to download it directly from the Java_Archive. You may choose the rpm or bin version. My suggestion is to pick up the bin version as you may need to install the rpm before.

  This is the installation procedures for the jdk.

#change to /opt
#chmod a+x jdk-6u35-linux-x64.bin
#./jdk-6u35-linux-x64.bin

  The above command will unzip the packages. Then what you need is to add the JAVA HOME path to the system. This is a suggestion.

#sudo gedit /etc/profile

  Then add the following lines at the end of the file.

export JAVA_HOME=/opt/jdk1.6.0_35
CLASSPATH=.:$JAVA_HOME/lib:$JAVA_HOME/lib/ft.jar:$JAVA_HOME/lib/tools.jar
export PATH=$JAVA_HOE/bin:$PATH

  Save the file & reboot the system, it should be fine now.

  To check the jdk version, simply use the following commands.

java -version & u will see the below response.


alexyu@ubuntu:/opt/jdk-6u/jdk1.6.0_35$ java -version
java version "1.6.0_35"
Java(TM) SE Runtime Environment (build 1.6.0_35-b10)
Java HotSpot(TM) 64-Bit Server VM (build 20.10-b01, mixed mode)
alexyu@ubuntu:/opt/jdk-6u/jdk1.6.0_35$

Wednesday, February 29, 2012

how to write fb?

This is an example showing how to verify the functionality of a embedded system fb. To compile the below code, this is the command.

"$CROSS_COMPILE"gcc fbapp.c -o fbapp

#include ...

#define ERROR(x) printf("fbtest error in line %s:%d: %s\n", __FUNCTION__, __LINE__, strerror(errno));

#define FBCTL(cmd, arg) \
if(ioctl(fd, cmd, arg) == -1) { \
ERROR("ioctl failed"); \
exit(1); }

#define FBCTL0(cmd) \
if(ioctl(fd, cmd) == -1) { \
ERROR("ioctl failed"); \
exit(1); }

struct fb_var_screeninfo var;
struct fb_fix_screeninfo fix;

int open_fb(const char* dev)
{
int fd = -1;
fd = open(dev, O_RDWR);
if(fd == -1)
{
printf("Error opening device %s : %s\n", dev, strerror(errno));
exit(-1);
}

return fd;
}

static void draw_pixel(void *fbmem, int x, int y, unsigned color)
{
if (var.bits_per_pixel == 16) {
unsigned short c;
unsigned r = (color >> 16) & 0xff;
unsigned g = (color >> 8) & 0xff;
unsigned b = (color >> 0) & 0xff;
unsigned short *p;

r = r * 32 / 256;
g = g * 64 / 256;
b = b * 32 / 256;

c = (r << 11) | (g << 5) | (b << 0);

fbmem += fix.line_length * y;

p = fbmem;

p += x;

*p = c;
} else {
unsigned int *p;

fbmem += fix.line_length * y;

p = fbmem;

p += x;

*p = color;
}
}

void fill_screen(void *fbmem)
{
unsigned x, y;
unsigned h = var.yres; //yres_virtual;
unsigned w = var.xres; //xres_virtual;
  // int color;
  for (y = 0; y < h; y++) {
for (x = 0; x < w; x++) {
for (y = 0; y < h; y++) {
for (x = 0; x < w; x++) {
  draw_pixel(fbmem, x, y, (y? 0x00FFFFFF:0));}
        }
}
}
}

int main(int argc, char** argv)
{
int fb_num;
char str[64];
int fd;

if (argc == 2)
fb_num = atoi(argv[1]);
else
fb_num = 0;

sprintf(str, "/dev/graphics/fb%d", fb_num);
printf("opening %s\n", str);

fd = open(str, O_RDWR);

FBCTL(FBIOGET_VSCREENINFO, &var);
FBCTL(FBIOGET_FSCREENINFO, &fix);

printf("res %d,%d virtual %d,%d, line_len %d, bits_per_pixel %d\n",
var.xres, var.yres,
var.xres_virtual, var.yres_virtual,
fix.line_length,
var.bits_per_pixel);

void* ptr = mmap(0, var.yres_virtual * fix.line_length,
PROT_WRITE | PROT_READ,
MAP_SHARED, fd, 0);

if(ptr == MAP_FAILED) {
perror("mmap failed");
exit(1);
}

fill_screen(ptr);
return 0;
}

how-to setup busy box ?


The busybox could be cross compiled for arm-none-linux-gnueabi-gcc.
It is cross compiled with static link option.
make ARCH=arm CROSS_COMPILE=arm-none-linux-gnueabi-
User could cp the busybox to /system/bin of the target sd card.

//install manually
adb shell
su
mount -o rw,remount -t yaffs2 /dev/block/mtdblock3 /system
exit
adb push busybox /data/local
adb shell
cd /system
ls -al


cd /data/local
chmod busybox 755
/data/local/busybox cp /data/local/busybox /system/xbin/busybox
cd /system/xbin
chmod busybox 755
./busybox --install -s /system/xbin
rm /data/local/busybox