If we compile and deploy once time using bitbake, the image file will be generated in /deploy/image/*.bin.
If we deploy again, the new image file will be generated again.
Therefore, the image file will change much.
we execute "bitbake -c cleansstate linux-imx" in order to clean image file, but our kernel source code are also cleaned.
How can we clean image file and keep kernel source code that we have modified?
Hello YaoLin Chang,
Cleansstate does wipe out also the intermediate files but as far as I know it should leave the downloaded files and packages.
You may use clean instead:
bitbake -c clean linux-imx
With this all output files will be deleted but it will not remove cache files. Unfortunately it is possible that not all changes on the source code since Yocto is focused on distribution and customization of images rather than development.
If you will work on several changes on your recipes I would recommend extracting and installing the toolchain and building manually.
You can do that using command "# bitbake meta-toolchain". This will install the toolchain at <build directory>/tmp/deploy/sdk. Then to install it you can run
"sh <build dir>/tmp/deploy/sdk/poky-glibc-<name of toolchain>-toolchain-1.7.sh". By default this will install the toolchain at "/opt/poky/<toolchain version>".
I have install toolchain. I'm entering kernel folder as below:
However, we type make to compile kernel, the system will show some configuration as below:
How should we choose these?
Note: bitbake to compile no this situation.
scripts/kconfig/conf --silentoldconfig Kconfig
* Restart config...
* Linux/x86 3.14.28 Kernel Configuration
64-bit kernel (64BIT) [Y/n/?] (NEW)
* General setup
Cross-compiler tool prefix (CROSS_COMPILE) 
Compile also drivers which will not load (COMPILE_TEST) [N/y/?] n
Local version - append to kernel release (LOCALVERSION) [-1.0.0_ga] -1.0.0_ga
Automatically append version information to the version string (LOCALVERSION_AUTO) [Y/n/?] y
Kernel compression mode
1. Gzip (KERNEL_GZIP)
2. Bzip2 (KERNEL_BZIP2) (NEW)
3. LZMA (KERNEL_LZMA)
4. XZ (KERNEL_XZ)
> 5. LZO (KERNEL_LZO)
6. LZ4 (KERNEL_LZ4)
Default hostname (DEFAULT_HOSTNAME) [(none)] (none)
Support for paging of anonymous memory (swap) (SWAP) [Y/n/?] y
System V IPC (SYSVIPC) [Y/n/?] y
POSIX Message Queues (POSIX_MQUEUE) [N/y/?] n
open by fhandle syscalls (FHANDLE) [N/y/?] n
Auditing support (AUDIT) [N/y/?] n
Kernel .config support (IKCONFIG) [N/m/y/?] n
Kernel log buffer size (16 => 64KB, 17 => 128KB) (LOG_BUF_SHIFT)  18
Checkpoint/restore support (CHECKPOINT_RESTORE) [N/y/?] n
Automatic process group scheduling (SCHED_AUTOGROUP) [N/y/?] n
Enable deprecated sysfs features to support old userspace tools (SYSFS_DEPRECATED) [N/y/?] n
Kernel->user space relay support (formerly relayfs) (RELAY) [Y/n/?] y
Initial RAM filesystem and RAM disk (initramfs/initrd) support (BLK_DEV_INITRD) [Y/n/?] y
Initramfs source file(s) (INITRAMFS_SOURCE) 
Support initial ramdisks compressed using gzip (RD_GZIP) [Y/n/?] y
Support initial ramdisks compressed using bzip2 (RD_BZIP2) [N/y/?] n
Support initial ramdisks compressed using LZMA (RD_LZMA) [N/y/?] n
Support initial ramdisks compressed using XZ (RD_XZ) [N/y/?] n
Support initial ramdisks compressed using LZO (RD_LZO) [N/y/?] n
Support initial ramdisks compressed using LZ4 (RD_LZ4) [N/y/?] n
Optimize for size (CC_OPTIMIZE_FOR_SIZE) [N/y/?] n
* Configure standard kernel features (expert users)
Configure standard kernel features (expert users) (EXPERT) [Y/n/?] y
Sysctl syscall support (SYSCTL_SYSCALL) [N/y/?] n
Load all symbols for debugging/ksymoops (KALLSYMS) [Y/n/?] y
Include all symbols in kallsyms (KALLSYMS_ALL) [Y/n/?] y
Enable support for printk (PRINTK) [Y/n/?] y
BUG() support (BUG) [Y/n/?] y
Enable ELF core dumps (ELF_CORE) [Y/n/?] y
Enable PC-Speaker support (PCSPKR_PLATFORM) [Y/n/?] (NEW)
Enable full-sized data structures for core (BASE_FULL) [Y/n/?] y
Enable futex support (FUTEX) [Y/n/?] y
Enable eventpoll support (EPOLL) [Y/n/?] y
Enable signalfd() system call (SIGNALFD) [Y/n/?] y
Enable timerfd() system call (TIMERFD) [Y/n/?] y
Enable eventfd() system call (EVENTFD) [Y/n/?] y
Use full shmem filesystem (SHMEM) [Y/n/?] y
Enable AIO support (AIO) [Y/n/?] y
Embedded system (EMBEDDED) [N/y/?] n
Enable VM event counters for /proc/vmstat (VM_EVENT_COUNTERS) [Y/n/?] y
Enable SLUB debugging support (SLUB_DEBUG) [N/y/?] n
Disable heap randomization (COMPAT_BRK) [N/y/?] n
Choose SLAB allocator
1. SLAB (SLAB)
> 2. SLUB (Unqueued Allocator) (SLUB)
3. SLOB (Simple Allocator) (SLOB)
SLUB per cpu partial cache (SLUB_CPU_PARTIAL) [Y/n/?] y
Provide system-wide ring of trusted keys (SYSTEM_TRUSTED_KEYRING) [N/y/?] n
Profiling support (PROFILING) [N/y/?] n
Kprobes (KPROBES) [N/y/?] n
Optimize very unlikely/likely branches (JUMP_LABEL) [N/y/?] n
Stack Protector buffer overflow detection
> 1. None (CC_STACKPROTECTOR_NONE)
2. Regular (CC_STACKPROTECTOR_REGULAR)
3. Strong (CC_STACKPROTECTOR_STRONG)
* Processor type and features
DMA memory allocation support (ZONE_DMA) [Y/n/?] y
Symmetric multi-processing support (SMP) [Y/n/?] y
Support for extended (non-PC) x86 platforms (X86_EXTENDED_PLATFORM) [Y/n/?] (NEW)
Single-depth WCHAN output (SCHED_OMIT_FRAME_POINTER) [Y/n/?] (NEW)
* Linux guest support
Linux guest support (HYPERVISOR_GUEST) [N/y/?] (NEW)
Memtest (MEMTEST) [N/y/?] (NEW)
1. Opteron/Athlon64/Hammer/K8 (MK8) (NEW)
2. Intel P4 / older Netburst based Xeon (MPSC) (NEW)
3. Core 2/newer Xeon (MCORE2) (NEW)
4. Intel Atom (MATOM) (NEW)
> 5. Generic-x86-64 (GENERIC_CPU) (NEW)
I would recommend looking at the following Community Document which has some useful information on how to use the Toolchain to build the kernel manually.