SCP 명령

os/linux 2013. 9. 5. 00:49


In a Terminal application, change to the directory with the executable hello_world file, for example:

On the Host PC

cd /home/jan/workspace/hello_world/bb_debug

Use the scp command to transfer the file over the local network to the BeagleBoard:

scp hello_world root@192.168.7.2:/home/root/hello_world 

is the file to transfer.

rootis the username on the BeagleBoard.

192.168.7.2 is the BeagleBoard's IP address.

/home/root/ is the directory to store the transferred file on the BeagleBoard.


BeableBoard Connected by usb 테더링????

password change

os/linux 2013. 9. 4. 17:59

$ sudo passwd root
Enter new UNIX password: 
Retype new UNIX password: 
passwd: password updated successfully

'os > linux' 카테고리의 다른 글

SCP 명령  (0) 2013.09.05
루트 파일 시스템 busybox 구성하기(nfs)  (0) 2013.01.23
디바이스 드라이버 등록 과정(2)  (0) 2013.01.08
디바이스 드라이버 등록 과정(부트부터)  (0) 2013.01.07

루트 파일 시스템 busybox 구성하기(nfs)

os/linux 2013. 1. 23. 14:16

출처 : http://blog.naver.com/PostView.nhn?blogId=bright81&logNo=40123098033


1 boot cmd( at uboot )

#setenv bootargs console=ttySAC2,115200 user_debug=31 root=/dev/nfs rw nfsroot=192.168.1.15:/home/da/nfsroot ip=192.168.1.85:192.168.1.15:192.168.1.1:255.255.255.0::eth0:off init=/linuxrc


#saveenv


2. busybox configration(version 1.12.0)

make menuconfig

2.1 Networking Utility --> RPC Support 를 체크


busybox Settings -> General Configuration -> RPC Support 를 체크해야만 NFS MOUNT Option 을 확인할 수 있다.



RPC Support 를 체크한 뒤에, Linux System Utilities 에 가면 mount 에 "Support mounting NFS file systems" 를 볼 수 있다.

2.2 Linux System Utilities -> mount -> Support mounting NFS file systems  Check



2.3 compile

# make CONFIG_PREFIX=../_inst install



3. copy file to nfsroot directory

# cp -a _inst/* ../../nfsroot/.


4. error

[    5.697951] request_module: runaway loop modprobe binfmt-464c
[    5.702242] request_module: runaway loop modprobe binfmt-464c
[    5.708640] request_module: runaway loop modprobe binfmt-464c
---> /bin/busybox file이 x86 기반으로 컴파일됨

    ---> Make file 수정

CROSS_COMPILE ?= arm-none-linux-gnueabi-

5. ok 결과



성공!!!!!

메이크 파일 잘못 수정해서 컴파일이 x86으로 되어 삽질 하루 하고 Arm설정,컴파일 설정 다시 하고 성공!!!! 수고


'os > linux' 카테고리의 다른 글

SCP 명령  (0) 2013.09.05
password change  (0) 2013.09.04
디바이스 드라이버 등록 과정(2)  (0) 2013.01.08
디바이스 드라이버 등록 과정(부트부터)  (0) 2013.01.07

디바이스 드라이버 등록 과정(2)

os/linux 2013. 1. 8. 19:45

다음은 platform data 등록 부터 꺼꾸로 타고 들어 가는 방법을 알아본다.


1. /kernel/arch/arm/mach-s5pv210/mach-mango210.c 에서 boot시 호출되며, 등록 내용중

init_machine이 실행한다.? 그 함수는 mango210_machine_init함수를 호출

1164 //MACHINE_START(MANGO210, "MANGO210")
1165 MACHINE_START(MANGO210, "MAPLE210")
1166    /* Maintainer: Kukjin Kim <kgene.kim@samsung.com> */
1167    .phys_io = S3C_PA_UART & 0xfff00000,
1168    .io_pg_offst   = (((u32)S3C_VA_UART) >> 18) & 0xfffc,
1169    .boot_params   = S5P_PA_SDRAM + 0x100,
1170 // .fixup      = mango210_fixup,
1171    .init_irq   = s5pv210_init_irq,
1172    .map_io     = mango210_map_io,
1173    .init_machine  = mango210_machine_init,
1174    .timer      = &s5p_systimer,
1175 MACHINE_END

2. /kernel/arch/arm/mach-s5pv210/mach-mango210.c

static void __init mango210_machine_init(void)
 967 {
....................

s3cfb_set_platdata(&mango_fb_data);

.......

}

mango_fb_data는 같은 파일에 아래와 같이 정의 되어 있다.

