Friday, March 21, 2014

MySQL Commands

mysql> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| mysql              |
| performance_schema |
| sbtest             |
| test               |
| tpcc1000           |
+--------------------+

mysql> use tpcc1000;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Database changed

mysql> show tables;
+--------------------+
| Tables_in_tpcc1000 |
+--------------------+
| customer           |
| district           |
| history            |
| item               |
| new_orders         |
| order_line         |
| orders             |
| stock              |
| warehouse          |
+--------------------+
9 rows in set (0.00 sec)






mysql> describe customer;
+----------------+---------------+------+-----+---------+-------+
| Field          | Type          | Null | Key | Default | Extra |
+----------------+---------------+------+-----+---------+-------+
| c_id           | int(11)       | NO   | PRI | NULL    |       |
| c_d_id         | tinyint(4)    | NO   | PRI | NULL    |       |
| c_w_id         | smallint(6)   | NO   | PRI | NULL    |       |
| c_first        | varchar(16)   | YES  |     | NULL    |       |


mysql> select * from customer  (dump the entire table)
mysql> select * from customer where c_first='3YXhzppuJ02l1K1T';

Friday, March 14, 2014

Uboot To User Process Kernel Functions....


Courtesy: Mohan & Reddy
================
Before we see how the above components work, the following is the call flow of Linux Kernel boot process for arm architecture. This gives a big picture on whole Linux boot process. We use U-boot bootloader.
ARM Linux Boot Process: Big Picture
U-boot:
_start (cpu/arm920t/start.S)
start_code (cpu/arm920t/start.S)
start_armboot (lib_arm/board.c)
board_init (board/kb9202/kb9202.c)
timer_init (cpu/arm920t/at91/timer.c)
serial_init (drivers/serial/at91rm9200_usart.c)
main_loop (lib_arm/board.c)
Now u-boot is up and running and is in u-boot prompt and ready to accept commands. Assume that kernel image is loaded into RAM and issued bootm command.
do_bootm (common/cmd_bootm.c)
bootm_start (common/cmd_bootm.c)
bootm_load_os (common/cmd_bootm.c)
do_bootm_linux (lib_arm/bootm.c)
stext (linux/arch/arm/kernel/head.S)
Control is given to linux.
Linux Kernel:
—————-
stext (arch/arm/kernel/head.S:78)
__lookup_processor_type (arch/arm/kernel/head-common.S:160)
__lookup_machine_type (arch/arm/kernel/head-common.S:211)
__create_page_tables (arch/arm/kernel/head.S:219)
__arm920_setup (arch/arm/mm/proc-arm920.S:389)
__enable_mmu (arch/arm/kernel/head.S:160)
__turn_mmu_on (arch/arm/kernel/head.S:205)
__switch_data (arch/arm/kernel/head-common.S:20)
start_kernel (init/main.c:529)
start_kernel (init/main.c:529)
tick_init(kernel/time/tick-common.c:413)
setup_arch (arch/arm/kernel/setup.c:666)
setup_machine (arch/arm/kernel/setup.c:369)
lookup_machine_type ( )
setup_command_line (init/main.c:408)
build_all_zonelists (mm/page_alloc.c:3031)
parse_args (kernel/params.c:129)
mm_init (init/main.c:516)
mem_init (arch/arm/mm/init.c:528)
kmem_cache_init (mm/slab.c, mm/slob.c, mm/slub.c)
sched_init (kernel/sched.c)
init_IRQ (arch/arm/kernel/irq.c)
init_timers (kernel/timer.c:1713)
hrtimers_init (kernel/hrtimer.c:1741)
softirq_init (kernel/softirq.c:674)
console_init (drivers/char/tty_io.c:3084)
vfs_caches_init (fs/dcache.c:2352)
mnt_init (fs/namespace.c:2308)
init_rootfs ()
init_mount_tree (fs/namespace.c:2285)
do_kern_mount (fs/namespace.c:1053)
set_fs_pwd(fs/fs_struct.c:29)
set_fs_root(fs/fs_struct.c:12)
bdev_cache_init (fs/block_dev.c:465)
chrdev_init (fs/char_dev.c:566)
signals_init (kernel/signal.c:2737)
rest_init (init/main.c:425)
kernel_thread (431, arch/arm/kernel/process.c:388)
kernel_thread() creates a kernel thread and control is given to kernel_init().
kernel_init (431, init/main.c:856)
do_basic_setup (888, init/main.c:787)
init_workqueues (789, kernel/workqueue.c:1204)
driver_init (793, drivers/base/init.c:20)
do_initcalls (796, init/main.c:769) /* Calls all subsytems init functions */
prepare_namespace (906, init/do_mounts.c:366)
initrd_load (399, init/do_mounts_initrd.c:107)
rd_load_image (117, init/do_mounts_rd.c:158) /* if initrd is given */
identify_ramdisk_image (179, init/do_mounts_rd.c:53)
handle_initrd (119, init/do_mounts_initrd.c:37) /*if rd_load_image is success */
mount_block_root (45, init/do_mounts.c:233)
do_mount_root (247, init/do_mounts.:218)
mount_root (417, init/do_mounts.c:334) /* if initrd not given */
mount_block_root (359, init/do_mounts.c:233)
do_mount_root (247, init/do_mounts.c:218)
init_post (915, init/main.c:816)
run_init_process (847, init/main.c:807)
kernel_execve (810, arch/arm/kernel/sys_arm.c:81)
|
User Space |
————- |
init() /*userspace /sbin/init */