Program editing using the Python script language

Source: Internet
Author: User

There are two main ways to use the Python scripting language to perform operations in the game: one is that the main program uses an advanced language, such as C ++ for writing, then, embed a script interpreter into it and dynamically execute some script functions at runtime.

Start the Python script language, select memlow-lpia-ubuntu-hard for Platform, and select ububtu-mobile for target, which is generated automatically. The waiting time is long. This is also a good tool or a poor tool. I have prepared almost all modules of the Gnome Mobile framework through commands, but I am not idle;

The Automatic Generation by tools is a lot idle, and I am not very concerned about the compilation details, that is, I hope to complete the compilation quickly and do a good job of testing. Next, generate the Image file and select Live rw usb. At this point, I thought it was a success. I click Launch VM, and there is no response... depressed. Google, to run KVM, the CPU must support Intel VT, and there is no MID at hand, so try Qemu.

The compiled image file (the file selected during Launch VM) is directly thrown to Qemu. The result is "checking device/dev/sda for installation source... "Where is the problem? I can't tell why I mounted the image file locally. Actually, python cannot directly run out of the screen as expected (Qemu-hda moblin may be faulty here. img ).

Because the kernel and file system are generated by MIC, a lot of processing details are unknown, but the compiled files always exist, I want to create all the files required for Qemu Simulation Based on the files generated by MIC. The kernel can be found in $ {Project Name}/targets/$ {Target Name}/fs/boot. The main task is to create the ext3 file of the root file system:

 
 
  1. dd if=/dev/zero of=1G.img bs=1M seek=1000 count=0 
  2.          mkfs.ext3 1G.img  
  3.          sudo mount 1G.img ${Mount Dir} -o loop  

Next, it's easy to copy all the content under $ {Project Name}/targets/$ {Target Name}/fs to $ {Mount Dir }, the root file system is formed (delete useless content, and there is a kernel connection under my directory ). During linux Startup, the system prompts you to enter the user name and password... mount the root file system 1G. img again and delete the shadow? Use a more civilized method to copy the local/etc/shadow to $ {Mount Dir}/etc.

Start again, get the shell, but there is still no graphical interface (if you need to manually start X on the MID, it feels a bit redundant, the problem may be in the configuration, do not go deep, run X again ). There is no/etc/init. d/TPD, or startx. The frustrating thing happened again, "(EE): no valid modes found ". No way.

You can only mount the root file system again and add Modes "800x133" (only the mode I added, I wonder if other Modes are supported ). After seeing the screen, it may be because of the cost. I think the Moblin interface is still very beautiful.

Using the same method, you can use Qemu to simulate other platforms (without one-by-one verification, tested netbook-lpia-moblin2 ). The Python interpreter converts the source code into bytecode and then translates it into a machine language for running without worrying about how to compile the program.

To connect to the correct library, you only need to copy the Python script language to the target machine, and it will work. Secondly, you have been writing Python for a long time. I think it can quickly turn my idea into reality, so I am too lazy to use C. Finally, Python is an extremely popular explanatory language, we can see that the Python programming interface is retained in the Gnome Mobile prototype.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.