0

I have a Raspberry pi board and I need to make a linux distros to run on my board without use Raspberry pi kernel.

My main purpose is Make a .img file and write to SD-Card then run on my raspberry pi board.

Can i use LFS for this board?

1

Can i use LFS for this board?

Maybe1, but

without use Raspberry pi kernel.

Sorry, you do not have a choice about that. The reason there is a Pi kernel is it includes bits necessary to the operation of the device that are not part of the vanilla kernel.

However, you don't have to use a pre-compiled version, the source for the Pi kernel is here, which you can drop into place with LFS2. I haven't updated this for a while (as I haven't had been doing it anymore), but you may want to glance through the notes here, paying particular attention to the use of the correct defconfig.


1. There may end up being some odd issues with the C library, which is eccentrically organized. Also, there's some stuff you'll want or need to incorporate; have a look here for clues. Note that the use of device tree is something you will want to think about WRT the kernel. The stuff for that is in the same github repo you will find the /opt/vc stuff and precompiled kernel.

2. If you don't follow this or any of the other points made here I very strongly urge you to give up on this quest now. LFS is tedious enough; cross-compiling it for the pi is going to be a torturous experience with a low educational value : time invested ratio. And the only real value of LFS for most people is education IMO; it is a great way to learn how GNU/Linux is put together but you might as well do it on the one system, not cross-compiling. If you aren't cross-compiling, be prepared to wait eons and be confronted with all kinds of headache. Put another way: This is not likely a worthwhile pursuit.

  • Thanks for Answer. What is the reason? Why I do not have a choice about without use Raspberry pi kernel for compiling? Problem in boot? – M. Rostami Aug 9 '16 at 7:13
  • No; I think the boot sequence is like this: 1) The GPU loads bootstrap firmware for the CPU from the first (vfat) partition on the card; 2) The CPU loads a bootloader from the same partition; 3) The bootloader loads a kernel. With linux, the kernel then uses a second partition as the root fs; also it does not use an initramfs because it is built for a very specific piece of hardware and does not have to choose from a set drivers, e.g., to mount the root fs. You'll have to set things up the same way. WRT the bootloader, you cannot use grub, although you can use u-boot. – goldilocks Aug 9 '16 at 12:03
  • Doing this without having a normal Pi based distro as a reference point would be flat out stupid, so you might as well use one first to get the picture. WRT why a special kernel is needed, it's primarily because all the SoC specific stuff has not been integrated into the vanilla tree yet. I don't know if there is the intention to ever do so, although I do not think it is because of licensing (the pi kernel source is open -- but the firmware used at boot is proprietary). – goldilocks Aug 9 '16 at 12:04
  • If you look in the vanilla tree arch/arm directory and go through all the Kconfig files in the various "mach", etc., subdirectories, you'll notice there are literally dozens of different platforms with specific C and ASM bits. If you compile a kernel for any of those, you must explicitly select them in the configuration first (and may be mutually exclusive). The Pi SoC's (BCM2835/6/7) are no different, just they again aren't part of the mainline kernel. – goldilocks Aug 9 '16 at 12:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.