<meter id="pryje"><nav id="pryje"><delect id="pryje"></delect></nav></meter>
          <label id="pryje"></label>

          新聞中心

          EEPW首頁 > 嵌入式系統(tǒng) > 設(shè)計(jì)應(yīng)用 > 在FS2410開發(fā)板上移植linux2.6.24初步成功

          在FS2410開發(fā)板上移植linux2.6.24初步成功

          作者: 時(shí)間:2016-11-10 來源:網(wǎng)絡(luò) 收藏
          說是移植,也不太準(zhǔn)確,因?yàn)?strong>linux2.6.24內(nèi)核已經(jīng)將s3c2410納入。在移植的時(shí)候只是需要做幾個(gè)小的改動以及幾個(gè)注意的地方。

          一. 前言
          使用的內(nèi)核:linux2.6.24,http://www.kernel.org/pub/linux/kernel/v2.6/
          使用的arm交叉編譯工具(4.2.1):http://www.codesourcery.com/gnu_toolchains/arm/download.html
          環(huán)境:VMware中的Ubuntu 7.10

          二. 移植
          1. 修改MakeFile文件,確定arm平臺以及使用的交叉編譯工具:
          修改的文件:
          linux-2.6.24/Makefile

          修改的內(nèi)容:

          #ARCH ?= $(SUBARCH)
          ARCH ?= arm
          #CROSS_COMPILE ?=
          CROSS_COMPILE ?= /usr/local/arm/arm-2007q3/bin/arm-none-linux-gnueabi-

          2. 根據(jù)開發(fā)板修改NAND Flash初始化代碼:
          修改的文件:
          linux-2.6.24/arch/arm/plat-s3c24xx/common-smdk.c
          說明:這一部分的修改與具體的開發(fā)板電路有關(guān)系

          修改的內(nèi)容:
          /* NAND parititon from 2.4.18-swl5 */

          static struct mtd_partition smdk_default_nand_part[] = {
          [0] = {
          .name = "boot", //= "Boot Agent",
          .size = SZ_256K, //= SZ_16K,
          .offset = 0,
          },
          [1] = {
          .name = "kernel", //= "S3C2410 flash partition 1",
          .offset = SZ_256K, //= 0,
          .size = SZ_2M-SZ_256K, //= SZ_2M,
          },
          [2] = {
          .name = "rootfs", //= "S3C2410 flash partition 2",
          .offset = SZ_2M, //= SZ_4M,
          .size = 30 * SZ_1M, //= SZ_4M,
          },
          [3] = {
          .name = "ext-fs1", //= "S3C2410 flash partition 3",
          .offset = SZ_32M, //= SZ_8M,
          .size = SZ_16M, //= SZ_2M,
          },
          [4] = {
          .name = "ext-fs2", //= "S3C2410 flash partition 4",
          .offset = SZ_32M+SZ_16M, //= SZ_1M * 10,
          .size = SZ_16M, //= SZ_4M,
          },
          /* [5] = {
          .name = "S3C2410 flash partition 5",
          .offset = SZ_1M * 14,
          .size = SZ_1M * 10,
          },
          [6] = {
          .name = "S3C2410 flash partition 6",
          .offset = SZ_1M * 24,
          .size = SZ_1M * 24,
          },
          [7] = {
          .name = "S3C2410 flash partition 7",
          .offset = SZ_1M * 48,
          .size = SZ_16M,
          }*/
          };
          參考資料:
          yl2.6.8.1提供的內(nèi)核源代碼
          linux-2.6.8.1-zzm/drivers/mtd/nand/s3c2410_nand.c

          static struct mtd_partition partition_info[] = {
          { name: "boot",
          offset: 0,
          size: SZ_256K },
          { name: "kernel",
          offset: SZ_256K,
          size: SZ_2M - SZ_256K },
          { name: "rootfs",
          offset: SZ_2M,
          size: 30 * SZ_1M },
          { name: "ext-fs1",
          offset: SZ_32M,
          size: SZ_16M },
          { name: "ext-fs2",
          offset: SZ_32M + SZ_16M,
          size: SZ_16M },
          };

          3. 增加devfs文件系統(tǒng)支持
          linux2.6.24已經(jīng)去掉devfs,為了內(nèi)核支持devfs以及在啟動時(shí)并在/sbin/init運(yùn)行之前能自動掛載/dev為devfs文件系統(tǒng),修改fs的Kconfig文件。
          linux-2.6.24/fs/Kconfig

          修改的內(nèi)容:
          找到menu "Pseudo filesystems"
          添加如下語句:
          config DEVFS_FS
          bool "/dev file system support (OBSOLETE)"
          depends on EXPERIMENTAL
          help
          This is support for devfs, a virtual file system (like /proc) which
          provides the file system interface to device drivers, normally found
          in /dev. Devfs does not depend on major and minor number
          allocations. Device drivers register entries in /dev which then
          appear automatically, which means that the system administrator does
          not have to create character and block special device files in the
          /dev directory using the mknod command (or MAKEDEV script) anymore.

          This is work in progress. If you want to use this, you *must* read
          the material in , especially
          the file README there.

          Note that devfs no longer manages /dev/pts! If you are using UNIX98
          ptys, you will also need to mount the /dev/pts filesystem (devpts).

          Note that devfs has been obsoleted by udev,
          .
          It has been stripped down to a bare minimum and is only provided for
          legacy installations that use its naming scheme which is
          unfortunately different from the names normal Linux installations
          use.

          If unsure, say N.

          config DEVFS_MOUNT
          bool "Automatically mount at boot"
          depends on DEVFS_FS
          help
          This option appears if you have CONFIG_DEVFS_FS enabled. Setting
          this to Y will make the kernel automatically mount devfs onto /dev
          when the system is booted, before the init thread is started.
          You can override this with the "devfs=nomount" boot option.

          If unsure, say N.

          config DEVFS_DEBUG
          bool "Debug devfs"
          depends on DEVFS_FS
          help
          If you say Y here, then the /dev file system code will generate
          debugging messages. See the file
          for more
          details.

          If unsure, say N.

          4. 編譯內(nèi)核
          make menuconfig(這一部分比較麻煩,要根據(jù)自己的需要以及開發(fā)板的實(shí)際情況設(shè)定)
          make zImage

          5. 修改根文件系統(tǒng)
          如不修改根文件系統(tǒng),啟動時(shí)會提示“Warning: unable to open an initial console.”的錯(cuò)誤信息。修改方法(根據(jù)FS2410使用手冊整理):
          (1) 將yl2410_demo.cramfs 拷貝到任意目錄下
          (2) 在該目錄下建立兩個(gè)文件:
          mkdir chang
          mkdir guo
          (3) 將yl2410_demo.cramfs 掛接到chang 目錄(必須以root 身份登陸系統(tǒng))
          mount chang yl2410_demo.cramfs –o loop
          (4) 將chang 目錄下的內(nèi)容壓縮
          cd chang
          tar –cvf /chang 的上一級目錄/1.tar ./
          這樣將在chang 的上一級目錄產(chǎn)生一個(gè)1.tar 的包
          (5) 將包解壓到guo 目錄下。
          umount chang ;卸載掛接
          cd .. ;進(jìn)入上一級目錄
          mv 1.tar guo ;
          cd guo ;
          tar –xvf 1.tar ;將打包的根文件系統(tǒng)的里的內(nèi)容解壓
          rm 1.tar

          (6)轉(zhuǎn)到dev目錄
          執(zhí)行mknod console c 5 1
          執(zhí)行mknod null c 1 3

          (7)轉(zhuǎn)到usr目錄
          用剛編譯linux2.6.24內(nèi)核的相應(yīng)文件替換掉以下文件
          |-- ov511.ko #位于linux-2.6.24/drivers/media/video/目錄
          |-- ov511.o #位于linux-2.6.24/drivers/media/video/目錄
          |-- sd_mod.ko #位于linux-2.6.24/drivers/scsi/目錄
          |-- usb-storage.ko #位于linux-2.6.24/drivers/usb/storage/目錄
          |-- usbvideo.ko #位于linux-2.6.24/drivers/media/video/usbvideo/目錄
          |-- usbvideo.o #位于linux-2.6.24/drivers/media/video/usbvideo/目錄
          `-- videodev.o #位于linux-2.6.24/drivers/media/video/目錄

          說明:以上的文件能否生成根據(jù)在開始配置的情況決定。

          (8)制作cramfs 根文件系統(tǒng)
          先將mkcramfs 文件拷貝到guo 所在的目錄
          在這個(gè)目錄下運(yùn)行命令:
          mkcramfs guo fs2410.cramfs
          運(yùn)行成功后,會在該目錄下生成fs2410.cramfs 根文件系統(tǒng)

          6. 下載,燒錄,修改啟動參數(shù),啟動
          根據(jù)FS2410使用手冊下載、燒錄;先修改啟動參數(shù)為:root=1f02 init=/linuxrc console=ttySAC0,115200 devfs=mount display=sam320,主要是將原來的ttyS0改為ttySAC0(這是由于linux內(nèi)核對串行口的改動);然后啟動即可。

          三. 后記
          為什么說初步成功?因?yàn)樵谥谱鞲募到y(tǒng)時(shí)使用的是開發(fā)板自帶的,然后進(jìn)行了簡單的修改。我嘗試自己使用BusyBox制作,可是總不能成功,總是提示”Failed to execute /linuxrc. Attempting defaults...“的錯(cuò)誤,現(xiàn)在還沒有解決。

          linuxdiyf可真快,沒過2天就把這篇文章搞了過去,并且還沒有保留我的署名權(quán),并且將作者換成了編輯,但是最起碼你應(yīng)該標(biāo)明轉(zhuǎn)載,也不應(yīng)該將出處標(biāo)為linuxdiyf。


          關(guān)鍵詞: FS2410移植linux2.6.2

          評論


          相關(guān)推薦

          技術(shù)專區(qū)

          關(guān)閉
          看屁屁www成人影院,亚洲人妻成人图片,亚洲精品成人午夜在线,日韩在线 欧美成人 (function(){ var bp = document.createElement('script'); var curProtocol = window.location.protocol.split(':')[0]; if (curProtocol === 'https') { bp.src = 'https://zz.bdstatic.com/linksubmit/push.js'; } else { bp.src = 'http://push.zhanzhang.baidu.com/push.js'; } var s = document.getElementsByTagName("script")[0]; s.parentNode.insertBefore(bp, s); })();