878 static struct s3c_platform_fb mango_fb_data __initdata = {
 879    .hw_ver  = 0x62,
 880    .nr_wins = 5,
 881    .default_win = CONFIG_FB_S3C_DEFAULT_WINDOW,
 882    .swap = FB_SWAP_WORD | FB_SWAP_HWORD,
 883 };

3. 위에서 /kernel/arch/arm/plat-s5p/devs.c

// pd값은 위에 정의된 데이타가 넘어 오고

void __init s3cfb_set_platdata(struct s3c_platform_fb *pd)
649 {
650    struct s3c_platform_fb *npd;
651    int i;
652
653    if (!pd)
654       pd = &default_fb_data;
655
656    npd = kmemdup(pd, sizeof(struct s3c_platform_fb), GFP_KERNEL);
657    if (!npd)
658       printk(KERN_ERR "%s: no memory for platform data\n", __func__);
659    else {
660       for (i = 0; i < npd->nr_wins; i++)
661          npd->nr_buffers[i] = 1;
662
663 #if defined(CONFIG_FB_S3C_NR_BUFFERS)
664       npd->nr_buffers[npd->default_win] = CONFIG_FB_S3C_NR_BUFFERS;
665 #else
666       npd->nr_buffers[npd->default_win] = 1;
667 #endif
668       // 아래 함수는 kernel/arch/arm/mach-s5pv210/setup-fb.c에 정의 되어 있다.
669       s3cfb_get_clk_name(npd->clk_name);
670       npd->cfg_gpio = s3cfb_cfg_gpio;
671       npd->backlight_on = s3cfb_backlight_on;
672       npd->backlight_off = s3cfb_backlight_off;
673       npd->lcd_on = s3cfb_lcd_on;
674       npd->lcd_off = s3cfb_lcd_off;
675       npd->clk_on = s3cfb_clk_on;
676       npd->clk_off = s3cfb_clk_off;
677
678       s3c_device_fb.dev.platform_data = npd;
679    }
680 }

4. kernel/arch/arm/mach-s5pv210/setup-fb.c

실질적으로  H/W에 관한 설정은 여기서 하게 된다.

172 int s3cfb_backlight_on(struct platform_device *pdev)
173 {
174 #if !defined(CONFIG_BACKLIGHT_PWM)
175    int err;
176
177    err = gpio_request(S5PV210_GPD0(0), "GPD0");
178
179    if (err) {
180       printk(KERN_ERR "failed to request GPD0 for "
181          "lcd backlight control\n");
182       return err;
183    }
184
185    gpio_direction_output(S5PV210_GPD0(0), 1);
186
187    s3c_gpio_cfgpin(S5PV210_GPD0(0), S5PV210_GPD_0_0_TOUT_0);
188
189    gpio_free(S5PV210_GPD0(0));
190 #endif
191    return 0;
192 }


이제 까지 과정으로 컴파일시 MACHINE_START로 저장된 자료를 참조하여 booting시 machine_init를 찾아 실행하고 각각의 자료 구조와 h/w내용이 저장된다.

그럼 드라이버 로드는 언제 연계 되는가???? 또 찾아 봐야 될게 생기네....


'os > linux' 카테고리의 다른 글

SCP 명령  (0) 2013.09.05
password change  (0) 2013.09.04
루트 파일 시스템 busybox 구성하기(nfs)  (0) 2013.01.23
디바이스 드라이버 등록 과정(부트부터)  (0) 2013.01.07

디바이스 드라이버 등록 과정(부트부터)

os/linux 2013. 1. 7. 22:40

디바이스 드라이버를 등록과정을 살펴 보기로 하겠다.


1. /kenel/arch/arm/kenel/head.S

