How to make a minimal bootable linux (only with terminal) from kernel source code?

Technically you can achieve this. Though, kernel do not have any built-in user-interface.

You need to follow steps as:

1. Create a initramfs with static busybox and nothing else.
This initramfs will have few necessary directories: like proc, sys, tmp, bin, usr, etc

2. Write a "/init" script, whose main job will be:
   a. mount the procfs,tmpfs and sysfs.
   b. Call busybox's udev i.e. mdev
   c. Install the busybox command onto virtual system by executing busybox install -s
   d. Calling /bin/sh

3. Source the initramfs directory while compiling the kernel. You can do so by flag: CONFIG_INITRAMFS_SOURCE

4. Compile your kernel.

5. Boot off this kernel and you will get the shell prompt with minimal things.

Though, I write above notes in a very formal way. You can fine tune it the way you desire.

UPDATE:

Follow this link for some guidelines.