posted by bluelimn 2018.07.02 14:24

1. cannot get permission for fastboot.

< waiting for any device >


solution:


a. 관련 링크

https://github.com/96boards-hikey/tools-images-hikey960/ 


b. update fastboot

sudo apt install android-tools-adb android-tools-fastboot



c. add usb vendor to the driver(나의 경우엔 이걸로 해결)


$lsusb

Bus 003 Device 007: ID 2232:1045 Silicon Motion

Bus 003 Device 010: ID 18d1:d00d Google Inc.

Bus 003 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub



$sudo vi /etc/udev/rules.d/51-android.rules

SUBSYSTEM=="usb", ATTRS{idVendor}=="18d1", ATTRS{idProduct}=="d00d", MODE="0666", GROUP="plugdev"


$sudo service udev restart

posted by bluelimn 2018.06.18 15:28

./source build/envsetup.sh



select 1

Lunch menu... pick a combo:

     1. aosp_angler-userdebug



Download vendor images

https://developers.google.com/android/blobs-preview



chmod +x extract-qcom-angler.sh

chmod +x extract-huawei-angler.sh


./extract-qcom-angler.sh

./extract-huawei-angler.sh


==========================================

merge 3 fix

https://groups.google.com/forum/#!topic/android-building/JfgzeR_S9N4


prebuilts/tools:

git fetch https://android.googlesource.com/platform/prebuilts/tools refs/changes/02/682002/1 && git cherry-pick FETCH_HEAD

 

external/e2fsprogs/

git fetch https://android.googlesource.com/platform/external/e2fsprogs refs/changes/05/683305/1 && git cherry-pick FETCH_HEAD

 

external/f2fs-tools

git fetch https://android.googlesource.com/platform/external/f2fs-tools refs/changes/06/683306/1 && git cherry-pick FETCH_HEAD



make -j16




=================== Error======================

Error message: 

ninja: error: 'out/host/common/obj/JAVA_LIBRARIES/javapoet-prebuilt-jar_intermediates/classes.jar', needed by 'out/target/common/obj/APPS/Dialer_intermediates/classes-full-debug.jar', missing and no known rule to make it

 

Solution:

https://android-review.googlesource.com/c/platform/external/e2fsprogs/+/683305 

https://android-review.googlesource.com/c/platform/external/f2fs-tools/+/683306 

 

With those 3 patches (first one was 

https://android-review.googlesource.com/c/platform/prebuilts/tools/+/682002 

for anyone who missed that), android-p-preview-2 builds and mostly 