2. /kernel/arch/arm/kenel/head-common.S


 44    ldmia r3!, {r4, r5, r6, r7}
 45    cmp   r4, r5            @ Copy data segment if needed
 46 1: cmpne r5, r6
 47    ldrne fp, [r4], #4
 48    strne fp, [r5], #4
 49    bne   1b
 50
 51    mov   fp, #0            @ Clear BSS (and zero fp)
 52 1: cmp   r6, r7
 53    strcc fp, [r6],#4
 54    bcc   1b
 55
 56  ARM( ldmia r3, {r4, r5, r6, r7, sp})
 57  THUMB(  ldmia r3, {r4, r5, r6, r7} )
 58  THUMB(  ldr   sp, [r3, #16]     )
 59    str   r9, [r4]       @ Save processor ID
 60    str   r1, [r5]       @ Save machine type
 61    str   r2, [r6]       @ Save atags pointer
 62    bic   r4, r0, #CR_A        @ Clear 'A' bit
 63    stmia r7, {r0, r4}         @ Save control register values
 64    b  start_kernel
 65 ENDPROC(__mmap_switched)
 66


3. kernel/init/main.c

517 asmlinkage void __init start_kernel(void)
518 {


678
679    check_bugs();
680
681    acpi_early_init(); /* before LAPIC and SMP init */
682    sfi_init_late();
683
684    ftrace_init();
685
686    /* Do the rest non-__init'ed, we're now alive */
687    rest_init();
688 }
689
리눅스 커널이 동작하면 /init 프로세스와 kthreadd 프로세스가 제일 처음 실행되게 되는데 이를 시작하는 것이 rest_init()이다.



4.kernel/init/main.c

rest_init()에서 구동되는 kernel_init() 에서는 부팅 과정에서 커널이 생성하는 첫번째 프로세스인 /init을 생성하기 직전에 do_basic_setup()을 호출하여 정적인 디바이스 드라이버 파일을 초기화(등록) 하게 된다.

416 static noinline void __init_refok rest_init(void)
417    __releases(kernel_lock)
418 {
419    int pid;
420
421    rcu_scheduler_starting();
422    kernel_thread(kernel_init, NULL, CLONE_FS | CLONE_SIGHAND);
423    numa_default_policy();
424    pid = kernel_thread(kthreadd, NULL, CLONE_FS | CLONE_FILES);   // init 0
425    kthreadd_task = find_task_by_pid_ns(pid, &init_pid_ns);
426    unlock_kernel();
427
428    /*
429     * The boot idle thread must execute schedule()
430     * at least once to get things moving:
431     */
432    init_idle_bootup_task(current);
433    preempt_enable_no_resched();
434    schedule();
435    preempt_disable();
436
437    /* Call into cpu_idle with preempt disabled */
438    cpu_idle();
439 }


5. kernel/init/main.c


static int __init kernel_init(void * unused)
849 {
850    lock_kernel();
851
852    /*
853     * init can allocate pages on any node
854     */
855    set_mems_allowed(node_possible_map);
856    /*
857     * init can run on any cpu.
858     */
859    set_cpus_allowed_ptr(current, cpu_all_mask);
860    /*
861     * Tell the world that we're going to be the grim
862     * reaper of innocent orphaned children.
863     *
864     * We don't want people to have to make incorrect
865     * assumptions about where in the task array this
866     * can be found.
867     */
868    init_pid_ns.child_reaper = current;
869
870    cad_pid = task_pid(current);
871
872    smp_prepare_cpus(setup_max_cpus);
873
874    do_pre_smp_initcalls();
875    start_boot_trace();
876
877    smp_init();
878    sched_init_smp();
879
880    do_basic_setup();
887    if (!ramdisk_execute_command)
888       ramdisk_execute_command = "/init";
889
890    if (sys_access((const char __user *) ramdisk_execute_command, 0) != 0) {
891       ramdisk_execute_command = NULL;
892       prepare_namespace();
893    }
894
895    /*
896     * Ok, we have completed the initial bootup, and
897     * we're essentially up and running. Get rid of the
898     * initmem segments and start the user-mode stuff..
899     */
900
901    init_post();
902    return 0;
903 }

6. kernel/init/main.c

do_basic_setup()에서 workqueue, driver, irq_proc 등을 호출하고 마지막으로 do_initcalls()를 호출한다. (do_pre_smp_initcalls() 함수고 do_basic_setup() 과 유사한 일을 수행한다)

/*
768  * Ok, the machine is now initialized. None of the devices
769  * have been touched yet, but the CPU subsystem is up and
770  * running, and memory and process management works.
771  *
772  * Now we can finally start doing some real work..
773  */
774 static void __init do_basic_setup(void)
775 {
776    init_workqueues();
777    cpuset_init_smp();
778    usermodehelper_init();
779    init_tmpfs();
780    driver_init();
781    init_irq_proc();
782    do_ctors();
783    do_initcalls();
784 }


7. kernel/init/main.c

do_initcalls()은 for 문을 이용해서 do_one_initcall()을 호출하게 된다.

extern initcall_t __initcall_start[], __initcall_end[], __early_initcall_end[];
755
756 static void __init do_initcalls(void)
757 {
758    initcall_t *call;
759
760    for (call = __early_initcall_end; call < __initcall_end; call++)
761       do_one_initcall(*call);
762
763    /* Make sure there is no pending stuff from the initcall sequence */
764    flush_scheduled_work();
765 }

8. kernel/init/main.c

여기서 보면 __early_initcall_end에서 __initcall_end 사이에 등록된 함수들을 호출하는 것을 알 수 있다.

이들은 보통 CPU에 따라서 vmlinux.lds.S 파일에 정의되어 있다. arm의 경우를 보면 /kernel/arch/arm/kernel/vmlinux.lds.S 파일에 정의되어 있다.

708 int do_one_initcall(initcall_t fn)
709 {
710    int count = preempt_count();
711    ktime_t calltime, delta, rettime;
712
713    if (initcall_debug) {
714       call.caller = task_pid_nr(current);
715       printk("calling  %pF @ %i\n", fn, call.caller);
716       calltime = ktime_get();
717       trace_boot_call(&call, fn);
718       enable_boot_trace();
719    }
720
721    ret.result = fn();
            .................
749
750    return ret.result;
751 }


9 kernel/arch/arm/kernel/vulinux.lds.S

SECTIONS
 21 {
 22 #ifdef CONFIG_XIP_KERNEL
 23    . = XIP_VIRT_ADDR(CONFIG_XIP_PHYS_ADDR);
 24 #else
 25    . = PAGE_OFFSET + TEXT_OFFSET;
 26 #endif
 27    .text.head : {
 28       _stext = .;
 29       _sinittext = .;
 30       *(.text.head)
 31    }
 32
 33    .init : {         /* Init code and data      */
 34          INIT_TEXT
 35       _einittext = .;
 36       __proc_info_begin = .;
 37          *(.proc.info.init)
 38       __proc_info_end = .;
 39       __arch_info_begin = .;
 40          *(.arch.info.init)   // machine_start에 의해 등록된 데이타
 41       __arch_info_end = .;
 42       __tagtable_begin = .;
 43          *(.taglist.init)
 44       __tagtable_end = .;
 45       . = ALIGN(16);
 46       __setup_start = .;
 47          *(.init.setup)
 48       __setup_end = .;
 49       __early_begin = .;
 50          *(.early_param.init)
 51       __early_end = .;
 52       __initcall_start = .;
 53          INITCALLS
 54       __initcall_end = .;
 55       __con_initcall_start = .;
 56          *(.con_initcall.init)
 57       __con_initcall_end = .;
 58       __security_initcall_start = .;
 59          *(.security_initcall.init)
 60       __security_initcall_end = .;
 61 #ifdef CONFIG_BLK_DEV_INITRD
 62       . = ALIGN(32);
 63       __initramfs_start = .;
 64          usr/built-in.o(.init.ramfs)
 65       __initramfs_end = .;
 66 #endif
 67       . = ALIGN(PAGE_SIZE);
 68       __per_cpu_load = .;
 69       __per_cpu_start = .;
 70          *(.data.percpu.page_aligned)
 71          *(.data.percpu)
 72          *(.data.percpu.shared_aligned)

요기서 뭐가 뭘까요????


10. kernel/arch/arm/include/asm/mach/ arch.h

13 struct tag;
 14 struct meminfo;
 15 struct sys_timer;
 16
 17 struct machine_desc {
 18    /*
 19     * Note! The first four elements are used
 20     * by assembler code in head.S, head-common.S
 21     */
 22    unsigned int      nr;      /* architecture number  */
 23    unsigned int      phys_io; /* start of physical io */
 24    unsigned int      io_pg_offst;   /* byte offset for io
 25                    * page tabe entry   */
 26
 27    const char     *name;      /* architecture name */
 28    unsigned long     boot_params;   /* tagged list    */
 29
 30    unsigned int      video_start;   /* start of video RAM   */
 31    unsigned int      video_end;  /* end of video RAM  */
 32
 33    unsigned int      reserve_lp0 :1;   /* never has lp0  */
 34    unsigned int      reserve_lp1 :1;   /* never has lp1  */
 35    unsigned int      reserve_lp2 :1;   /* never has lp2  */
 36    unsigned int      soft_reboot :1;   /* soft reboot    */
 37    void        (*fixup)(struct machine_desc *,
 38                 struct tag *, char **,
 39                 struct meminfo *);
 40    void        (*map_io)(void);/* IO mapping function */
 41    void        (*init_irq)(void);
 42    struct sys_timer  *timer;     /* system tick timer */
 43    void        (*init_machine)(void);
 44 };
 45
 46 /*
 47  * Set of macros to define architecture features.  This is built into
 48  * a table by the linker.
 49  */
 50 #define MACHINE_START(_type,_name)        \
 51 static const struct machine_desc __mach_desc_##_type  \
 52  __used                    \
 53  __attribute__((__section__(".arch.info.init"))) = {  \
 54    .nr      = MACH_TYPE_##_type,    \
 55    .name    = _name,
                                                 




'os > linux' 카테고리의 다른 글

SCP 명령  (0) 2013.09.05
password change  (0) 2013.09.04
루트 파일 시스템 busybox 구성하기(nfs)  (0) 2013.01.23
디바이스 드라이버 등록 과정(2)  (0) 2013.01.08