works (tried on Nexus 6P with latest blobs from 

https://developers.google.com/android/blobs-preview ). 

TAG
posted by bluelimn 2018.01.30 14:13

원문 : http://www.openssh.com/legacy.html


If the client and server are unable to agree on a mutual set of parameters then the connection will fail. OpenSSH (7.0 and greater) will produce an error message like this:


Unable to negotiate with legacyhost: no matching key exchange method found. Their offer: diffie-hellman-group1-sha1 



For the case of the above error message, OpenSSH can be configured to enable the diffie-hellman-group1-sha1 key exchange algorithm (or any other that is disabled by default) using the KexAlgorithms option - either on the command-line:

ssh -oKexAlgorithms=+diffie-hellman-group1-sha1 user@legacyhost 



or in the ~/.ssh/config file:


Host somehost.example.org 

KexAlgorithms +diffie-hellman-group1-sha1 


OpenSSH 7.0 이상에서는 해당 옵션이 기본으로 enable 되어 있지 않기 때문에

옵션을 넣어줘야 한다.

항상 넣기 귀찮으니 config를 만들어서 넣고 쓰도록 하자.

config파일이 없으면 그냥 생성하면 적용 됨.

'Programming > linux왕초보' 카테고리의 다른 글

ssh사용 시 diffie-hellman-group1-sha1 관련  (0) 2018.01.30
pthread min, max priority on linux  (0) 2017.06.12
use vim like as source insight  (0) 2016.04.06
[ubuntu] change default shell  (0) 2016.03.22
GDB를 사용한 CORE 파일의 분석  (0) 2016.02.05
kernel make menuconfig error  (0) 2016.01.21
Caching your GitHub password in Git  (0) 2016.01.08
Serial ports usage on Linux  (0) 2016.01.08
process 종료  (0) 2015.05.28
fork  (0) 2015.05.26
Linux SSD 최적화  (0) 2015.04.17
posted by bluelimn 2017.06.12 17:14

Original link : https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_MRG/1.2/html/Realtime_Reference_Guide/sect-Realtime_Reference_Guide-Using_library_calls_to_set_priority-sched_get_priority_min_and_sched_get_priority_max.html


#include <stdio.h>
#include <unistd.h>
#include <sched.h>

main()
{


  printf("Valid priority range for SCHED_OTHER: %d - %d\n",
  sched_get_priority_min(SCHED_OTHER),
  sched_get_priority_max(SCHED_OTHER));

  printf("Valid priority range for SCHED_FIFO: %d - %d\n",
  sched_get_priority_min(SCHED_FIFO),
  sched_get_priority_max(SCHED_FIFO));

  printf("Valid priority range for SCHED_RR: %d - %d\n",
  sched_get_priority_min(SCHED_RR),
  sched_get_priority_max(SCHED_RR));
}


Output

Valid priority range for SCHED_OTHER: 0 - 0

Valid priority range for SCHED_FIFO: 1 - 99

Valid priority range for SCHED_RR: 1 - 99



'Programming > linux왕초보' 카테고리의 다른 글

ssh사용 시 diffie-hellman-group1-sha1 관련  (0) 2018.01.30
pthread min, max priority on linux  (0) 2017.06.12
use vim like as source insight  (0) 2016.04.06
[ubuntu] change default shell  (0) 2016.03.22
GDB를 사용한 CORE 파일의 분석  (0) 2016.02.05
kernel make menuconfig error  (0) 2016.01.21
Caching your GitHub password in Git  (0) 2016.01.08
Serial ports usage on Linux  (0) 2016.01.08
process 종료  (0) 2015.05.28
fork  (0) 2015.05.26
Linux SSD 최적화  (0) 2015.04.17
posted by bluelimn 2017.05.29 15:55

original link : http://techqa.info/programming/question/28285850/Opensuse-13-1-build-envsetup-sh--syntax-error-near-unexpected-token------r--



Error:

bash: build/envsetup.sh: line 1: syntax error near unexpected token $'{\r'' 'ash: build/envsetup.sh: line 1:function hmm() {


Solve:

The problem comes from Windows end-of-lines (EOL) so you'll have to convert all scripts to unix-style EOL through dos2unix (run apt-get install dos2unix on Ubuntu) and then convert your scripts:

dos2unix build/envsetup.sh sdk/bash_completion/adb.bash

Then all vendorsetup.sh (that will prevent the "command not found" error you get):

find device/ -name vendorsetup.sh -exec dos2unix {} \;

And one last to run the choosecombo script:

dos2unix build/core/find-jdk-tools-jar.sh

EDIT: In order to finish the overall compilation, the exhaustive conversion:

find . -name '*.sh' -exec dos2unix {} \;
find . -name '*.py' -exec dos2unix {} \;
find . -name '*.c' -exec dos2unix {} \;
find . -name '*.h' -exec dos2unix {} \;
find . -name '*.cpp' -exec dos2unix {} \;
find . -name '*.hpp' -exec dos2unix {} \;
find . -name '*.txt' -exec dos2unix {} \;
find . -name 'Config.in' -exec dos2unix {} \;
find . -name 'Config.src' -exec dos2unix {} \;
find . -name 'Makefile' -exec dos2unix {} \;
find . -name 'mkmakefile' -exec dos2unix {} \;
find . -name 'Kconfig*' -exec dos2unix {} \;
find . -name rmtypedefs -exec dos2unix {} \;
find . -name apicheck -exec dos2unix {} \;
find . -name seapp_contexts -exec dos2unix {} \;
dos2unix external/busybox/scripts/* external/busybox/applets/* kernel/scripts/* dalvik/dx/etc/* prebuilts/sdk/tools/*

The *.sh for all shell scripts, and *.py for all python scripts (used during make compilation), as well as .c and .cpp file (obviously) and other files used by makefiles.

Of course you could go the over-overkill find . -type f -exec dos2unix -s -k -o {} \; and let dos2unix decide which files are text and which are binary.

There might be other. I'll edit this answer as I find new ones...

posted by bluelimn 2017.05.24 12:18

Error:


Checking API: checkapi-last

out/target/common/obj/PACKAGING/public_api.txt:23556: error 12: Class android.telephony.gsm.SmsMessage changed static qualifier

prebuilts/sdk/api/19.txt:23513: error 9: Removed public constructor SmsMessage()

prebuilts/sdk/api/19.txt:23514: error 9: Removed public method android.telephony.gsm.SmsMessage.calculateLength

prebuilts/sdk/api/19.txt:23515: error 9: Removed public method android.telephony.gsm.SmsMessage.calculateLength

prebuilts/sdk/api/19.txt:23516: error 9: Removed public method android.telephony.gsm.SmsMessage.createFromPdu

prebuilts/sdk/api/19.txt:23517: error 9: Removed public method android.telephony.gsm.SmsMessage.getDisplayMessageBody

prebuilts/sdk/api/19.txt:23518: error 9: Removed public method android.telephony.gsm.SmsMessage.getDisplayOriginatingAddress

prebuilts/sdk/api/19.txt:23519: error 9: Removed public method android.telephony.gsm.SmsMessage.getEmailBody

prebuilts/sdk/api/19.txt:23520: error 9: Removed public method android.telephony.gsm.SmsMessage.getEmailFrom

prebuilts/sdk/api/19.txt:23521: error 9: Removed public method android.telephony.gsm.SmsMessage.getIndexOnSim

prebuilts/sdk/api/19.txt:23522: error 9: Removed public method android.telephony.gsm.SmsMessage.getMessageBody

prebuilts/sdk/api/19.txt:23523: error 9: Removed public method android.telephony.gsm.SmsMessage.getMessageClass

prebuilts/sdk/api/19.txt:23524: error 9: Removed public method android.telephony.gsm.SmsMessage.getOriginatingAddress

prebuilts/sdk/api/19.txt:23525: error 9: Removed public method android.telephony.gsm.SmsMessage.getPdu

prebuilts/sdk/api/19.txt:23526: error 9: Removed public method android.telephony.gsm.SmsMessage.getProtocolIdentifier

prebuilts/sdk/api/19.txt:23527: error 9: Removed public method android.telephony.gsm.SmsMessage.getPseudoSubject

prebuilts/sdk/api/19.txt:23528: error 9: Removed public method android.telephony.gsm.SmsMessage.getServiceCenterAddress

prebuilts/sdk/api/19.txt:23529: error 9: Removed public method android.telephony.gsm.SmsMessage.getStatus

prebuilts/sdk/api/19.txt:23530: error 9: Removed public method android.telephony.gsm.SmsMessage.getStatusOnSim

prebuilts/sdk/api/19.txt:23531: error 9: Removed public method android.telephony.gsm.SmsMessage.getSubmitPdu

prebuilts/sdk/api/19.txt:23532: error 9: Removed public method android.telephony.gsm.SmsMessage.getSubmitPdu

prebuilts/sdk/api/19.txt:23533: error 9: Removed public method android.telephony.gsm.SmsMessage.getTPLayerLengthForPDU

prebuilts/sdk/api/19.txt:23534: error 9: Removed public method android.telephony.gsm.SmsMessage.getTimestampMillis

prebuilts/sdk/api/19.txt:23535: error 9: Removed public method android.telephony.gsm.SmsMessage.getUserData

prebuilts/sdk/api/19.txt:23536: error 9: Removed public method android.telephony.gsm.SmsMessage.isCphsMwiMessage

prebuilts/sdk/api/19.txt:23537: error 9: Removed public method android.telephony.gsm.SmsMessage.isEmail

prebuilts/sdk/api/19.txt:23538: error 9: Removed public method android.telephony.gsm.SmsMessage.isMWIClearMessage

prebuilts/sdk/api/19.txt:23539: error 9: Removed public method android.telephony.gsm.SmsMessage.isMWISetMessage

prebuilts/sdk/api/19.txt:23540: error 9: Removed public method android.telephony.gsm.SmsMessage.isMwiDontStore

prebuilts/sdk/api/19.txt:23541: error 9: Removed public method android.telephony.gsm.SmsMessage.isReplace

prebuilts/sdk/api/19.txt:23542: error 9: Removed public method android.telephony.gsm.SmsMessage.isReplyPathPresent

prebuilts/sdk/api/19.txt:23543: error 9: Removed public method android.telephony.gsm.SmsMessage.isStatusReportMessage

prebuilts/sdk/api/19.txt:23544: error 10: Removed field android.telephony.gsm.SmsMessage.ENCODING_16BIT

prebuilts/sdk/api/19.txt:23545: error 10: Removed field android.telephony.gsm.SmsMessage.ENCODING_7BIT

prebuilts/sdk/api/19.txt:23546: error 10: Removed field android.telephony.gsm.SmsMessage.ENCODING_8BIT

prebuilts/sdk/api/19.txt:23547: error 10: Removed field android.telephony.gsm.SmsMessage.ENCODING_UNKNOWN

prebuilts/sdk/api/19.txt:23548: error 10: Removed field android.telephony.gsm.SmsMessage.MAX_USER_DATA_BYTES

prebuilts/sdk/api/19.txt:23549: error 10: Removed field android.telephony.gsm.SmsMessage.MAX_USER_DATA_SEPTETS

prebuilts/sdk/api/19.txt:23550: error 10: Removed field android.telephony.gsm.SmsMessage.MAX_USER_DATA_SEPTETS_WITH_HEADER


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

You have tried to change the API from what has been previously released in

an SDK.  Please fix the errors listed above.

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


Solution:


1. change javadoc

$sudo update-alternatives --install "/usr/bin/javadoc" "javadoc" "/usr/local/jdk1.6.0_45/bin/javadoc" 1;


$sudo update-alternatives --config javadoc


2. update API

$make update-api



posted by bluelimn 2016.04.06 18:06

vim에서 backspace 되지 않을

~/.bashrc 또는 ~/.bash_profile 추가

stty erase '^?'

 

vim에서 .vimrc 가져오지 못을

~/.bashrc 또는 ~/.bash_profile 추가

alias vim="vim -S ~/.vimrc"

 

 

vim source insight처럼 사용하기(taglist, SrcExpl, nerdTree)

* SrcExpl: http://www.vim.org/scripts/script.php?script_id=2179
* taglist: http://www.vim.org/scripts/script.php?script_id=273
*nerdTree: http://www.vim.org/scripts/script.php?script_id=1658

~/.vim/ 하위에 설치


~/.vimrc 수정

set tabstop=2

set shiftwidth=2

set softtabstop=2

set cindent

set autoindent

set smartindent

set incsearch

syntax on

filetype on

set background=dark

colorscheme evening

set backspace=eol,start,indent

set history=1000

set hlsearch

set showmatch

set nu

"============= Like a Source Insight =============”

"=== Taglist ===

" // The switch of the Taglist

nmap <F7> :TlistToggle<CR>

let Tlist_Ctags_Cmnd = "/usr/bin/ctags"

let Tlist_Inc_Winwidth = 0

let Tlist_Exit_OnlyWindow = 0

let Tlist_Auto_Open = 0

let Tlist_Use_Left_Window = 1

"=== NERDTree ===

" // The switch of the NERDTree

nmap <F9> :NERDTreeToggle<CR>

let NERDTreeWinPos = "right"

"=== Source explorer ===

" // The switch of the Source Explorer

nmap <F8> :SrcExplToggle<CR>

"// Map the keys below to jump from one window to another:

nmap <C-H> <C-W>h

nmap <C-J> <C-W>j

nmap <C-K> <C-W>k

nmap <C-L> <C-W>l

let g:SrcExpl_winHeight = 8

let g:SrcExpl_refreshTime = 100

let g:SrcExpl_isUpdateTags = 0

" // Set “Enter” key to jump into the exact definition context

let g:SrcExpl_jumpKey = "<ENTER>"

" // Set “Space” key for back from the definition context

let g:SrcExpl_gobackKey = "<SPACE>"

map <F3> :tnext^M

map <F2> :tprevious^M

 

경우 F7, F8, F9 이용하여 켜고 있음.


Tag 생성

mktrace.sh

#!/bin/sh

rm -rf cscope.files cscope.files

rm -rf tags


find . \( -name  *.c  -o -name  *.cpp  -o -name  *.cc  -o -name  *.h  -o -name  *.s  -o -name  *.S  -o -name  *.asm  \) -print > cscope.files

ctags -R


cscope -i cscope.files 


'Programming > linux왕초보' 카테고리의 다른 글

ssh사용 시 diffie-hellman-group1-sha1 관련  (0) 2018.01.30
pthread min, max priority on linux  (0) 2017.06.12
use vim like as source insight  (0) 2016.04.06
[ubuntu] change default shell  (0) 2016.03.22
GDB를 사용한 CORE 파일의 분석  (0) 2016.02.05
kernel make menuconfig error  (0) 2016.01.21
Caching your GitHub password in Git  (0) 2016.01.08
Serial ports usage on Linux  (0) 2016.01.08
process 종료  (0) 2015.05.28
fork  (0) 2015.05.26
Linux SSD 최적화  (0) 2015.04.17
posted by bluelimn 2016.03.22 15:36

bash를 주로 사용하는데 sh로 초기 shell이 적용되어 color가 맞지 않는다거나 하는 경우


# echo $SHELL

output : 

/bin/sh


chsh -s {shell-name} {user-name}

#sudo chsh -s /bin/bash john



'Programming > linux왕초보' 카테고리의 다른 글

ssh사용 시 diffie-hellman-group1-sha1 관련  (0) 2018.01.30
pthread min, max priority on linux  (0) 2017.06.12
use vim like as source insight  (0) 2016.04.06
[ubuntu] change default shell  (0) 2016.03.22
GDB를 사용한 CORE 파일의 분석  (0) 2016.02.05
kernel make menuconfig error  (0) 2016.01.21
Caching your GitHub password in Git  (0) 2016.01.08
Serial ports usage on Linux  (0) 2016.01.08
process 종료  (0) 2015.05.28
fork  (0) 2015.05.26
Linux SSD 최적화  (0) 2015.04.17
posted by bluelimn 2016.02.05 09:32

출처 : TOOL 이야기

http://blog.daum.net/aswip/5935659



프로세스가 비정상적으로 종료될 경우, core 파일을 통하여 원인 분석을 할 수 있으며,

프로세스가 비정상적으로 종료될 경우, core 파일을 남길지 여부는 다음과 같은 명령어를 통해서

설정이 가능합니다.




[step 1] 비정상 종료 되는 샘플 프로그램 작성

#include <stdio.h>

#include <stdlib.h>


void Abnormal()

{

    int n = 1024;

    char *p = (char *)malloc(sizeof(char) * 1);


    free(p);

    free(p);                /* double free */

}


void AbnormalContainer()

{

    Abnormal();

}


void Normal()

{

    printf("normal function.\n");

}


int main(int argc, char **argv)

{

    AbnormalContainer();

    Normal();

    return 0;

}


[step 2] 비정상 종료되는 샘플 소스 컴파일

 

[root@linux temp]# gcc -o main main.c -g

 

※ 주 의 사 항

    gdb를 사용하여 core파일을 분석하기 위해서는 반드시 실행파일 컴파일시에 -g 옵션을 사용해야 합니다.



[step 3] 비정상 종료되는 샘플 실행

 

[root@linux temp]# ./main

*** glibc detected *** ./main: double free or corruption (fasttop): 0x0000000000601010 ***

======= Backtrace: =========

/lib64/libc.so.6[0x3cd3472832]

/lib64/libc.so.6(cfree+0x8c)[0x3cd3475f2c]

./main[0x400577]

./main[0x400587]

./main[0x4005b2]

/lib64/libc.so.6(__libc_start_main+0xf4)[0x3cd341e074]

./main[0x400499]

======= Memory map: ========

00400000-00401000 r-xp 00000000 fd:00 47153195                           /root/temp/main

00600000-00601000 rw-p 00000000 fd:00 47153195                           /root/temp/main

00601000-00622000 rw-p 00601000 00:00 0                                  [heap]

3cd2200000-3cd221b000 r-xp 00000000 fd:00 61440048                       /lib64/ld-2.7.so

3cd241a000-3cd241b000 r--p 0001a000 fd:00 61440048                       /lib64/ld-2.7.so

3cd241b000-3cd241c000 rw-p 0001b000 fd:00 61440048                       /lib64/ld-2.7.so

3cd3400000-3cd354d000 r-xp 00000000 fd:00 61440050                       /lib64/libc-2.7.so

3cd354d000-3cd374d000 ---p 0014d000 fd:00 61440050                       /lib64/libc-2.7.so

3cd374d000-3cd3751000 r--p 0014d000 fd:00 61440050                       /lib64/libc-2.7.so

3cd3751000-3cd3752000 rw-p 00151000 fd:00 61440050                       /lib64/libc-2.7.so

3cd3752000-3cd3757000 rw-p 3cd3752000 00:00 0

3cddc00000-3cddc0d000 r-xp 00000000 fd:00 61440308                       /lib64/libgcc_s-4.1.2-20070925.so.1

3cddc0d000-3cdde0d000 ---p 0000d000 fd:00 61440308                       /lib64/libgcc_s-4.1.2-20070925.so.1

3cdde0d000-3cdde0e000 rw-p 0000d000 fd:00 61440308                       /lib64/libgcc_s-4.1.2-20070925.so.1

2aaaaaaab000-2aaaaaaad000 rw-p 2aaaaaaab000 00:00 0

2aaaaaacc000-2aaaaaacd000 rw-p 2aaaaaacc000 00:00 0

2aaaac000000-2aaaac021000 rw-p 2aaaac000000 00:00 0

2aaaac021000-2aaab0000000 ---p 2aaaac021000 00:00 0

7fffc8065000-7fffc807a000 rw-p 7ffffffea000 00:00 0                      [stack]

7fffc81fd000-7fffc81ff000 r-xp 7fffc81fd000 00:00 0                      [vdso]

ffffffffff600000-ffffffffff601000 r-xp 00000000 00:00 0                  [vsyscall]

Aborted (core dumped)

[root@linux temp]# ls -al

total 476

drwxr-xr-x  2 root root   4096 2008-08-06 09:05 ./

drwxr-xr-- 32 root root   4096 2008-08-06 09:04 ../

-rw-------  1 root root 454656 2008-08-06 09:05 core.2805

-rw-r--r--  1 root root    260 2008-08-06 09:04 main.c


 

[step 4] gdb를 사용한 core 파일 분석

 

gdb를 사용하여 core파일을 분석하기 위해서는, 다음과 같이 gdb를 실행시키면 됩니다.

[root@linux temp]# gdb ./main ./core.2876

GNU gdb Red Hat Linux (6.6-45.fc8rh)

Copyright (C) 2006 Free Software Foundation, Inc.

GDB is free software, covered by the GNU General Public License, and you are

welcome to change it and/or distribute copies of it under certain conditions.

Type "show copying" to see the conditions.

There is absolutely no warranty for GDB.  Type "show warranty" for details.

This GDB was configured as "x86_64-redhat-linux-gnu"...

Using host libthread_db library "/lib64/libthread_db.so.1".

warning: Can't read pathname for load map: Input/output error.

Reading symbols from /lib64/libc.so.6...done.

Loaded symbols for /lib64/libc.so.6

Reading symbols from /lib64/ld-linux-x86-64.so.2...done.

Loaded symbols for /lib64/ld-linux-x86-64.so.2

Reading symbols from /lib64/libgcc_s.so.1...done.

Loaded symbols for /lib64/libgcc_s.so.1

Core was generated by `./main'.

Program terminated with signal 6, Aborted.

#0  0x0000003cd3430ec5 in raise () from /lib64/libc.so.6

(gdb) backtrace                      --> backtrace 명령어를 사용해서 죽기 직전까지 호출되었던 스택 정보 확인

#0  0x0000003cd3430ec5 in raise () from /lib64/libc.so.6

#1  0x0000003cd3432970 in abort () from /lib64/libc.so.6

#2  0x0000003cd346b0db in __libc_message () from /lib64/libc.so.6

#3  0x0000003cd3472832 in _int_free () from /lib64/libc.so.6

#4  0x0000003cd3475f2c in free () from /lib64/libc.so.6

#5  0x0000000000400577 in Abnormal () at main.c:10

#6  0x0000000000400587 in AbnormalContainer () at main.c:15

#7  0x00000000004005b2 in main (argc=1, argv=0x7fffc8077798) at main.c:25

Missing separate debuginfos, use: debuginfo-install gcc.x86_64 glibc.x86_64

(gdb) break Abnormal             --> 마지막으로 호출된 함수에 break point 설정

Breakpoint 1 at 0x400550: file main.c, line 6.

(gdb) r                                  --> 실행후 차례대로 디버깅

Starting program: /root/temp/main

Breakpoint 1, Abnormal () at main.c:6

6               int n = 1024;

(gdb) s

7               char *p = (char *)malloc(sizeof(char) * 1);

(gdb) s

9               free(p);

(gdb) s

10              free(p);                /* double free */

(gdb) s

*** glibc detected *** /root/temp/main: double free or corruption (fasttop): 0x0000000000601010 ***

'Programming > linux왕초보' 카테고리의 다른 글

ssh사용 시 diffie-hellman-group1-sha1 관련  (0) 2018.01.30
pthread min, max priority on linux  (0) 2017.06.12
use vim like as source insight  (0) 2016.04.06
[ubuntu] change default shell  (0) 2016.03.22
GDB를 사용한 CORE 파일의 분석  (0) 2016.02.05
kernel make menuconfig error  (0) 2016.01.21
Caching your GitHub password in Git  (0) 2016.01.08
Serial ports usage on Linux  (0) 2016.01.08
process 종료  (0) 2015.05.28
fork  (0) 2015.05.26
Linux SSD 최적화  (0) 2015.04.17
posted by bluelimn 2016.01.21 20:43

 HOSTLD  scripts/kconfig/mconf

scripts/kconfig/mconf.o: In function `show_help':

mconf.c:(.text+0x7e1): undefined reference to `stdscr'

scripts/kconfig/mconf.o: In function `main':

mconf.c:(.text+0x1256): undefined reference to `initscr'

mconf.c:(.text+0x125d): undefined reference to `stdscr'

scripts/kconfig/lxdialog/checklist.o: In function `print_arrows':

checklist.c:(.text+0x41): undefined reference to `wmove'

checklist.c:(.text+0x61): undefined reference to `acs_map'

checklist.c:(.text+0x69): undefined reference to `waddch'

checklist.c:(.text+0x7b): undefined reference to `waddnstr'

...




Solution

sudo apt-get install libncurses5-dev

'Programming > linux왕초보' 카테고리의 다른 글

ssh사용 시 diffie-hellman-group1-sha1 관련  (0) 2018.01.30
pthread min, max priority on linux  (0) 2017.06.12
use vim like as source insight  (0) 2016.04.06
[ubuntu] change default shell  (0) 2016.03.22
GDB를 사용한 CORE 파일의 분석  (0) 2016.02.05
kernel make menuconfig error  (0) 2016.01.21
Caching your GitHub password in Git  (0) 2016.01.08
Serial ports usage on Linux  (0) 2016.01.08
process 종료  (0) 2015.05.28
fork  (0) 2015.05.26
Linux SSD 최적화  (0) 2015.04.17
posted by bluelimn 2016.01.15 10:45

int가 사용 word size를 사용하기 때문에 32bit에서는 4byte, 64bit에서는 8byte를 사용한다.

이것은 상당히 유명한 내용이기 때문에 많이들 안다.

그런데 놓치기 쉬운 것은 long 이다.

linux에서 기본적으로 long이 unsigned int 로 되어 있기 때문에 마찬가지로 int와 동일한 크기를 가진다.


좀 더 깊이 들어가면 data model에 따라 조금씩 다르다고 하는데 자세히는 모르겠다


64-bit data models

Data model

short (integer)

int

long (integer)

long long

pointers/
size_t

Sample operating systems

LLP64/
IL32P64

16

32

32

64

64

Microsoft Windows(x86-64 and IA-64)

LP64/
I32LP64

16

32

64

64

64

Most Unixand Unix-likesystems, e.g. Solaris,LinuxBSD, and OS X;z/OS

ILP64

16

64

64

64

64

HAL Computer Systems port of Solaris toSPARC64

SILP64

64

64

64

64

64

"Classic"UNICOS[35](as opposed to UNICOS/mp, etc.)

 

<wikipedia : https://en.wikipedia.org/wiki/64-bit_computing>


간단한 test로 sizeof를 확인해봤다


printf("long: %d\n", sizeof(long));

printf("int : %d\n", sizeof(int));


32bit 
long: 4
int : 4

64bit

long: 8

int : 4


예상과 다르게 int가 4로 나왔다. 역시나 wiki는 똑똑한 사람들이 편집하는구나.

posted by bluelimn 2016.01.08 15:19

원문링크 : https://help.github.com/articles/caching-your-github-password-in-git/


If you're cloning GitHub repositories using HTTPS, you can use a credential helper to tell Git to remember your GitHub username and password every time it talks to GitHub.

If you clone GitHub repositories using SSH, then you authenticate using SSH keys instead of a username and password. For help setting up an SSH connection, see Generating SSH Keys.

Tip: You need Git 1.7.10 or newer to use the credential helper.

The credential helper is included with GitHub Desktop. The app also provides a Git shell so you won't ever need to install and configure Git manually. For more information, see "Getting Started with GitHub Desktop."

If you prefer working with the command line, you can also install a native Git shell, such as msysgit. With msysgit, running the following in the command line will store your credentials:

git config --global credential.helper wincred


'Programming > linux왕초보' 카테고리의 다른 글

pthread min, max priority on linux  (0) 2017.06.12
use vim like as source insight  (0) 2016.04.06
[ubuntu] change default shell  (0) 2016.03.22
GDB를 사용한 CORE 파일의 분석  (0) 2016.02.05
kernel make menuconfig error  (0) 2016.01.21
Caching your GitHub password in Git  (0) 2016.01.08
Serial ports usage on Linux  (0) 2016.01.08
process 종료  (0) 2015.05.28
fork  (0) 2015.05.26
Linux SSD 최적화  (0) 2015.04.17
fflush, fileno  (0) 2015.04.07
posted by bluelimn 2016.01.08 14:15

원문 링크 : http://www.armadeus.com/wiki/index.php?title=Serial_ports_usage_on_Linux


http://unix.stackexchange.com/questions/117037/how-to-send-data-to-a-serial-port-and-see-any-answer


Changing port parameters


To get current parameters

# stty -F /dev/ttyUSB0

speed 115200 baud;

intr = ^C; quit = ^\; erase = ^?; kill = ^U; eof = ^D; eol = ^J;

eol2 = <undef>; start = ^Q; stop = ^S; susp = ^Z; rprnt = ^R; werase = ^W;

lnext = ^V; flush = ^O; min = 1; time = 0;

-brkint ixoff -imaxbel

-iexten -echoctl


To only get actual speed:

# stty -F /dev/ttySMX0 speed

115200


By default serial ports are configured as terminal emulator. If you want to use them as "raw" serial port you will have to do first (example for port 1):

# stty -F /dev/ttyUSB1 raw

# stty -F /dev/ttyUSB1 -echo -echoe -echok


To change baudrate of port 2 to 115200 :

# stty -F /dev/ttyUSB2 115200

stty -speed 19200 < /dev/ttyS1
stty -speed 19200 -f /dev/ttyS1


Sending/Receiving data

Send

# echo "HELLO" > /dev/ttyUSB0

echo -e "\x7E\x03\xD0\xAF und normaler Text" > /dev/ttyS0

The echo -e command enables the interpretation of backslash escapes.


To receive data (ASCII in that case):

# cat /dev/ttyUSB0



'Programming > linux왕초보' 카테고리의 다른 글

use vim like as source insight  (0) 2016.04.06
[ubuntu] change default shell  (0) 2016.03.22
GDB를 사용한 CORE 파일의 분석  (0) 2016.02.05
kernel make menuconfig error  (0) 2016.01.21
Caching your GitHub password in Git  (0) 2016.01.08
Serial ports usage on Linux  (0) 2016.01.08
process 종료  (0) 2015.05.28
fork  (0) 2015.05.26
Linux SSD 최적화  (0) 2015.04.17
fflush, fileno  (0) 2015.04.07
[Linux] stream write  (0) 2015.03.26
posted by bluelimn 2015.05.28 17:15

eixt()


#include <stdlib.h>
void exit (int status);

C library 종료 단계
1. atexit(), on_exit() 등록함수를 역순으로 출력
2. std I/O stream flush
3. tmpfile()로 만든 임시 파일 삭제
4. _exit() 호출

#include <unistd.h>
void _exit (int status);

사용하지 않는 자원 정리
allocated memory, opend file,, system V semaphore 등
kernel은 process를 제거한 다음 parent에게 통보함

application은 _exit()를 직접 호출할 수는 있지만 의미없다. vfork() 사용자는 fork 이후 exit()대신 _exit()호출해야 함.


atexit()

#include <stdlib.h>
int atexit (void (*function) (void));

주의 : parameter, return이 없다.
POSIX에서는 ATEXIT_MAX까지 함수 등록을 지원해야 하며 최소 32가 되어야 한다.
sysconf()와 _SC_ATEXIT_MAX로 정확한 값을 알 수 있다.

long atexit_max;
atexit_max = sysconf(_SC_ATEXIT_MAX);
printf("atexit_max = %ld\n", atexit_max);


더보기



on_exit()

#include <stdlib.h>
int on_exit (void (*function)(int, void *), void *arg);

parameter를 허용함
주의 : 솔라리스에서는 더이상 이 함수를 지원하지 않는다.

void my_function(int status, void *arg);


SIGCHLD
child process가 죽으면 kernel이 parent에게 통보함
signal(), sigaction()을 이용하여 처리.

'Programming > linux왕초보' 카테고리의 다른 글

[ubuntu] change default shell  (0) 2016.03.22
GDB를 사용한 CORE 파일의 분석  (0) 2016.02.05
kernel make menuconfig error  (0) 2016.01.21
Caching your GitHub password in Git  (0) 2016.01.08
Serial ports usage on Linux  (0) 2016.01.08
process 종료  (0) 2015.05.28
fork  (0) 2015.05.26
Linux SSD 최적화  (0) 2015.04.17
fflush, fileno  (0) 2015.04.07
[Linux] stream write  (0) 2015.03.26
linux filesystem 사용 용량 확인  (0) 2015.03.18
posted by bluelimn 2015.05.26 11:52

fork()

#include <sys/types.h>
#include <unistd.h>

pid_t fork(void);

* child pid는 parent pid와 다르게 새롭게 생성
* 0이 pid로 반환되면 child
* 대기중인 signal은 정리되며, child에게 상속되지 않음
* fd lock은 상속되지 않음


fork 기본 구조



background로 다른 프로그램 실행시킬 때 많이 사용한다.


binary실행



'Programming > linux왕초보' 카테고리의 다른 글

GDB를 사용한 CORE 파일의 분석  (0) 2016.02.05
kernel make menuconfig error  (0) 2016.01.21
Caching your GitHub password in Git  (0) 2016.01.08
Serial ports usage on Linux  (0) 2016.01.08
process 종료  (0) 2015.05.28
fork  (0) 2015.05.26
Linux SSD 최적화  (0) 2015.04.17
fflush, fileno  (0) 2015.04.07
[Linux] stream write  (0) 2015.03.26
linux filesystem 사용 용량 확인  (0) 2015.03.18
[Linux] Select and Poll  (0) 2015.01.27
posted by bluelimn 2015.04.17 10:09

http://www.smallake.kr/?p=7709


위의 링크 원문에서 일부 발췌

원문제목은 "Linux환경에서 SSD 성능 최적화하기"


이처럼 SSD는 미리 블럭을 비워놓지 않으면, 쓰기작업을 할때 블럭을 비우는 작업을 해야하기 때문에 쓰기 성능이 떨어집니다. 이런 단점을 해결하기 위하여 운영체제가 한가할 때 삭제한다고 표시한 데이터를 미리 비워 두도록 하는 기능을 만들었고 이를 TRIM이라고 합니다. TRIM은 읽기와 무관하고 오직 쓰기와 관계합니다. 또한 SSD가 TRIM을 지원하여야 하고 OS도 지원하여야 합니다. Linux의 경우 TRIM을 활성화하려면 다음과 같이 명령어를 실행합니다.

이제 TRIM을 OS와 SSD가 지원한다고 하면 File System을 Mount를 할 때 옵션을 추가해주어야 합니다.

그러면 현재 사용중인 Linux의 Scheduler가 무엇이고 어떻게 변경하는지 알아보겠습니다.

변경은 아래와 같이 합니다.



====================================================================

hdparm으로 확인했는데 SSD가 trim을 지원하지 않는다면?

$ sudo fstrim / -v

와 같이 수동으로 할 수 있다. 그런데 막상 해보니까 한번에 0 bytes wre trimmed가 나오지 않아 몇번 반복해줘야 했다.

'Programming > linux왕초보' 카테고리의 다른 글

kernel make menuconfig error  (0) 2016.01.21
Caching your GitHub password in Git  (0) 2016.01.08
Serial ports usage on Linux  (0) 2016.01.08
process 종료  (0) 2015.05.28
fork  (0) 2015.05.26
Linux SSD 최적화  (0) 2015.04.17
fflush, fileno  (0) 2015.04.07
[Linux] stream write  (0) 2015.03.26
linux filesystem 사용 용량 확인  (0) 2015.03.18
[Linux] Select and Poll  (0) 2015.01.27
Example syntax for Secure Copy (scp) : scp사용법  (0) 2014.04.02
posted by bluelimn 2015.04.07 14:43

#include <stdio.h>

int fflush (FILE *stream);


return value : 

success : 0

fail : EOF


user buffer에 있는 내용을 kernel buffer에 write한다.

fwrite대신 강제로 write를 하는 것과 비슷함.
실제로 file-system에 기록되는지는 보장하지 못함.

그래서 보통 fflush() 다음에 fsync()를 같이 사용한다.




#include <stdio.h>

int fileno (FILE *stream);


return value : 

success : fd

fail : -1(EBADF)


'Programming > linux왕초보' 카테고리의 다른 글

Caching your GitHub password in Git  (0) 2016.01.08
Serial ports usage on Linux  (0) 2016.01.08
process 종료  (0) 2015.05.28
fork  (0) 2015.05.26
Linux SSD 최적화  (0) 2015.04.17
fflush, fileno  (0) 2015.04.07
[Linux] stream write  (0) 2015.03.26
linux filesystem 사용 용량 확인  (0) 2015.03.18
[Linux] Select and Poll  (0) 2015.01.27
Example syntax for Secure Copy (scp) : scp사용법  (0) 2014.04.02
tar 분할압축/풀기  (0) 2014.03.20
posted by bluelimn 2015.03.26 15:28


char 쓰기



string 쓰기



binary 쓰기







'Programming > linux왕초보' 카테고리의 다른 글

Serial ports usage on Linux  (0) 2016.01.08
process 종료  (0) 2015.05.28
fork  (0) 2015.05.26
Linux SSD 최적화  (0) 2015.04.17
fflush, fileno  (0) 2015.04.07
[Linux] stream write  (0) 2015.03.26
linux filesystem 사용 용량 확인  (0) 2015.03.18
[Linux] Select and Poll  (0) 2015.01.27
Example syntax for Secure Copy (scp) : scp사용법  (0) 2014.04.02
tar 분할압축/풀기  (0) 2014.03.20
slang_rs_export_foreach.cpp Error: ParamName  (0) 2014.02.26
posted by bluelimn 2015.03.20 15:39

target Generated: libwebcore <= external/webkit/Source/WebCore/dom/make_names.pl

Can't locate Switch.pm in @INC (you may need to install the Switch module) (@INC contains: /etc/perl /usr/local/lib/perl/5.18.2 /usr/local/share/perl/5.18.2 /usr/lib/perl5 /usr/share/perl5 /usr/lib/perl/5.18 /usr/share/perl/5.18 /usr/local/lib/site_perl .) at external/webkit/Source/WebCore/make-hash-tools.pl line 23.

BEGIN failed--compilation aborted at external/webkit/Source/WebCore/make-hash-tools.pl line 23.



solution:

sudo apt-get install libswitch-perl

posted by bluelimn 2015.03.18 20:18

df / du


df : block별 사용량 확인


df -lh

Filesystem      Size  Used Avail Use% Mounted on

/dev/sda2       909G  222G  641G  26% /

none            4.0K     0  4.0K   0% /sys/fs/cgroup

udev            3.9G  4.0K  3.9G   1% /dev

tmpfs           790M  7.5M  783M   1% /run

none            5.0M     0  5.0M   0% /run/lock

none            3.9G  152K  3.9G   1% /run/shm

none            100M   48K  100M   1% /run/user

/dev/sda1       511M  7.3M  504M   2% /boot/efi


Mandatory arguments to long options are mandatory for short options too.
  -a, --all             include dummy file systems
  -B, --block-size=SIZE  scale sizes by SIZE before printing them.  E.g.,
                           '-BM' prints sizes in units of 1,048,576 bytes.
                           See SIZE format below.
      --total           produce a grand total
  -h, --human-readable  print sizes in human readable format (e.g., 1K 234M 2G)
  -H, --si              likewise, but use powers of 1000 not 1024
  -i, --inodes          list inode information instead of block usage
  -k                    like --block-size=1K
  -l, --local           limit listing to local file systems
      --no-sync         do not invoke sync before getting usage info (default)
      --output[=FIELD_LIST]  use the output format defined by FIELD_LIST,
                               or print all fields if FIELD_LIST is omitted.
  -P, --portability     use the POSIX output format
      --sync            invoke sync before getting usage info
  -t, --type=TYPE       limit listing to file systems of type TYPE
  -T, --print-type      print file system type
  -x, --exclude-type=TYPE   limit listing to file systems not of type TYPE
  -v                    (ignored)
      --help     display this help and exit
      --version  output version information and exit

Display values are in units of the first available SIZE from --block-size,
and the DF_BLOCK_SIZE, BLOCK_SIZE and BLOCKSIZE environment variables.
Otherwise, units default to 1024 bytes (or 512 if POSIXLY_CORRECT is set).

SIZE is an integer and optional unit (example: 10M is 10*1024*1024).  Units
are K, M, G, T, P, E, Z, Y (powers of 1024) or KB, MB, ... (powers of 1000).

FIELD_LIST is a comma-separated list of columns to be included.  Valid
field names are: 'source', 'fstype', 'itotal', 'iused', 'iavail', 'ipcent',
'size', 'used', 'avail', 'pcent' and 'target' (see info page).


du : directory별 사용량 확인

du -sh ./*
8.0K    ./AndroidManifest_test.xml
32K     ./AndroidManifest.xml
4.0K    ./Android.mk
4.0K    ./CleanSpec.mk
656K    ./jni
76K     ./lib
2.5M    ./res
4.4M    ./src
68K     ./tests


Mandatory arguments to long options are mandatory for short options too.
  -0, --null            end each output line with 0 byte rather than newline
  -a, --all             write counts for all files, not just directories
      --apparent-size   print apparent sizes, rather than disk usage; although
                          the apparent size is usually smaller, it may be
                          larger due to holes in ('sparse') files, internal
                          fragmentation, indirect blocks, and the like
  -B, --block-size=SIZE  scale sizes by SIZE before printing them.  E.g.,
                           '-BM' prints sizes in units of 1,048,576 bytes.
                           See SIZE format below.
  -b, --bytes           equivalent to '--apparent-size --block-size=1'
  -c, --total           produce a grand total
  -D, --dereference-args  dereference only symlinks that are listed on the
                          command line
  -d, --max-depth=N     print the total for a directory (or file, with --all)
                          only if it is N or fewer levels below the command
                          line argument;  --max-depth=0 is the same as
                          --summarize
      --files0-from=F   summarize disk usage of the NUL-terminated file
                          names specified in file F;
                          If F is - then read names from standard input
  -H                    equivalent to --dereference-args (-D)
  -h, --human-readable  print sizes in human readable format (e.g., 1K 234M 2G)
  -k                    like --block-size=1K
  -L, --dereference     dereference all symbolic links
  -l, --count-links     count sizes many times if hard linked
  -m                    like --block-size=1M
  -P, --no-dereference  don't follow any symbolic links (this is the default)
  -S, --separate-dirs   do not include size of subdirectories
      --si              like -h, but use powers of 1000 not 1024
  -s, --summarize       display only a total for each argument
  -t, --threshold=SIZE  exclude entries smaller than SIZE if positive,
                          or entries greater than SIZE if negative
      --time            show time of the last modification of any file in the
                          directory, or any of its subdirectories
      --time=WORD       show time as WORD instead of modification time:
                          atime, access, use, ctime or status
      --time-style=STYLE  show times using style STYLE:
                          full-iso, long-iso, iso, +FORMAT
                          FORMAT is interpreted like 'date'
  -X, --exclude-from=FILE  exclude files that match any pattern in FILE
      --exclude=PATTERN    exclude files that match PATTERN
  -x, --one-file-system    skip directories on different file systems
      --help     display this help and exit
      --version  output version information and exit

Display values are in units of the first available SIZE from --block-size,
and the DU_BLOCK_SIZE, BLOCK_SIZE and BLOCKSIZE environment variables.
Otherwise, units default to 1024 bytes (or 512 if POSIXLY_CORRECT is set).

SIZE is an integer and optional unit (example: 10M is 10*1024*1024).  Units
are K, M, G, T, P, E, Z, Y (powers of 1024) or KB, MB, ... (powers of 1000).





'Programming > linux왕초보' 카테고리의 다른 글

process 종료  (0) 2015.05.28
fork  (0) 2015.05.26
Linux SSD 최적화  (0) 2015.04.17
fflush, fileno  (0) 2015.04.07
[Linux] stream write  (0) 2015.03.26
linux filesystem 사용 용량 확인  (0) 2015.03.18
[Linux] Select and Poll  (0) 2015.01.27
Example syntax for Secure Copy (scp) : scp사용법  (0) 2014.04.02
tar 분할압축/풀기  (0) 2014.03.20
slang_rs_export_foreach.cpp Error: ParamName  (0) 2014.02.26
printk : kernel log 설정  (0) 2013.11.19

티스토리 툴바